core/asm: fix the bug of "00" prefix number (#22883)

pull/22894/head
Evolution404 4 years ago committed by GitHub
parent bb9f9ccf4f
commit b7a91663ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      core/asm/lex_test.go
  2. 2
      core/asm/lexer.go

@ -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}},

@ -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)

Loading…
Cancel
Save