Skip to content

fix parser EOF after calls with trailing whitespace - #6

Open
alogic0 wants to merge 1 commit into
kristoff-it:mainfrom
alogic0:fix/parser-trailing-whitespace
Open

fix parser EOF after calls with trailing whitespace#6
alogic0 wants to merge 1 commit into
kristoff-it:mainfrom
alogic0:fix/parser-trailing-whitespace

Conversation

@alogic0

@alogic0 alogic0 commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Fix a parser panic when a completed call is followed by trailing whitespace.

After returning the final apply node, a subsequent Parser.next call could consume trailing whitespace and reach EOF while in the after_call state. The parser then attempted to
calculate the length of an uninitialized path location, causing an integer overflow in Debug builds.

Fix

Return null when EOF is reached in the terminal after_call state with no outstanding call depth.

Tests

Added regression coverage for:

  • trailing spaces;
  • trailing newline;
  • CRLF, tabs, and spaces;
  • nested calls followed by a newline.

The test suite passes in Debug and ReleaseSafe modes.

Return cleanly when tokenization reaches EOF from the terminal after-call
state, and cover common trailing whitespace plus nested calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant