diff options
author | chriseth <chris@ethereum.org> | 2017-08-21 22:28:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-21 22:28:42 +0800 |
commit | 1be713acc7abc2f1d21d962e840b1e369d1d8ff6 (patch) | |
tree | 3fbf54186606817a75b14e6ced34fc56ce2af301 | |
parent | 0cf6048800474fd4f69c3c94d9954a08c1709f76 (diff) | |
parent | 8025ac180f12f6f00fd29e49edd528e908ba1ca1 (diff) | |
download | dexon-solidity-1be713acc7abc2f1d21d962e840b1e369d1d8ff6.tar.gz dexon-solidity-1be713acc7abc2f1d21d962e840b1e369d1d8ff6.tar.zst dexon-solidity-1be713acc7abc2f1d21d962e840b1e369d1d8ff6.zip |
Merge pull request #2761 from ethereum/grammar
Update grammar for statemutability and other missed features
-rw-r--r-- | docs/grammar.txt | 7 | ||||
-rw-r--r-- | docs/types.rst | 2 | ||||
-rw-r--r-- | docs/utils/SolidityLexer.py | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/docs/grammar.txt b/docs/grammar.txt index a9838ccb..76827a77 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -16,7 +16,7 @@ ContractPart = StateVariableDeclaration | UsingForDeclaration InheritanceSpecifier = UserDefinedTypeName ( '(' Expression ( ',' Expression )* ')' )? -StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ('=' Expression)? ';' +StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' | 'constant' )? Identifier ('=' Expression)? ';' UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';' StructDefinition = 'struct' Identifier '{' ( VariableDeclaration ';' (VariableDeclaration ';')* )? '}' @@ -25,7 +25,7 @@ ModifierDefinition = 'modifier' Identifier ParameterList? Block ModifierInvocation = Identifier ( '(' ExpressionList? ')' )? FunctionDefinition = 'function' Identifier? ParameterList - ( ModifierInvocation | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )* + ( ModifierInvocation | StateMutability | 'external' | 'public' | 'internal' | 'private' )* ( 'returns' ParameterList )? ( ';' | Block ) EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';' @@ -50,9 +50,10 @@ UserDefinedTypeName = Identifier ( '.' Identifier )* Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' ArrayTypeName = TypeName '[' Expression? ']' -FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* +FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | StateMutability )* ( 'returns' TypeNameList )? StorageLocation = 'memory' | 'storage' +StateMutability = 'constant' | 'payable' Block = '{' Statement* '}' Statement = IfStatement | WhileStatement | ForStatement | Block | InlineAssemblyStatement | diff --git a/docs/types.rst b/docs/types.rst index abf8bb17..13c848c2 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -337,7 +337,7 @@ be passed via and returned from external function calls. Function types are notated as follows:: - function (<parameter types>) {internal|external} [constant] [payable] [returns (<return types>)] + function (<parameter types>) {internal|external} [constant|payable] [returns (<return types>)] In contrast to the parameter types, the return types cannot be empty - if the function type should not return anything, the whole ``returns (<return types>)`` diff --git a/docs/utils/SolidityLexer.py b/docs/utils/SolidityLexer.py index ef55c6a2..a828146f 100644 --- a/docs/utils/SolidityLexer.py +++ b/docs/utils/SolidityLexer.py @@ -57,7 +57,7 @@ class SolidityLexer(RegexLexer): (r'(anonymous|as|assembly|break|constant|continue|do|delete|else|external|for|hex|if|' r'indexed|internal|import|is|mapping|memory|new|payable|public|pragma|' r'private|return|returns|storage|super|this|throw|using|while)\b', Keyword, 'slashstartsregex'), - (r'(var|function|event|modifier|struct|enum|contract|library)\b', Keyword.Declaration, 'slashstartsregex'), + (r'(var|function|event|modifier|struct|enum|contract|library|interface)\b', Keyword.Declaration, 'slashstartsregex'), (r'(bytes|string|address|uint|int|bool|byte|' + '|'.join( ['uint%d' % (i + 8) for i in range(0, 256, 8)] + @@ -71,7 +71,7 @@ class SolidityLexer(RegexLexer): r'null|of|pure|relocatable|static|switch|try|type|typeof|view)\b', Keyword.Reserved), (r'(true|false)\b', Keyword.Constant), (r'(block|msg|tx|now|suicide|selfdestruct|addmod|mulmod|sha3|keccak256|log[0-4]|' - r'sha256|ecrecover|ripemd160|assert|revert)', Name.Builtin), + r'sha256|ecrecover|ripemd160|assert|revert|require)', Name.Builtin), (r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other), (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), (r'0x[0-9a-fA-F]+', Number.Hex), |