Commit 1eefd163 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed a few typos and bugs in the ObjC++ support.

parent a446e067
...@@ -55,6 +55,11 @@ bool SimpleToken::isComment() const ...@@ -55,6 +55,11 @@ bool SimpleToken::isComment() const
return _kind == T_COMMENT || _kind == T_DOXY_COMMENT; return _kind == T_COMMENT || _kind == T_DOXY_COMMENT;
} }
bool SimpleToken::isObjCAtKeyword() const
{
return _kind >= T_FIRST_LITERAL && _kind <= T_LAST_OBJC_AT_KEYWORD;
}
SimpleLexer::SimpleLexer() SimpleLexer::SimpleLexer()
: _lastState(0), : _lastState(0),
_skipComments(false), _skipComments(false),
......
...@@ -79,6 +79,7 @@ public: ...@@ -79,6 +79,7 @@ public:
bool isOperator() const; bool isOperator() const;
bool isKeyword() const; bool isKeyword() const;
bool isComment() const; bool isComment() const;
bool isObjCAtKeyword() const;
public: public:
int _kind; int _kind;
......
...@@ -157,7 +157,7 @@ void CppHighlighter::highlightBlock(const QString &text) ...@@ -157,7 +157,7 @@ void CppHighlighter::highlightBlock(const QString &text)
initialState = 0; initialState = 0;
} }
} else if (tk.isKeyword() || isQtKeyword(tk.text())) } else if (tk.isKeyword() || isQtKeyword(tk.text()) || tk.isObjCAtKeyword())
setFormat(tk.position(), tk.length(), m_formats[CppKeywordFormat]); setFormat(tk.position(), tk.length(), m_formats[CppKeywordFormat]);
else if (tk.isOperator()) else if (tk.isOperator())
......
...@@ -598,7 +598,7 @@ void Lexer::scan_helper(Token *tok) ...@@ -598,7 +598,7 @@ void Lexer::scan_helper(Token *tok)
do { do {
yyinp(); yyinp();
if (! isalnum(_yychar)) if (! (isalnum(_yychar) || _yychar == '_'))
break; break;
} while (_yychar); } while (_yychar);
......
...@@ -56,7 +56,7 @@ static const char *token_names[] = { ...@@ -56,7 +56,7 @@ static const char *token_names[] = {
("<comment>"), ("<doxy comment>"), ("<comment>"), ("<doxy comment>"),
("<identifier>"), ("<int literal>"), ("<float literal>"), ("<char literal>"), ("<identifier>"), ("<numeric literal>"), ("<char literal>"),
("<wide char literal>"), ("<string literal>"), ("<wide char literal>"), ("<wide char literal>"), ("<string literal>"), ("<wide char literal>"),
("<@string literal>"), ("<angle string literal>"), ("<@string literal>"), ("<angle string literal>"),
......
...@@ -224,9 +224,9 @@ enum Kind { ...@@ -224,9 +224,9 @@ enum Kind {
T_AT_THROW, T_AT_THROW,
T_AT_TRY, T_AT_TRY,
T_LAST_OBJC_AT_KEYWORD, T_LAST_OBJC_AT_KEYWORD = T_AT_TRY,
T_FIRST_QT_KEYWORD = T_LAST_OBJC_AT_KEYWORD, T_FIRST_QT_KEYWORD,
// Qt keywords // Qt keywords
T_SIGNAL = T_FIRST_QT_KEYWORD, T_SIGNAL = T_FIRST_QT_KEYWORD,
...@@ -300,7 +300,7 @@ public: ...@@ -300,7 +300,7 @@ public:
{ return kind == T_COMMENT || kind == T_DOXY_COMMENT; } { return kind == T_COMMENT || kind == T_DOXY_COMMENT; }
inline bool isObjCAtKeyword() const inline bool isObjCAtKeyword() const
{ return kind >= T_FIRST_OBJC_AT_KEYWORD && kind < T_LAST_OBJC_AT_KEYWORD; } { return kind >= T_FIRST_OBJC_AT_KEYWORD && kind <= T_LAST_OBJC_AT_KEYWORD; }
static const char *name(int kind); static const char *name(int kind);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment