e.g. "=="
SPECIAL_TOKEN : {
<SPACES : ([" ", "\t", "\n", "\r", "\f"])+ >
}
SPECIAL_TOKEN : {
<LINE_COMMENT : "//" (~["\n", "\r"])* ("\n" | "\r\n" | "\r")? >
}
MORE : {
< "/*" > : IN_BLOCK_COMMENT
}
<IN_BLOCK_COMMENT> MORE : {
< ~[] >
}
<IN_BLOCK_COMMENT> SPECIAL_TOKEN : {
<BLOCK_COMMENT : "*/" > : DEFAULT
}
TOKEN : {
<VOID : "void">
| <CHAR : "char">
| <SHORT : "short">
| <INT : "int">
| <LONG : "long">
| <STRUCT : "struct">
| <UNION : "union">
| <ENUM : "enum">
| <STATIC : "static">
| <EXTERN : "extern">
| <CONST : "const">
| <SIGNED : "signed">
| <UNSIGNED : "unsigned">
| <IF : "if">
| <ELSE : "else">
| <SWITCH : "switch">
| <CASE : "case">
| <DEFAULT_ : "default">
| <WHILE : "while">
| <DO : "do">
| <FOR : "for">
| <RETURN : "return">
| <BREAK : "break">
| <CONTINUE : "continue">
| <GOTO : "goto">
| <TYPEDEF : "typedef">
| <IMPORT : "import">
| <SIZEOF : "sizeof">
}
TOKEN : {
<IDENTIFIER : ["a"-"z", "A"-"Z", "_"] (["a"-"z", "A"-"Z", "_", "0"-"9"])* >
}
TOKEN : {
<INTEGER : ["1"-"9"] (["0"-"9"])* ("U")? ("L")?
| "0" ["x", "X"] (["0"-"9", "a"-"f", "A"-"F"])+ ("U")? ("L")?
| "0" (["0"-"7"])* ("U")? ("L")? >
}
MORE : {
<"\""> : IN_STRING
}
<IN_STRING> MORE : {
< (~["\"", "\\", "\n", "\r"])+ >
| < "\\" (["0"-"7"]){3} >
| < "\\" ~[] >
}
<IN_STRING> TOKEN : {
<STRING: "\""> : DEFAULT
}
MORE : { <"'"> : IN_CHARACTER }
<IN_CHARACTER> MORE : {
< ~["'", "\\", "\n", "\r"] > : CHARACTER_TERM
| < "\\" (["0"-"7"]){3} > : CHARACTER_TERM
| < "\\" ~[] > : CHARACTER_TERM
}
<CHARACTER_TERM> TOKEN : {
<CHARACTER: "'" > : DEFAULT
}