core/asm: fix the bug of "00" prefix number (#22883)
This commit is contained in:
parent
bb9f9ccf4f
commit
b7a91663ab
|
@ -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 {
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue