core/asm: allow numbers in labels (#20362)

Numbers were already allowed when creating labels, just not when
referencing them.
This commit is contained in:
Michael Forney
2019-12-30 16:11:02 -05:00
committed by Elizabeth Engelman
parent eaf136e19e
commit fca48e2a9a
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -60,6 +60,14 @@ func TestLexer(t *testing.T) {
input: "0123abc",
tokens: []token{{typ: lineStart}, {typ: number, text: "0123"}, {typ: element, text: "abc"}, {typ: eof}},
},
{
input: "@foo",
tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}},
},
{
input: "@label123",
tokens: []token{{typ: lineStart}, {typ: label, text: "label123"}, {typ: eof}},
},
}
for _, test := range tests {
+1 -1
View File
@@ -234,7 +234,7 @@ func lexComment(l *lexer) stateFn {
// the lex text state function to advance the parsing
// process.
func lexLabel(l *lexer) stateFn {
l.acceptRun(Alpha + "_")
l.acceptRun(Alpha + "_" + Numbers)
l.emit(label)