mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add errors to grammar.
This commit is contained in:
parent
780fa1e658
commit
f787a3e7ba
@ -19,6 +19,7 @@ sourceUnit: (
|
|||||||
| constantVariableDeclaration
|
| constantVariableDeclaration
|
||||||
| structDefinition
|
| structDefinition
|
||||||
| enumDefinition
|
| enumDefinition
|
||||||
|
| errorDefinition
|
||||||
)* EOF;
|
)* EOF;
|
||||||
|
|
||||||
//@doc: inline
|
//@doc: inline
|
||||||
@ -90,6 +91,7 @@ contractBodyElement:
|
|||||||
| enumDefinition
|
| enumDefinition
|
||||||
| stateVariableDeclaration
|
| stateVariableDeclaration
|
||||||
| eventDefinition
|
| eventDefinition
|
||||||
|
| errorDefinition
|
||||||
| usingDirective;
|
| usingDirective;
|
||||||
//@doc:inline
|
//@doc:inline
|
||||||
namedArgument: name=identifier Colon value=expression;
|
namedArgument: name=identifier Colon value=expression;
|
||||||
@ -289,6 +291,18 @@ eventDefinition:
|
|||||||
Anonymous?
|
Anonymous?
|
||||||
Semicolon;
|
Semicolon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter of an error.
|
||||||
|
*/
|
||||||
|
errorParameter: type=typeName name=identifier?;
|
||||||
|
/**
|
||||||
|
* Definition of an error.
|
||||||
|
*/
|
||||||
|
errorDefinition:
|
||||||
|
Error name=identifier
|
||||||
|
LParen (parameters+=errorParameter (Comma parameters+=errorParameter)*)? RParen
|
||||||
|
Semicolon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Using directive to bind library functions to types.
|
* Using directive to bind library functions to types.
|
||||||
* Can occur within contracts and libraries.
|
* Can occur within contracts and libraries.
|
||||||
@ -367,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.
|
* Besides regular non-keyword Identifiers, the 'from' keyword can also occur as identifier outside of import statements.
|
||||||
*/
|
*/
|
||||||
identifier: Identifier | From;
|
identifier: Identifier | From | Error;
|
||||||
|
|
||||||
literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral;
|
literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral;
|
||||||
booleanLiteral: True | False;
|
booleanLiteral: True | False;
|
||||||
|
@ -29,12 +29,13 @@ Do: 'do';
|
|||||||
Else: 'else';
|
Else: 'else';
|
||||||
Emit: 'emit';
|
Emit: 'emit';
|
||||||
Enum: 'enum';
|
Enum: 'enum';
|
||||||
|
Error: 'error'; // not a real keyword
|
||||||
Event: 'event';
|
Event: 'event';
|
||||||
External: 'external';
|
External: 'external';
|
||||||
Fallback: 'fallback';
|
Fallback: 'fallback';
|
||||||
False: 'false';
|
False: 'false';
|
||||||
Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
|
Fixed: 'fixed' | ('fixed' [1-9][0-9]* 'x' [1-9][0-9]*);
|
||||||
From: 'from';
|
From: 'from'; // not a real keyword
|
||||||
/**
|
/**
|
||||||
* Bytes types of fixed length.
|
* Bytes types of fixed length.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user