Fix grammar for identifier / identifier path.

This commit is contained in:
chriseth 2020-11-16 17:11:39 +01:00
parent e64fd99fb5
commit 79afd04818

View File

@ -72,7 +72,7 @@ inheritanceSpecifierList:
* Inheritance specifier for contracts and interfaces. * Inheritance specifier for contracts and interfaces.
* Can optionally supply base constructor arguments. * Can optionally supply base constructor arguments.
*/ */
inheritanceSpecifier: name=userDefinedTypeName arguments=callArgumentList?; inheritanceSpecifier: name=identifierPath arguments=callArgumentList?;
/** /**
* Declarations that can be used in contracts, interfaces and libraries. * Declarations that can be used in contracts, interfaces and libraries.
@ -98,15 +98,15 @@ namedArgument: name=identifier Colon value=expression;
*/ */
callArgumentList: LParen ((expression (Comma expression)*)? | LBrace (namedArgument (Comma namedArgument)*)? RBrace) RParen; callArgumentList: LParen ((expression (Comma expression)*)? | LBrace (namedArgument (Comma namedArgument)*)? RBrace) RParen;
/** /**
* Qualified name of a user defined type. * Qualified name.
*/ */
userDefinedTypeName: identifier (Period identifier)*; identifierPath: identifier (Period identifier)*;
/** /**
* Call to a modifier. If the modifier takes no arguments, the argument list can be skipped entirely * Call to a modifier. If the modifier takes no arguments, the argument list can be skipped entirely
* (including opening and closing parentheses). * (including opening and closing parentheses).
*/ */
modifierInvocation: identifier callArgumentList?; modifierInvocation: identifierPath callArgumentList?;
/** /**
* Visibility for functions and function types. * Visibility for functions and function types.
*/ */
@ -144,7 +144,7 @@ stateMutability: Pure | View | Payable;
* In cases where there are ambiguous declarations in several base contracts being overridden, * In cases where there are ambiguous declarations in several base contracts being overridden,
* a complete list of base contracts has to be given. * a complete list of base contracts has to be given.
*/ */
overrideSpecifier: Override (LParen overrides+=userDefinedTypeName (Comma overrides+=userDefinedTypeName)* RParen)?; overrideSpecifier: Override (LParen overrides+=identifierPath (Comma overrides+=identifierPath)* RParen)?;
/** /**
* The definition of contract, library and interface functions. * The definition of contract, library and interface functions.
* Depending on the context in which the function is defined, further restrictions may apply, * Depending on the context in which the function is defined, further restrictions may apply,
@ -269,12 +269,12 @@ eventDefinition:
* 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.
*/ */
usingDirective: Using userDefinedTypeName For (Mul | typeName) Semicolon; usingDirective: Using identifierPath For (Mul | typeName) Semicolon;
/** /**
* A type name can be an elementary type, a function type, a mapping type, a user-defined type * A type name can be an elementary type, a function type, a mapping type, a user-defined type
* (e.g. a contract or struct) or an array type. * (e.g. a contract or struct) or an array type.
*/ */
typeName: elementaryTypeName[true] | functionTypeName | mappingType | userDefinedTypeName | typeName LBrack expression? RBrack; typeName: elementaryTypeName[true] | functionTypeName | mappingType | identifierPath | typeName LBrack expression? RBrack;
elementaryTypeName[boolean allowAddressPayable]: Address | {$allowAddressPayable}? Address Payable | Bool | String | Bytes | SignedIntegerType | UnsignedIntegerType | FixedBytes | Fixed | Ufixed; elementaryTypeName[boolean allowAddressPayable]: Address | {$allowAddressPayable}? Address Payable | Bool | String | Bytes | SignedIntegerType | UnsignedIntegerType | FixedBytes | Fixed | Ufixed;
functionTypeName functionTypeName
locals [boolean visibilitySet = false, boolean mutabilitySet = false] locals [boolean visibilitySet = false, boolean mutabilitySet = false]
@ -329,7 +329,6 @@ expression:
identifier identifier
| literal | literal
| elementaryTypeName[false] | elementaryTypeName[false]
| userDefinedTypeName
) # PrimaryExpression ) # PrimaryExpression
; ;
@ -452,7 +451,7 @@ mappingType: Mapping LParen key=mappingKeyType DoubleArrow value=typeName RParen
/** /**
* Only elementary types or user defined types are viable as mapping keys. * Only elementary types or user defined types are viable as mapping keys.
*/ */
mappingKeyType: elementaryTypeName[false] | userDefinedTypeName; mappingKeyType: elementaryTypeName[false] | identifierPath;
/** /**
* A Yul statement within an inline assembly block. * A Yul statement within an inline assembly block.