From 65172edd8d8960b5d7d1cf515771093712ef82be Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Mar 2021 16:50:29 +0100 Subject: [PATCH] Grammar for revert statement. --- docs/grammar/Solidity.g4 | 7 ++++++- docs/grammar/SolidityLexer.g4 | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/grammar/Solidity.g4 b/docs/grammar/Solidity.g4 index 611556db2357..a95787345ec5 100644 --- a/docs/grammar/Solidity.g4 +++ b/docs/grammar/Solidity.g4 @@ -381,7 +381,7 @@ inlineArrayExpression: LBrack (expression ( Comma expression)* ) RBrack; /** * Besides regular non-keyword Identifiers, the 'from' keyword can also occur as identifier outside of import statements. */ -identifier: Identifier | From | Error; +identifier: Identifier | From | Error | Revert; literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral; booleanLiteral: True | False; @@ -422,6 +422,7 @@ statement: | tryStatement | returnStatement | emitStatement + | revertStatement | assemblyStatement ; @@ -459,6 +460,10 @@ returnStatement: Return expression? Semicolon; * An emit statement. The contained expression needs to refer to an event. */ emitStatement: Emit expression callArgumentList Semicolon; +/** + * A revert statement. The contained expression needs to refer to an error. + */ +revertStatement: Revert expression callArgumentList Semicolon; /** * An inline assembly block. * The contents of an inline assembly block use a separate scanner/lexer, i.e. the set of keywords and diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4 index 560d78e6abb8..6b5209c3e05f 100644 --- a/docs/grammar/SolidityLexer.g4 +++ b/docs/grammar/SolidityLexer.g4 @@ -30,6 +30,7 @@ Else: 'else'; Emit: 'emit'; Enum: 'enum'; Error: 'error'; // not a real keyword +Revert: 'revert'; // not a real keyword Event: 'event'; External: 'external'; Fallback: 'fallback';