Closed
Description
The current grammar defines state variable declarations as:
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' | 'constant' )? Identifier ('=' Expression)? ';'
Yet the solidity compiler (Version 0.4.23) accepts any of the following:
contract test {
uint constant public MAX_OWNER_COUNT = 50;
string public constant symbol = "Example";
string public constant name = "Example String";
uint8 public constant decimals = 8;
}
The grammar explicitly states that there should be zero or one modifiers, thus more than one should not be accepted. Should the grammar then not reflect this and be:
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' | 'constant' )* Identifier ('=' Expression)? ';'
OR
StateVariableDeclaration = TypeName ( 'public | 'internal' | 'private' )? ( 'constant' )? Identifier ('=' Expression)? ';'
This was discovered while using the grammar to create my own parser.
Metadata
Metadata
Assignees
Labels
No labels