Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
c06c77da
Commit
c06c77da
authored
Jan 08, 2009
by
hjk
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
c9b2dfc3
57c10b60
Changes
5
Hide whitespace changes
Inline
Side-by-side
shared/cplusplus/Lexer.cpp
View file @
c06c77da
...
...
@@ -122,6 +122,12 @@ bool Lexer::qtMocRunEnabled() const
void
Lexer
::
setQtMocRunEnabled
(
bool
onoff
)
{
_qtMocRunEnabled
=
onoff
;
}
bool
Lexer
::
objcEnabled
()
const
{
return
_objcEnabled
;
}
void
Lexer
::
setObjcEnabled
(
bool
onoff
)
{
_objcEnabled
=
onoff
;
}
bool
Lexer
::
isIncremental
()
const
{
return
_isIncremental
;
}
...
...
@@ -548,8 +554,53 @@ void Lexer::scan_helper(Token *tok)
break
;
default:
{
if
(
_objcEnabled
)
{
if
(
ch
==
'@'
&&
_yychar
>=
'a'
&&
_yychar
<=
'z'
)
{
const
char
*
yytext
=
_currentChar
;
do
{
yyinp
();
if
(
!
isalnum
(
_yychar
))
break
;
}
while
(
_yychar
);
const
int
yylen
=
_currentChar
-
yytext
;
tok
->
kind
=
classifyObjCAtKeyword
(
yytext
,
yylen
);
break
;
}
else
if
(
ch
==
'@'
&&
_yychar
==
'"'
)
{
// objc @string literals
ch
=
_yychar
;
yyinp
();
tok
->
kind
=
T_AT_STRING_LITERAL
;
const
char
*
yytext
=
_currentChar
;
while
(
_yychar
&&
_yychar
!=
'"'
)
{
if
(
_yychar
!=
'\\'
)
yyinp
();
else
{
yyinp
();
// skip `\\'
if
(
_yychar
)
yyinp
();
}
}
// assert(_yychar == '"');
int
yylen
=
_currentChar
-
yytext
;
if
(
_yychar
==
'"'
)
yyinp
();
if
(
control
())
tok
->
string
=
control
()
->
findOrInsertStringLiteral
(
yytext
,
yylen
);
break
;
}
}
if
(
ch
==
'L'
&&
(
_yychar
==
'"'
||
_yychar
==
'\''
))
{
// wide char literals
// wide char
/string
literals
ch
=
_yychar
;
yyinp
();
...
...
shared/cplusplus/Lexer.h
View file @
c06c77da
...
...
@@ -80,6 +80,9 @@ public:
bool
qtMocRunEnabled
()
const
;
void
setQtMocRunEnabled
(
bool
onoff
);
bool
objcEnabled
()
const
;
void
setObjcEnabled
(
bool
onoff
);
void
scan
(
Token
*
tok
);
inline
void
operator
()(
Token
*
tok
)
...
...
@@ -112,6 +115,7 @@ private:
void
scan_helper
(
Token
*
tok
);
void
setSource
(
const
char
*
firstChar
,
const
char
*
lastChar
);
static
int
classify
(
const
char
*
string
,
int
length
,
bool
q
);
static
int
classifyObjCAtKeyword
(
const
char
*
s
,
int
n
);
static
int
classifyOperator
(
const
char
*
string
,
int
length
);
inline
void
yyinp
()
...
...
@@ -143,6 +147,7 @@ private:
unsigned
_scanKeywords
:
1
;
unsigned
_scanAngleStringLiteralTokens
:
1
;
unsigned
_qtMocRunEnabled
:
1
;
unsigned
_objcEnabled
:
1
;
};
};
unsigned
_currentLine
;
...
...
shared/cplusplus/Token.cpp
View file @
c06c77da
...
...
@@ -62,7 +62,7 @@ static const char *token_names[] = {
(
"<identifier>"
),
(
"<int literal>"
),
(
"<float literal>"
),
(
"<char literal>"
),
(
"<wide char literal>"
),
(
"<string literal>"
),
(
"<wide char literal>"
),
(
"<angle string literal>"
),
(
"<@string literal>"
),
(
"<angle string literal>"
),
(
"&"
),
(
"&&"
),
(
"&="
),
(
"->"
),
(
"->*"
),
(
"^"
),
(
"^="
),
(
":"
),
(
"::"
),
(
","
),
(
"/"
),
(
"/="
),
(
"."
),
(
"..."
),
(
".*"
),
(
"="
),
(
"=="
),
(
"!"
),
...
...
@@ -84,8 +84,16 @@ static const char *token_names[] = {
(
"union"
),
(
"unsigned"
),
(
"using"
),
(
"virtual"
),
(
"void"
),
(
"volatile"
),
(
"wchar_t"
),
(
"while"
),
// gnu
(
"__attribute__"
),
(
"__typeof__"
),
// objc @keywords
(
"@catch"
),
(
"@class"
),
(
"@compatibility_alias"
),
(
"@defs"
),
(
"@dynamic"
),
(
"@encode"
),
(
"@end"
),
(
"@finally"
),
(
"@implementation"
),
(
"@interface"
),
(
"@not_keyword"
),
(
"@optional"
),
(
"@package"
),
(
"@private"
),
(
"@property"
),
(
"@protected"
),
(
"@protocol"
),
(
"@public"
),
(
"@required"
),
(
"@selector"
),
(
"@synchronized"
),
(
"@synthesize"
),
(
"@throw"
),
(
"@try"
),
(
"SIGNAL"
),
(
"SLOT"
),
(
"Q_SIGNALS"
),
(
"Q_SLOTS"
)
};
...
...
@@ -118,6 +126,7 @@ const char *Token::spell() const
case
T_FLOAT_LITERAL
:
case
T_CHAR_LITERAL
:
case
T_STRING_LITERAL
:
case
T_AT_STRING_LITERAL
:
case
T_ANGLE_STRING_LITERAL
:
case
T_WIDE_CHAR_LITERAL
:
case
T_WIDE_STRING_LITERAL
:
...
...
shared/cplusplus/Token.h
View file @
c06c77da
...
...
@@ -73,6 +73,7 @@ enum Kind {
T_WIDE_CHAR_LITERAL
,
T_STRING_LITERAL
,
T_WIDE_STRING_LITERAL
,
T_AT_STRING_LITERAL
,
T_ANGLE_STRING_LITERAL
,
T_LAST_LITERAL
=
T_ANGLE_STRING_LITERAL
,
...
...
@@ -199,6 +200,34 @@ enum Kind {
T___ATTRIBUTE__
,
T___TYPEOF__
,
// obj c++ @ keywords
T_FIRST_OBJC_KEYWORD
,
T_AT_CATCH
=
T_FIRST_OBJC_KEYWORD
,
T_AT_CLASS
,
T_AT_COMPATIBILITY_ALIAS
,
T_AT_DEFS
,
T_AT_DYNAMIC
,
T_AT_ENCODE
,
T_AT_END
,
T_AT_FINALLY
,
T_AT_IMPLEMENTATION
,
T_AT_INTERFACE
,
T_AT_NOT_KEYWORD
,
T_AT_OPTIONAL
,
T_AT_PACKAGE
,
T_AT_PRIVATE
,
T_AT_PROPERTY
,
T_AT_PROTECTED
,
T_AT_PROTOCOL
,
T_AT_PUBLIC
,
T_AT_REQUIRED
,
T_AT_SELECTOR
,
T_AT_SYNCHRONIZED
,
T_AT_SYNTHESIZE
,
T_AT_THROW
,
T_AT_TRY
,
T_FIRST_QT_KEYWORD
,
// Qt keywords
...
...
shared/cplusplus/cplusplus.pri
View file @
c06c77da
...
...
@@ -54,6 +54,7 @@ SOURCES += \
$$PWD/DiagnosticClient.cpp \
$$PWD/FullySpecifiedType.cpp \
$$PWD/Keywords.cpp \
$$PWD/ObjectiveCAtKeywords.cpp \
$$PWD/Lexer.cpp \
$$PWD/LiteralTable.cpp \
$$PWD/Literals.cpp \
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment