Merge pull request #7374 from ethereum/hexStringUnderscores

Allow  underscores in hex strings.
This commit is contained in:
chriseth
2019-09-09 11:48:46 +02:00
committed by GitHub
9 changed files with 56 additions and 5 deletions
@@ -0,0 +1,7 @@
contract C {
function f() public pure returns(bytes memory) {
return hex"12_34_5678_9A";
}
}
// ----
// f() -> 32, 5, left(0x123456789A)
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
hex"12__34";
}
}
// ----
// ParserError: (52-60): Invalid use of number separator '_'.
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
hex"_1234";
}
}
// ----
// ParserError: (52-57): Invalid use of number separator '_'.
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
hex"1_234";
}
}
// ----
// ParserError: (52-56): Expected even number of hex-nibbles.
@@ -0,0 +1,7 @@
contract C {
function f() public pure {
hex"1234_";
}
}
// ----
// ParserError: (52-61): Invalid use of number separator '_'.
@@ -0,0 +1,3 @@
contract C {
bytes constant c = hex"12_3456_789012";
}