aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/grammar.txt
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-08-20 01:57:21 +0800
committerchriseth <c@ethdev.com>2016-09-01 06:02:51 +0800
commit3c412ed2f63a58b27eeb00fe584b9378311b099f (patch)
treecba706f91c05658a8b1f8794ad21745ea5619e39 /libsolidity/grammar.txt
parent52d9f897126394dcc7388277d4fbd3ef7b4df38a (diff)
downloaddexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.gz
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.tar.zst
dexon-solidity-3c412ed2f63a58b27eeb00fe584b9378311b099f.zip
Version pragma.
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