Unverified Commit b7a91663 authored by Evolution404's avatar Evolution404 Committed by GitHub

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

parent bb9f9ccf
...@@ -60,6 +60,10 @@ func TestLexer(t *testing.T) { ...@@ -60,6 +60,10 @@ func TestLexer(t *testing.T) {
input: "0123abc", input: "0123abc",
tokens: []token{{typ: lineStart}, {typ: number, text: "0123"}, {typ: element, text: "abc"}, {typ: eof}}, 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", input: "@foo",
tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}}, tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}},
......
...@@ -254,7 +254,7 @@ func lexInsideString(l *lexer) stateFn { ...@@ -254,7 +254,7 @@ func lexInsideString(l *lexer) stateFn {
func lexNumber(l *lexer) stateFn { func lexNumber(l *lexer) stateFn {
acceptance := Numbers acceptance := Numbers
if l.accept("0") || l.accept("xX") { if l.accept("xX") {
acceptance = HexadecimalNumbers acceptance = HexadecimalNumbers
} }
l.acceptRun(acceptance) l.acceptRun(acceptance)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment