Closed johnvtan closed 3 months ago
Good catch - I agree that having a test with a variable name like return_5
in Chapter 5 makes sense.
Were you lexing identifiers like return_a
into two tokens, a keyword plus an identifier?
Just merged a PR with an additional test that should cover this, but feel free to reopen if this new test wouldn't have caught your bug or there are other related edge cases you think should be covered!
I found a bug in my lexer where I wasn't properly lexing idents that started with a keyword, e.g.
return_a
orint_b
. I didn't catch this until running the Chapter 7 parsing tests with--goto
enabled because those tests use labels likereturn_a
.I think it would make sense for this test to go in Chapter 5, where variables are introduced. Having a test with a variable named
return_5
orvoid_a
probably would have caught this bug too.