Stuck at stage #mp7 for interpreter

I’m stuck on Stage #MP7.

Apparently on codetesters test either first line of output is missing or something else is going

Here are my logs:

Running tests. Logs should appear shortly...

[tester::#MP7] Running tests for Stage #MP7 (Scanning: Assignment & equality Operators)
[tester::#MP7] [test-1] Running test case: 1
[tester::#MP7] [test-1] Writing contents to ./test.lox:
[tester::#MP7] [test-1] [test.lox] =
[tester::#MP7] [test-1] $ ./your_program.sh tokenize test.lox
[your_program] EOF  null
[tester::#MP7] [test-1] 𐄂 EOF  null
[tester::#MP7] [test-1] Expected line #1 on stdout to be "EQUAL = null", got "EOF  null"
[tester::#MP7] [test-1] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

But for same content on my test.lox it gives following locally:

$ ./your_program.sh tokenize test.lox
EQUAL = null
EOF  null

test.lox content:

$ cat test.lox
=

And all tokens are printed using println!() including EOF

for token in &self.tokens {
   println!("{}", token.ttype.describe());
}

Just tried your code locally and I see the same result, super weird - we’ll look into this!

I think you might be accidentally appending a newline character in your local test.lox file.

We don’t do that in the tester, hence the disparity in outputs :slight_smile:

Unfortunately, we can’t change this since white space is a separate stage altogether and doing it earlier would violate with what the book dictates.

Thanks, it got my attention that when i have only one character i was peeking which was resulting in skipping.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.