Skip to content

Commit

Permalink
feat(grammar): update to new grammar 0.8.18
Browse files Browse the repository at this point in the history
update outdated dependencies
  • Loading branch information
RyuuGan committed Feb 4, 2023
1 parent 84e26f1 commit 7a454c7
Show file tree
Hide file tree
Showing 15 changed files with 2,713 additions and 3,208 deletions.
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"timeout": false,
"spec": "**/*.spec.ts",
"spec": "test/**/*.spec.ts",
"require": "ts-node/register"
}
12 changes: 6 additions & 6 deletions grammar/SolidityLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ ReservedKeywords:
| 'partial' | 'promise' | 'reference' | 'relocatable' | 'sealed' | 'sizeof' | 'static'
| 'supports' | 'switch' | 'typedef' | 'typeof' | 'var';

Pragma: 'pragma' -> pushMode(PragmaMode);
Abstract: 'abstract';
Anonymous: 'anonymous';
Address: 'address';
Anonymous: 'anonymous';
As: 'as';
Assembly: 'assembly' -> pushMode(AssemblyBlockMode);
Bool: 'bool';
Expand All @@ -30,13 +29,11 @@ Else: 'else';
Emit: 'emit';
Enum: 'enum';
Error: 'error'; // not a real keyword
Revert: 'revert'; // not a real keyword
Event: 'event';
External: 'external';
Fallback: 'fallback';
False: 'false';
Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
From: 'from'; // not a real keyword
/**
* Bytes types of fixed length.
*/
Expand All @@ -46,6 +43,7 @@ FixedBytes:
'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' |
'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32';
For: 'for';
From: 'from'; // not a real keyword
Function: 'function';
Global: 'global'; // not a real keyword
Hex: 'hex';
Expand All @@ -67,12 +65,14 @@ New: 'new';
NumberUnit: 'wei' | 'gwei' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years';
Override: 'override';
Payable: 'payable';
Pragma: 'pragma' -> pushMode(PragmaMode);
Private: 'private';
Public: 'public';
Pure: 'pure';
Receive: 'receive';
Return: 'return';
Returns: 'returns';
Revert: 'revert'; // not a real keyword
/**
* Sized signed integer types.
* int is an alias of int256.
Expand Down Expand Up @@ -291,8 +291,8 @@ YulEVMBuiltin:
| 'returndatacopy' | 'extcodehash' | 'create' | 'create2' | 'call' | 'callcode'
| 'delegatecall' | 'staticcall' | 'return' | 'revert' | 'selfdestruct' | 'invalid'
| 'log0' | 'log1' | 'log2' | 'log3' | 'log4' | 'chainid' | 'origin' | 'gasprice'
| 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'gaslimit'
| 'basefee';
| 'blockhash' | 'coinbase' | 'timestamp' | 'number' | 'difficulty' | 'prevrandao'
| 'gaslimit' | 'basefee';
YulLBrace: '{' -> pushMode(YulMode);
YulRBrace: '}' -> popMode;
Expand Down
4 changes: 2 additions & 2 deletions grammar/SolidityParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ errorDefinition:
Semicolon;

/**
* Using directive to bind library functions and free functions to types.
* Using directive to attach library functions and free functions to types.
* Can occur within contracts and libraries and at the file level.
*/
usingDirective: Using (identifierPath | (LBrace identifierPath (Comma identifierPath)* RBrace)) For (Mul | typeName) Global? Semicolon;
Expand Down Expand Up @@ -504,7 +504,7 @@ variableDeclarationTuple:
variableDeclarationStatement: ((variableDeclaration (Assign expression)?) | (variableDeclarationTuple Assign expression)) Semicolon;
expressionStatement: expression Semicolon;

mappingType: Mapping LParen key=mappingKeyType DoubleArrow value=typeName RParen;
mappingType: Mapping LParen key=mappingKeyType name=identifier? DoubleArrow value=typeName name=identifier? RParen;
/**
* Only elementary types or user defined types are viable as mapping keys.
*/
Expand Down
26 changes: 13 additions & 13 deletions lib/antlr/generated/SolidityLexer.interp

Large diffs are not rendered by default.

188 changes: 94 additions & 94 deletions lib/antlr/generated/SolidityLexer.tokens
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
ReservedKeywords=1
Pragma=2
Abstract=3
Abstract=2
Address=3
Anonymous=4
Address=5
As=6
Assembly=7
Bool=8
Break=9
Bytes=10
Calldata=11
Catch=12
Constant=13
Constructor=14
Continue=15
Contract=16
Delete=17
Do=18
Else=19
Emit=20
Enum=21
Error=22
Revert=23
Event=24
External=25
Fallback=26
False=27
Fixed=28
As=5
Assembly=6
Bool=7
Break=8
Bytes=9
Calldata=10
Catch=11
Constant=12
Constructor=13
Continue=14
Contract=15
Delete=16
Do=17
Else=18
Emit=19
Enum=20
Error=21
Event=22
External=23
Fallback=24
False=25
Fixed=26
FixedBytes=27
For=28
From=29
FixedBytes=30
For=31
Function=32
Global=33
Hex=34
If=35
Immutable=36
Import=37
Indexed=38
Interface=39
Internal=40
Is=41
Library=42
Mapping=43
Memory=44
Modifier=45
New=46
NumberUnit=47
Override=48
Payable=49
Private=50
Public=51
Pure=52
Receive=53
Return=54
Returns=55
Function=30
Global=31
Hex=32
If=33
Immutable=34
Import=35
Indexed=36
Interface=37
Internal=38
Is=39
Library=40
Mapping=41
Memory=42
Modifier=43
New=44
NumberUnit=45
Override=46
Payable=47
Pragma=48
Private=49
Public=50
Pure=51
Receive=52
Return=53
Returns=54
Revert=55
SignedIntegerType=56
Storage=57
String=58
Expand Down Expand Up @@ -172,50 +172,50 @@ PragmaSemicolon=171
PragmaWS=172
PragmaCOMMENT=173
PragmaLINE_COMMENT=174
'pragma'=2
'abstract'=3
'abstract'=2
'address'=3
'anonymous'=4
'address'=5
'as'=6
'assembly'=7
'bool'=8
'bytes'=10
'calldata'=11
'catch'=12
'constant'=13
'constructor'=14
'contract'=16
'delete'=17
'do'=18
'else'=19
'emit'=20
'enum'=21
'error'=22
'revert'=23
'event'=24
'external'=25
'fallback'=26
'as'=5
'assembly'=6
'bool'=7
'bytes'=9
'calldata'=10
'catch'=11
'constant'=12
'constructor'=13
'contract'=15
'delete'=16
'do'=17
'else'=18
'emit'=19
'enum'=20
'error'=21
'event'=22
'external'=23
'fallback'=24
'from'=29
'global'=33
'immutable'=36
'import'=37
'indexed'=38
'interface'=39
'internal'=40
'is'=41
'library'=42
'mapping'=43
'memory'=44
'modifier'=45
'new'=46
'override'=48
'payable'=49
'private'=50
'public'=51
'pure'=52
'receive'=53
'return'=54
'returns'=55
'global'=31
'immutable'=34
'import'=35
'indexed'=36
'interface'=37
'internal'=38
'is'=39
'library'=40
'mapping'=41
'memory'=42
'modifier'=43
'new'=44
'override'=46
'payable'=47
'pragma'=48
'private'=49
'public'=50
'pure'=51
'receive'=52
'return'=53
'returns'=54
'revert'=55
'storage'=57
'string'=58
'struct'=59
Expand Down
Loading

0 comments on commit 7a454c7

Please sign in to comment.