Closed dasunpubudumal closed 2 months ago
Note
Rust adds a [raw]
type into the vector of tokens. So, if the actual program has got 27 tokens, with the raw type it would be 27 + 1 = 28 tokens.
However, not in src/lib.rs:46
, when we access the vector through last()
function, it returns the correct token - not the [raw]
type.
This is probably because we've converted the iterator that is returned to a vector, and a vector requires an allocation.
Write a test that asserts correct functionality of the lexer for
tests/fixtures/program_1.lox
file.This test asserts for an integrated behavior of the lexer as a whole. Therefore, it should be included in
tests
directory.There are likely to be test failures. Report the issues within this ticket as comments.