generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from KyrylR/dev
Update Grammar
- Loading branch information
Showing
27 changed files
with
793 additions
and
154 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,152 @@ | ||
lexer grammar CircomLexer; | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
COMMON STRUCTURES AND TERMINALS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
VERSION: NUMBER '.' NUMBER '.' NUMBER ; | ||
|
||
SIGNAL_TYPE: INPUT | OUTPUT ; | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
EXPLICIT KEYWORDS DEFINITION | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
PRAGMA: 'pragma' ; | ||
CIRCOM: 'circom' ; | ||
|
||
CUSTOM_TEMPLATES: 'custom_templates' ; | ||
|
||
INCLUDE: 'include' ; | ||
|
||
CUSTOM: 'custom' ; | ||
PARALLEL: 'parallel' ; | ||
|
||
BUS: 'bus' ; | ||
TEMPLATE: 'template' ; | ||
FUNCTION: 'function' ; | ||
|
||
MAIN: 'main' ; | ||
PUBLIC: 'public' ; | ||
COMPONENT: 'component' ; | ||
|
||
VAR: 'var' ; | ||
SIGNAL: 'signal' ; | ||
|
||
INPUT: 'input' ; | ||
OUTPUT: 'output' ; | ||
|
||
IF: 'if' ; | ||
ELSE: 'else' ; | ||
|
||
FOR: 'for' ; | ||
WHILE: 'while' ; | ||
DO: 'do' ; | ||
|
||
LOG: 'log' ; | ||
ASSERT: 'assert' ; | ||
|
||
RETURN: 'return' ; | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
SYMBOLS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
LP: '(' ; | ||
RP: ')' ; | ||
|
||
LB: '[' ; | ||
RB: ']' ; | ||
|
||
LC: '{' ; | ||
RC: '}' ; | ||
|
||
SEMICOLON: ';' ; | ||
|
||
DOT: '.' ; | ||
COMMA: ',' ; | ||
|
||
UNDERSCORE: '_' ; | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
OPERATORS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
TERNARY_CONDITION: '?' ; | ||
TERNARY_ALTERNATIVE: ':' ; | ||
|
||
EQ_CONSTRAINT: '===' ; | ||
|
||
LEFT_CONSTRAINT: '<==' ; | ||
LEFT_ASSIGNMENT: '<--' ; | ||
|
||
RIGHT_CONSTRAINT: '==>' ; | ||
RIGHT_ASSIGNMENT: '-->' ; | ||
|
||
// Unary operators | ||
SELF_OP: '++' | '--' ; | ||
|
||
NOT: '!' ; | ||
BNOT: '~' ; | ||
|
||
// left to right associativity | ||
POW: '**' ; | ||
|
||
MUL: '*' ; | ||
DIV: '/' ; | ||
QUO: '\\' ; | ||
MOD: '%' ; | ||
|
||
ADD: '+' ; | ||
SUB: '-' ; | ||
|
||
SHL: '<<' ; | ||
SHR: '>>' ; | ||
|
||
BAND: '&' ; | ||
BXOR: '^' ; | ||
BOR: '|' ; | ||
|
||
// Require parentheses associativity | ||
EQ: '==' ; | ||
NEQ: '!=' ; | ||
GT: '>' ; | ||
LT: '<' ; | ||
LE: '<=' ; | ||
GE: '>=' ; | ||
|
||
// left to right associativity | ||
AND: '&&' ; | ||
OR: '||' ; | ||
|
||
// right to left associativity | ||
ASSIGNMENT: '=' ; | ||
ASSIGNMENT_WITH_OP: '+=' | '-=' | '*=' | '**=' | '/=' | '\\=' | '%=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ; | ||
|
||
ID : ID_SYMBOL* LETTER (LETTER|ID_SYMBOL|DIGIT)* ; // r"[$_]*[a-zA-Z][a-zA-Z$_0-9]*" | ||
fragment | ||
LETTER : [a-zA-Z] ; | ||
fragment | ||
ID_SYMBOL : [_$] ; | ||
|
||
NUMBER: DIGIT+ | HEX; | ||
fragment | ||
DIGIT: [0-9] ; | ||
|
||
HEX : '0' 'x' HEXDIGIT+ ; // 0x[0-9A-Fa-f]* | ||
fragment | ||
HEXDIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; | ||
|
||
STRING : '"' (ESC|.)*? '"' ; | ||
fragment ESC: '\\' [btnrf"\\] ; | ||
COMMENT | ||
: '/*' .*? '*/' -> channel(HIDDEN) | ||
; | ||
LINE_COMMENT | ||
: '//' ~[\r\n]* -> channel(HIDDEN) | ||
; | ||
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN) | ||
; |
Oops, something went wrong.