Don't understand the expected solution on stage #ER2

I’m stuck on Stage #ER2.

I don’t understand why the expected solution for the test-2 in #ER2 have a single EOF while we have two lines :

[tester::#ER2] [test-2] Running test case: 2
[tester::#ER2] [test-2] Writing contents to ./test.lox:
[tester::#ER2] [test-2] [test.lox]  <|TAB|>
[tester::#ER2] [test-2] [test.lox] <|SPACE|>
[tester::#ER2] [test-2] $ ./your_program.sh tokenize test.lox
[your_program] Logs from your program will appear here!
[your_program] EOF  null
[your_program] EOF  null
[tester::#ER2] [test-2] ✓ EOF  null
[tester::#ER2] [test-2] ! EOF  null
[tester::#ER2] [test-2] Expected last stdout line to be "EOF  null", but found extra line: "EOF  null"
[tester::#ER2] [test-2] Test failed
1 Like

EOF stands for “end of file” - it’s only expected that one EOF token is emitted for every file parsed.

1 Like

Hello :innocent:

As per my knowledge, This could be due to an extra newline or an additional EOF being printed.

Make sure your program only outputs “EOF null” once. Check your code for any loops or conditions that might cause the EOF message to print multiple times. If you’re using a loop to read the file, ensure it terminates correctly after the first EOF.

I hope this will help you. :heart_eyes:

Respected community member :smiling_face_with_three_hearts:

1 Like

Thank you, I don’t know why I thought that EOF was for end of line lol.

1 Like

Yes indeed, I print EOF at each end of line but it’s just end of line.

Thanks for your help =)

1 Like

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