diff --git a/src/main/grammar/main.bnf b/src/main/grammar/main.bnf index aacd081..f2415dd 100644 --- a/src/main/grammar/main.bnf +++ b/src/main/grammar/main.bnf @@ -291,14 +291,16 @@ private FieldDeclaration ::= PropertyName ':' Type CodeBlock ::= '{' Statement* '}'{ pin=1 } -private Statement ::= (ReturnStatement|IfElseStatement|ExpressionStatement) ';'?{ - recoverWhile=recoverWhileForComponentBody +private Statement ::= (ReturnStatement|IfElseStatement|ExpressionStatement) ';'*{ +} +ExpressionStatement ::= Expression (';'+ | &'}') { + pin=1 +// recoverWhile=recoverWhileForComponentBody } -ExpressionStatement ::= Expression (';' &Statement)? //private recoverWhileStatement::=!(GenericIdentifier|';'|'}') -ReturnStatement ::= 'return' (Expression)?{ +ReturnStatement ::= ReturnKeyword (Expression)?{ pin=1 } private IfElseStatement ::= IfStatement (ElseIfStatement)* ElseStatement?{ @@ -504,7 +506,7 @@ AnimateKeyword::='animate' OutKeyword::='out' InOutKeyword::='in-out' PrivateKeyword::='private' - +ReturnKeyword::='return' //---------NamedIdentifier ,简化PsiTree----------------------------------- //noinspection BnfUnusedRule 用于标记命名节点对应的identifier Named ::= PropertyName | TypeName |ExternalName | InternalName|ComponentName|FunctionName{