mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11173 from ethereum/allowHexStringLiterals
Allow hex string literals in Yul.
This commit is contained in:
@@ -564,5 +564,5 @@ yulPath: YulIdentifier (YulPeriod YulIdentifier)*;
|
||||
*/
|
||||
yulFunctionCall: (YulIdentifier | YulEVMBuiltin) YulLParen (yulExpression (YulComma yulExpression)*)? YulRParen;
|
||||
yulBoolean: YulTrue | YulFalse;
|
||||
yulLiteral: YulDecimalNumber | YulStringLiteral | YulHexNumber | yulBoolean;
|
||||
yulLiteral: YulDecimalNumber | YulStringLiteral | YulHexNumber | yulBoolean | YulHexStringLiteral;
|
||||
yulExpression: yulPath | yulFunctionCall | yulLiteral;
|
||||
|
||||
@@ -263,6 +263,7 @@ YulLeave: 'leave';
|
||||
YulLet: 'let';
|
||||
YulSwitch: 'switch';
|
||||
YulTrue: 'true';
|
||||
YulHex: 'hex';
|
||||
|
||||
/**
|
||||
* Builtin functions in the EVM Yul dialect.
|
||||
@@ -314,7 +315,7 @@ YulDecimalNumber: '0' | ([1-9] [0-9]*);
|
||||
YulStringLiteral:
|
||||
'"' DoubleQuotedStringCharacter* '"'
|
||||
| '\'' SingleQuotedStringCharacter* '\'';
|
||||
|
||||
YulHexStringLiteral: HexString;
|
||||
|
||||
YulWS: [ \t\r\n\u000C]+ -> skip ;
|
||||
YulCOMMENT: '/*' .*? '*/' -> channel(HIDDEN) ;
|
||||
|
||||
+4
-1
@@ -174,7 +174,10 @@ whitespace, i.e. there is no terminating ``;`` or newline required.
|
||||
Literals
|
||||
--------
|
||||
|
||||
You can use integer constants in decimal or hexadecimal notation.
|
||||
As literals, you can use integer constants in decimal or hexadecimal notation
|
||||
or strings as ASCII (`"abc"`) or HEX strings (`hex"616263"`) of up to
|
||||
32 bytes length.
|
||||
|
||||
When compiling for the EVM, this will be translated into an
|
||||
appropriate ``PUSHi`` instruction. In the following example,
|
||||
``3`` and ``2`` are added resulting in 5 and then the
|
||||
|
||||
Reference in New Issue
Block a user