Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling for the initial token being TOK_UNKNOWN in lx syntax #457

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

katef
Copy link
Owner

@katef katef commented Jan 4, 2024

My intended idea was to have all syntax errors go through the same actions driven by parser.sid. But in this case SID's generated parser bails out immediately on TOK_UNKNOWN, and we never reach an ## alt. So we never reach <make-ast>, and thus never <err-syntax> about it.

That's what the assertion was about; the generated parser should never return with a NULL AST.

My workaround for this is just to recreate the equivalent syntax error at the top-level, which isn't very satisfying at all. But it does what we need here.

Spotted by @cinco-de-mayonnaise, thank you.

This resolves #451.

My intended idea was to have all syntax errors go through the same actions driven by parser.sid. But in this case SID's generated parser bails out immediately on TOK_UNKNOWN, and we never reach an ## alt. So we never reach <make-ast>, and thus never <err-syntax> about it.

That's what the assertion was about; the generated parser should never return with a NULL AST.

My workaround for this is just to recreate the equivalent syntax error at the top-level, which isn't very satisfying at all. But it does what we need here.

Spotted by @cinco-de-mayonnaise, thank you.
@katef katef added the bug label Jan 4, 2024
@katef katef merged commit 1897277 into main Jan 4, 2024
322 checks passed
@katef katef deleted the kate/451-lx-malformed-input branch January 4, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lx: Bus error/Segmentation Fault on malformed input
1 participant