Skip to content

Commit

Permalink
core/asm: fix the bug of "00" prefix number (ethereum#22883)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evolution404 committed May 18, 2021
1 parent bb9f9cc commit b7a9166
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/asm/lex_test.go
Expand Up @@ -60,6 +60,10 @@ func TestLexer(t *testing.T) {
input: "0123abc",
tokens: []token{{typ: lineStart}, {typ: number, text: "0123"}, {typ: element, text: "abc"}, {typ: eof}},
},
{
input: "00123abc",
tokens: []token{{typ: lineStart}, {typ: number, text: "00123"}, {typ: element, text: "abc"}, {typ: eof}},
},
{
input: "@foo",
tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}},
Expand Down
2 changes: 1 addition & 1 deletion core/asm/lexer.go
Expand Up @@ -254,7 +254,7 @@ func lexInsideString(l *lexer) stateFn {

func lexNumber(l *lexer) stateFn {
acceptance := Numbers
if l.accept("0") || l.accept("xX") {
if l.accept("xX") {
acceptance = HexadecimalNumbers
}
l.acceptRun(acceptance)
Expand Down

0 comments on commit b7a9166

Please sign in to comment.