-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLexer.g4
More file actions
58 lines (51 loc) · 1.17 KB
/
Lexer.g4
File metadata and controls
58 lines (51 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
lexer grammar Lexer;
WS: [ \t\r\n]+ -> skip;
NEWLINE: [\r\n]+;
MULTILINE_COMMENT: '/*' (MULTILINE_COMMENT | .)*? '*/' -> skip;
LINE_COMMENT: '//' .*? NEWLINE -> channel(HIDDEN);
VARS: 'vars';
MAX: 'max';
SOURCE: 'source';
DESTINATION: 'destination';
SEND: 'send';
FROM: 'from';
UP: 'up';
TO: 'to';
REMAINING: 'remaining';
ALLOWING: 'allowing';
UNBOUNDED: 'unbounded';
OVERDRAFT: 'overdraft';
ONEOF: 'oneof';
KEPT: 'kept';
SAVE: 'save';
LPARENS: '(';
RPARENS: ')';
LBRACKET: '[';
RBRACKET: ']';
LBRACE: '{';
RBRACE: '}';
COMMA: ',';
EQ: '=';
STAR: '*';
PLUS: '+';
MINUS: '-';
DIV: '/';
RESTRICT: '\\';
WITH: 'with';
SCALING: 'scaling';
THROUGH: 'through';
FEATURE: 'feature';
HASH_BANG: '#!';
PERCENTAGE_PORTION_LITERAL: [0-9]+ ('.' [0-9]+)? '%';
STRING: '"' ('\\"' | ~[\r\n"])* '"';
IDENTIFIER: [a-z]+ [a-z_]*;
NUMBER: [0-9]+ ('_' [0-9]+)*;
ASSET: [A-Z][A-Z0-9]* ('/' [0-9]+)?;
ACCOUNT_START: '@' -> pushMode(ACCOUNT_MODE);
COLON: ':' -> pushMode(ACCOUNT_MODE);
fragment VARIABLE_NAME_FRAGMENT: '$' [a-z_]+ [a-z0-9_]*;
mode ACCOUNT_MODE;
ACCOUNT_TEXT: [a-zA-Z0-9_-]+ -> popMode;
VARIABLE_NAME_ACC: VARIABLE_NAME_FRAGMENT -> popMode;
mode DEFAULT_MODE;
VARIABLE_NAME: VARIABLE_NAME_FRAGMENT;