Skip to content

Commit

Permalink
update grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusaaguiar committed Sep 28, 2024
1 parent db8a217 commit a632251
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/grammar/SolidityLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Address: 'address';
Anonymous: 'anonymous';
As: 'as';
Assembly: 'assembly' -> pushMode(AssemblyBlockMode);
At: 'at'; // not a real keyword
Bool: 'bool';
Break: 'break';
Bytes: 'bytes';
Expand Down Expand Up @@ -54,6 +55,7 @@ Indexed: 'indexed';
Interface: 'interface';
Internal: 'internal';
Is: 'is';
Layout: 'layout'; // not a real keyword
Library: 'library';
Mapping: 'mapping';
Memory: 'memory';
Expand Down
11 changes: 8 additions & 3 deletions docs/grammar/SolidityParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ symbolAliases: LBrace aliases+=importAliases (Comma aliases+=importAliases)* RBr
/**
* Top-level definition of a contract.
*/
contractDefinition:
contractDefinition
locals [boolean layoutSet=false, boolean inheritanceSet=false]
:
Abstract? Contract name=identifier
inheritanceSpecifierList?
(
{!$layoutSet}? Layout At expression {$layoutSet = true;}
| {!$inheritanceSet}? inheritanceSpecifierList {$inheritanceSet = true;}
)*
LBrace contractBodyElement* RBrace;
/**
* Top-level definition of an interface.
Expand Down Expand Up @@ -420,7 +425,7 @@ inlineArrayExpression: LBrack (expression ( Comma expression)* ) RBrack;
/**
* Besides regular non-keyword Identifiers, some keywords like 'from' and 'error' can also be used as identifiers.
*/
identifier: Identifier | From | Error | Revert | Global | Transient;
identifier: Identifier | From | Error | Revert | Global | Transient | Layout | At;

literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral;

Expand Down

0 comments on commit a632251

Please sign in to comment.