Fix antlr grammar.

This commit is contained in:
Daniel Kirchner 2023-05-10 11:59:20 +02:00
parent 328f9c8f99
commit 606fbd8fcc
2 changed files with 4 additions and 17 deletions

View File

@ -20,9 +20,6 @@ Compiler Features:
Bugfixes:
* ABI: Include events in the ABI that are emitted by a contract but defined outside of it.
* Antlr Grammar: Fix discrepancy with the parser, which allowed octal numbers.
* Antlr Grammar: Fix of a discrepancy with the parser, which allowed numbers followed by an identifier with no whitespace.
* Antlr Grammar: Stricter rules for function definitions. The grammar will no longer accept as valid free functions having specifiers which are exclusive to contract functions.
* Immutables: Disallow initialization of immutables in try/catch statements.
* SMTChecker: Fix false positives in ternary operators that contain verification targets in its branches, directly or indirectly.

View File

@ -16,7 +16,7 @@ sourceUnit: (
| contractDefinition
| interfaceDefinition
| libraryDefinition
| freeFunctionDefinition
| functionDefinition
| constantVariableDeclaration
| structDefinition
| enumDefinition
@ -85,7 +85,7 @@ inheritanceSpecifier: name=identifierPath arguments=callArgumentList?;
*/
contractBodyElement:
constructorDefinition
| contractFunctionDefinition
| functionDefinition
| modifierDefinition
| fallbackFunctionDefinition
| receiveFunctionDefinition
@ -152,11 +152,11 @@ stateMutability: Pure | View | Payable;
*/
overrideSpecifier: Override (LParen overrides+=identifierPath (Comma overrides+=identifierPath)* RParen)?;
/**
* The definition of contract, library and interface functions.
* The definition of contract, library, interface or free functions.
* Depending on the context in which the function is defined, further restrictions may apply,
* e.g. functions in interfaces have to be unimplemented, i.e. may not contain a body block.
*/
contractFunctionDefinition
functionDefinition
locals[
boolean visibilitySet = false,
boolean mutabilitySet = false,
@ -176,16 +176,6 @@ locals[
(Returns LParen returnParameters=parameterList RParen)?
(Semicolon | body=block);
/**
* The definition of a free function.
*/
freeFunctionDefinition:
Function (identifier | Fallback | Receive)
LParen (arguments=parameterList)? RParen
stateMutability?
(Returns LParen returnParameters=parameterList RParen)?
(Semicolon | body=block);
/**
* The definition of a modifier.
* Note that within the body block of a modifier, the underscore cannot be used as identifier,