aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/grammar.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/grammar.txt')
-rw-r--r--libsolidity/grammar.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index 0d1f68a6..0230729a 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -1,13 +1,16 @@
-SourceUnit = (ImportDirective | ContractDefinition)*
+SourceUnit = (PragmaDirective | ImportDirective | ContractDefinition)*
-ContractDefinition = ( 'contract' | 'library' ) Identifier
- ( 'is' InheritanceSpecifier (',' InheritanceSpecifier )* )?
- '{' ContractPart* '}'
+// Pragma actually parses anything up to the trailing ';' to be fully forward-compatible.
+PragmaDirective = 'pragma' Identifier Expression ';'
ImportDirective = 'import' StringLiteral ('as' Identifier)? ';'
| 'import' ('*' | Identifier) ('as' Identifier)? 'from' StringLiteral ';'
| 'import' '{' Identifier ('as' Identifier)? ( ',' Identifier ('as' Identifier)? )* '}' 'from' StringLiteral ';'
+ContractDefinition = ( 'contract' | 'library' ) Identifier
+ ( 'is' InheritanceSpecifier (',' InheritanceSpecifier )* )?
+ '{' ContractPart* '}'
+
ContractPart = StateVariableDeclaration | UsingForDeclaration
| StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition