mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Introduce hex literals (#832)
* Introduce hex keyword token * Support hex literals * Include tests for hex literals * Document hex literals
This commit is contained in:
committed by
chriseth
parent
970260bf0f
commit
ec3298535e
@@ -218,6 +218,15 @@ String literals are written with either double or single-quotes (``"foo"`` or ``
|
||||
|
||||
String literals support escape characters, such as ``\n``, ``\xNN`` and ``\uNNNN``. ``\xNN`` takes a hex value and inserts the appropriate byte, while ``\uNNNN`` takes a Unicode codepoint and inserts an UTF-8 sequence.
|
||||
|
||||
.. index:: literal, bytes
|
||||
|
||||
Hexadecimal Literals
|
||||
--------------------
|
||||
|
||||
Hexademical Literals are prefixed with the keyword ``hex`` and are enclosed in double or single-quotes (``hex"001122FF"``). Their content must be a hexadecimal string and their value will be the binary representation of those values.
|
||||
|
||||
Hexademical Literals behave like String Literals and have the same convertibility restrictions.
|
||||
|
||||
.. index:: enum
|
||||
|
||||
.. _enums:
|
||||
|
||||
Reference in New Issue
Block a user