Skip to content

Add lrlex %expect-missing-tokens directive.#651

Open
ratmice wants to merge 2 commits into
softdevteam:masterfrom
ratmice:expect-missing-tokens
Open

Add lrlex %expect-missing-tokens directive.#651
ratmice wants to merge 2 commits into
softdevteam:masterfrom
ratmice:expect-missing-tokens

Conversation

@ratmice

@ratmice ratmice commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

This adds a lrlex directive %expect-missing-tokens for the docs PR #649

The syntax is like: %expect-missing-tokens "TOK" including quotes.

This is so that it behaves exactly like %expect-unused which accepts quoted tokens, but unquoted rules. Unlike %expect-unused, the new directive doesn't take unquoted rules as those are a parser thing.

I tested that the new test fails if we remove the new directive.

@ltratt

ltratt commented Jul 23, 2026

Copy link
Copy Markdown
Member

Quick thought: would it be ambiguous if we shortened this to %expect-missing to match %expect-unused?

@ratmice

ratmice commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

I don't think it would be ambiguous, at worst we might add %expect-missing to lrpar someday, and grep might match both. But that said I'm not sure what justification there is for having the parser not handle a token the lexer is capable of producing. But that grepability is kind of spurred me to throw tokens on the end. I'm happy to remove it though.

@ratmice

ratmice commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

I went ahead and used the shorter name in 80a6b98

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.

2 participants