diff --git a/.gitignore b/.gitignore index 0384afc..6b7772b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /gen/ -/input/JavaScriptLexer.tokens \ No newline at end of file +/input/JavaScriptLexer.tokens +/input/gen \ No newline at end of file diff --git a/input/JavaScriptLexer.g4 b/input/JavaScriptLexer.g4 index c7d17c3..f292e5a 100644 --- a/input/JavaScriptLexer.g4 +++ b/input/JavaScriptLexer.g4 @@ -147,11 +147,15 @@ AtLeastOnce: 'AT_LEAST_ONCE'; AtMostOnce: 'AT_MOST_ONCE'; OnlyOnce: 'ONLY_ONCE'; -// Event Global or Local +/// Event Global or Local Global: 'global'; Local: 'local'; +/// Function Type + +View: 'view'; + /// Future Reserved Words Class: 'class'; diff --git a/input/YJSParser.g4 b/input/YJSParser.g4 index e8e01a5..69116bb 100644 --- a/input/YJSParser.g4 +++ b/input/YJSParser.g4 @@ -63,11 +63,6 @@ clzOrFunctionDeclaration |functionDeclaration |eventDeclaration ; -eventSemantics - :AtLeastOnce - |AtMostOnce - |OnlyOnce - ; eventDeclaration :Event eventGlobalOrLocal? Identifier SemiColon |Event eventGlobalOrLocal? Identifier '(' eventSemantics? ')' SemiColon @@ -76,6 +71,11 @@ eventGlobalOrLocal :Global |Local ; +eventSemantics + :AtLeastOnce + |AtMostOnce + |OnlyOnce + ; sourceElement : statement ; @@ -213,7 +213,7 @@ debuggerStatement ; functionDeclaration - : annotations? Export? Function Identifier '(' formalParameterList? ')' '{' functionBody '}' + : annotations? Export? Function Identifier '(' formalParameterList? ')' View '{' functionBody '}' ; classDeclaration