mirror of
https://gitee.com/BDWare/genparser
synced 2025-04-27 14:32:15 +00:00
feat: add keyword of functions
add keyword "view" for functions, to record functions that don't change contract status after execution
This commit is contained in:
parent
af0637377e
commit
df920d4cf1
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/gen/
|
/gen/
|
||||||
/input/JavaScriptLexer.tokens
|
/input/JavaScriptLexer.tokens
|
||||||
|
/input/gen
|
@ -147,11 +147,15 @@ AtLeastOnce: 'AT_LEAST_ONCE';
|
|||||||
AtMostOnce: 'AT_MOST_ONCE';
|
AtMostOnce: 'AT_MOST_ONCE';
|
||||||
OnlyOnce: 'ONLY_ONCE';
|
OnlyOnce: 'ONLY_ONCE';
|
||||||
|
|
||||||
// Event Global or Local
|
/// Event Global or Local
|
||||||
|
|
||||||
Global: 'global';
|
Global: 'global';
|
||||||
Local: 'local';
|
Local: 'local';
|
||||||
|
|
||||||
|
/// Function Type
|
||||||
|
|
||||||
|
View: 'view';
|
||||||
|
|
||||||
/// Future Reserved Words
|
/// Future Reserved Words
|
||||||
|
|
||||||
Class: 'class';
|
Class: 'class';
|
||||||
|
@ -63,11 +63,6 @@ clzOrFunctionDeclaration
|
|||||||
|functionDeclaration
|
|functionDeclaration
|
||||||
|eventDeclaration
|
|eventDeclaration
|
||||||
;
|
;
|
||||||
eventSemantics
|
|
||||||
:AtLeastOnce
|
|
||||||
|AtMostOnce
|
|
||||||
|OnlyOnce
|
|
||||||
;
|
|
||||||
eventDeclaration
|
eventDeclaration
|
||||||
:Event eventGlobalOrLocal? Identifier SemiColon
|
:Event eventGlobalOrLocal? Identifier SemiColon
|
||||||
|Event eventGlobalOrLocal? Identifier '(' eventSemantics? ')' SemiColon
|
|Event eventGlobalOrLocal? Identifier '(' eventSemantics? ')' SemiColon
|
||||||
@ -76,6 +71,11 @@ eventGlobalOrLocal
|
|||||||
:Global
|
:Global
|
||||||
|Local
|
|Local
|
||||||
;
|
;
|
||||||
|
eventSemantics
|
||||||
|
:AtLeastOnce
|
||||||
|
|AtMostOnce
|
||||||
|
|OnlyOnce
|
||||||
|
;
|
||||||
sourceElement
|
sourceElement
|
||||||
: statement
|
: statement
|
||||||
;
|
;
|
||||||
@ -213,7 +213,7 @@ debuggerStatement
|
|||||||
;
|
;
|
||||||
|
|
||||||
functionDeclaration
|
functionDeclaration
|
||||||
: annotations? Export? Function Identifier '(' formalParameterList? ')' '{' functionBody '}'
|
: annotations? Export? Function Identifier '(' formalParameterList? ')' View '{' functionBody '}'
|
||||||
;
|
;
|
||||||
|
|
||||||
classDeclaration
|
classDeclaration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user