mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
User-defined literal suffixes: Grammar
This commit is contained in:
committed by
Kamil Śliwak
parent
00509830d5
commit
f97e3884cb
@@ -85,6 +85,7 @@ SignedIntegerType:
|
||||
Storage: 'storage';
|
||||
String: 'string';
|
||||
Struct: 'struct';
|
||||
Suffix: 'suffix';
|
||||
True: 'true';
|
||||
Try: 'try';
|
||||
Type: 'type';
|
||||
|
||||
@@ -182,7 +182,8 @@ locals[
|
||||
freeFunctionDefinition:
|
||||
Function (identifier | Fallback | Receive)
|
||||
LParen (arguments=parameterList)? RParen
|
||||
stateMutability?
|
||||
stateMutability? Suffix?
|
||||
| Suffix? stateMutability?
|
||||
(Returns LParen returnParameters=parameterList RParen)?
|
||||
(Semicolon | body=block);
|
||||
|
||||
@@ -406,6 +407,7 @@ expression:
|
||||
identifier
|
||||
| literal
|
||||
| literalWithSubDenomination
|
||||
| suffixedLiteral
|
||||
| elementaryTypeName[false]
|
||||
) # PrimaryExpression
|
||||
;
|
||||
@@ -421,12 +423,14 @@ inlineArrayExpression: LBrack (expression ( Comma expression)* ) RBrack;
|
||||
/**
|
||||
* Besides regular non-keyword Identifiers, some keywords like 'from' and 'error' can also be used as identifiers.
|
||||
*/
|
||||
identifier: Identifier | From | Error | Revert | Global;
|
||||
identifier: Identifier | From | Error | Revert | Global | Suffix;
|
||||
|
||||
literal: stringLiteral | numberLiteral | booleanLiteral | hexStringLiteral | unicodeStringLiteral;
|
||||
|
||||
literalWithSubDenomination: numberLiteral SubDenomination;
|
||||
|
||||
suffixedLiteral: literal identifier (Period identifier)*;
|
||||
|
||||
booleanLiteral: True | False;
|
||||
/**
|
||||
* A full string literal consists of either one or several consecutive quoted strings.
|
||||
|
||||
Reference in New Issue
Block a user