Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit af378c2

Browse files
michaelforneyelizabethengelman
authored andcommitted
core/asm: allow numbers in labels (ethereum#20362)
Numbers were already allowed when creating labels, just not when referencing them.
1 parent 5c70ccb commit af378c2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

core/asm/lex_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ func TestLexer(t *testing.T) {
6060
input: "0123abc",
6161
tokens: []token{{typ: lineStart}, {typ: number, text: "0123"}, {typ: element, text: "abc"}, {typ: eof}},
6262
},
63+
{
64+
input: "@foo",
65+
tokens: []token{{typ: lineStart}, {typ: label, text: "foo"}, {typ: eof}},
66+
},
67+
{
68+
input: "@label123",
69+
tokens: []token{{typ: lineStart}, {typ: label, text: "label123"}, {typ: eof}},
70+
},
6371
}
6472

6573
for _, test := range tests {

core/asm/lexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func lexComment(l *lexer) stateFn {
234234
// the lex text state function to advance the parsing
235235
// process.
236236
func lexLabel(l *lexer) stateFn {
237-
l.acceptRun(Alpha + "_")
237+
l.acceptRun(Alpha + "_" + Numbers)
238238

239239
l.emit(label)
240240

0 commit comments

Comments
 (0)