Skip to content

Commit b7a9166

Browse files
authored
core/asm: fix the bug of "00" prefix number (ethereum#22883)
1 parent bb9f9cc commit b7a9166

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/asm/lex_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ func TestLexer(t *testing.T) {
6060
input: "0123abc",
6161
tokens: []token{{typ: lineStart}, {typ: number, text: "0123"}, {typ: element, text: "abc"}, {typ: eof}},
6262
},
63+
{
64+
input: "00123abc",
65+
tokens: []token{{typ: lineStart}, {typ: number, text: "00123"}, {typ: element, text: "abc"}, {typ: eof}},
66+
},
6367
{
6468
input: "@foo",
6569
tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}},

core/asm/lexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func lexInsideString(l *lexer) stateFn {
254254

255255
func lexNumber(l *lexer) stateFn {
256256
acceptance := Numbers
257-
if l.accept("0") || l.accept("xX") {
257+
if l.accept("xX") {
258258
acceptance = HexadecimalNumbers
259259
}
260260
l.acceptRun(acceptance)

0 commit comments

Comments
 (0)