-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor grammar and parser class names
- Loading branch information
Showing
35 changed files
with
554 additions
and
1,020 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/main/antlr/CFParser.g4 → src/main/antlr/BaseScriptGrammar.g4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
lexer grammar CFLexer; | ||
lexer grammar BaseScriptLexer; | ||
|
||
options { | ||
caseInsensitive = true; | ||
|
4 changes: 2 additions & 2 deletions
4
src/main/antlr/CFMLParser.g4 → src/main/antlr/BaseTemplateGrammar.g4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/antlr/CFMLLexer.g4 → src/main/antlr/BaseTemplateLexer.g4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
lexer grammar CFMLLexer; | ||
lexer grammar BaseTemplateLexer; | ||
|
||
options { | ||
caseInsensitive = true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parser grammar BoxScriptGrammar; | ||
|
||
options { | ||
tokenVocab = BoxScriptLexer; | ||
} | ||
|
||
import BaseScriptGrammar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,210 +1,7 @@ | ||
lexer grammar BoxScriptLexer; | ||
|
||
lexer grammar BoxScriptLexer; | ||
|
||
options { | ||
caseInsensitive = true; | ||
caseInsensitive = true; | ||
} | ||
|
||
/** | ||
* DEFAULT MODE | ||
* https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md#lexical-modes | ||
*/ | ||
ABSTRACT : 'ABSTRACT'; | ||
ABORT : 'ABORT'; | ||
ADMIN : 'ADMIN'; | ||
ANY : 'ANY'; | ||
APPLICATION : 'APPLICATION'; | ||
ARGUMENTS : 'ARGUMENTS'; | ||
ARRAY : 'ARRAY'; | ||
ASSERT : 'ASSERT'; | ||
BOOLEAN : 'BOOLEAN'; | ||
BREAK : 'BREAK'; | ||
CASE : 'CASE'; | ||
CATCH : 'CATCH'; | ||
CLASS : 'CLASS'; | ||
COMPONENT : 'COMPONENT'; | ||
CONTAIN : 'CONTAIN'; | ||
CONTAINS : 'CONTAINS'; | ||
CONTINUE : 'CONTINUE'; | ||
DEFAULT : 'DEFAULT'; | ||
DOES : 'DOES'; | ||
DO : 'DO'; | ||
EXTENDS : 'EXTENDS'; | ||
ELSE : 'ELSE'; | ||
ELIF : 'ELIF'; | ||
FALSE : 'FALSE'; | ||
FINALLY : 'FINALLY'; | ||
FOR : 'FOR'; | ||
FUNCTION : 'FUNCTION'; | ||
IF : 'IF'; | ||
IN : 'IN'; | ||
IMPLEMENTS : 'IMPLEMENTS'; | ||
IMPORT : 'IMPORT'; | ||
INCLUDE : 'INCLUDE'; | ||
INIT : 'INIT'; | ||
INTERFACE : 'INTERFACE'; | ||
INSTANCEOF : 'INSTANCEOF'; | ||
IS : 'IS'; | ||
JAVA : 'JAVA'; | ||
LOCAL : 'LOCAL'; | ||
LOCK : 'LOCK'; | ||
MOD : 'MOD'; | ||
NEW : 'NEW'; | ||
NUMERIC : 'NUMERIC'; | ||
PACKAGE : 'PACKAGE'; | ||
PARAM : 'PARAM'; | ||
PRIVATE : 'PRIVATE'; | ||
PROPERTY : 'PROPERTY'; | ||
PUBLIC : 'PUBLIC'; | ||
QUERY : 'QUERY'; | ||
REMOTE : 'REMOTE'; | ||
REQUIRED : 'REQUIRED'; | ||
REQUEST : 'REQUEST'; | ||
RETURN : 'RETURN'; | ||
RETHROW : 'RETHROW'; | ||
SAVECONTENT : 'SAVECONTENT'; | ||
SETTING : 'SETTING'; | ||
STATIC : 'STATIC'; | ||
STRING : 'STRING'; | ||
STRUCT : 'STRUCT'; | ||
SWITCH : 'SWITCH'; | ||
THIS : 'THIS'; | ||
THREAD : 'THREAD'; | ||
THROW : 'THROW'; | ||
TYPE : 'TYPE'; | ||
TRUE : 'TRUE'; | ||
TRY : 'TRY'; | ||
VAR : 'VAR'; | ||
VARIABLES : 'VARIABLES'; | ||
WHEN : 'WHEN'; | ||
WHILE : 'WHILE'; | ||
XOR : 'XOR'; | ||
|
||
AMPERSAND : '&'; | ||
AND : '&&' | 'AND'; | ||
ARROW : '->'; | ||
BACKSLASH : '\\'; | ||
COMMA : ','; | ||
COLON : ':'; | ||
COLONCOLON : '::'; | ||
DOT : '.'; | ||
ELVIS : '?:'; | ||
EQUAL : '='; | ||
EQ : '==' | 'EQ'; | ||
GT : '>' | 'GT'; | ||
GTE : '>=' | 'GTE'; | ||
LBRACE : '{'; | ||
RBRACE : '}'; | ||
LPAREN : '('; | ||
RPAREN : ')'; | ||
LBRACKET : '['; | ||
RBRACKET : ']'; | ||
ARROW_RIGHT : '=>'; | ||
LT : '<' | 'LT'; | ||
LTE : '<=' | 'LTE'; | ||
MINUS : '-'; | ||
MINUSMINUS : '--'; | ||
NEQ : '!=' | 'NEQ' | '<>'; | ||
NOT : '!' | 'NOT'; | ||
OR : '||' | 'OR'; | ||
PERCENT : '%'; | ||
POWER : '^'; | ||
QM : '?'; | ||
SEMICOLON : ';'; | ||
SLASH : '/'; | ||
STAR : '*'; | ||
CONCATEQUAL : '&='; | ||
PLUSEQUAL : '+='; | ||
MINUSEQUAL : '-='; | ||
STAREQUAL : '*='; | ||
SLASHEQUAL : '/='; | ||
MODEQUAL : '%='; | ||
PLUS : '+'; | ||
PLUSPLUS : '++'; | ||
TEQ : '==='; | ||
|
||
|
||
|
||
|
||
LCFTAG : '<' CFTAG '>' ; | ||
RCFTAG : '</' CFTAG '>' ; | ||
fragment CFTAG : 'cfscript' ; | ||
|
||
|
||
|
||
ICHAR_1 : '#' {_modeStack.contains(hashMode)}? -> type(ICHAR),popMode,popMode; | ||
ICHAR : '#'; | ||
|
||
WS : (' ' | '\t' | '\f' )+ -> skip; | ||
NEWLINE : ('\n' | '\r' )+ | ||
(' ' | '\t' | '\f' | '\n' | '\r' )* -> channel(HIDDEN); | ||
MULTILINE_COMMENT | ||
: '/*' (.)*? '*/' -> channel(HIDDEN) | ||
; | ||
|
||
LINE_COMMENT : | ||
'//' | ||
( ~('\n'|'\r') )* | ||
( '\n'|'\r'('\n')? )? | ||
-> channel(HIDDEN) ; | ||
|
||
OPEN_QUOTE : '"' -> pushMode(quotesMode); | ||
|
||
OPEN_SINGLE : '\''-> type(OPEN_QUOTE),pushMode(squotesMode); | ||
|
||
fragment DIGIT : [0-9]; | ||
fragment E_SIGN : [eE]; | ||
fragment E_NOTATION : E_SIGN [+-]? DIGIT+; | ||
FLOAT_LITERAL | ||
: DIGIT+ DOT DIGIT* (E_NOTATION)? | ||
| DOT DIGIT+ (E_NOTATION)? | ||
| DIGIT+ E_NOTATION | ||
; | ||
|
||
INTEGER_LITERAL : DIGIT+; | ||
IDENTIFIER : [a-z_$]+ ( [_]+ | [a-z]+ | DIGIT)*; | ||
|
||
|
||
|
||
mode squotesMode; | ||
CLOSE_SQUOTE | ||
: '\'' -> type(CLOSE_QUOTE),popMode | ||
; | ||
|
||
SHASHHASH | ||
: '##' | ||
; | ||
|
||
SSTRING_LITERAL | ||
: (~['#]+ | '\'\'' )+ -> type(STRING_LITERAL) | ||
; | ||
|
||
SHASH | ||
: '#' -> type(ICHAR),pushMode(hashMode),pushMode(DEFAULT_MODE) | ||
; | ||
|
||
|
||
mode quotesMode; | ||
CLOSE_QUOTE | ||
: '"' | ||
-> popMode | ||
; | ||
|
||
HASHHASH | ||
: '##' | ||
; | ||
STRING_LITERAL | ||
: (~["#]+ | '""' )+ | ||
; | ||
HASH | ||
: '#' -> type(ICHAR),pushMode(hashMode),pushMode(DEFAULT_MODE) | ||
; | ||
mode hashMode; | ||
HANY | ||
: [.]+ -> popMode,skip; | ||
import BaseScriptLexer; |
Oops, something went wrong.