fix(parser): quote-aware choice-list splitter so nested-token abilities aren't a modal choice (#4230)#4635
Merged
Merged
Conversation
…es aren't a modal choice (phase-rs#4230) Reef Worm creates a single cascading Fish token whose quoted death-triggered ability itself creates a Whale (which creates a Kraken). `split_choice_list_items` split on the `, ` inside that quoted ability text, so `try_parse_create_token_choice` misread one cascading token as a `ChooseOneOf` of three distinct tokens (Fish/Whale/Kraken). The choice-list item combinator now consumes a double-quoted span as one opaque unit, so a `,`/`or` inside quoted granted-ability text never fabricates extra branches. Genuine unquoted token/counter disjunctions are unchanged, and bare apostrophes (possessives) are untouched. CR 608.2d (choose-one token instructions) + CR 113.3 (granted abilities). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
matthewevans
approved these changes
Jun 30, 2026
matthewevans
left a comment
Member
There was a problem hiding this comment.
Reviewed the parser change at the updated head. The fix is at the shared choice-list splitter, preserves top-level token/counter disjunction behavior, and covers the Reef Worm nested quoted-token regression with a discriminating parser test.
Parse changes introduced by this PR · 3 card(s), 4 signature(s) (baseline: main
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reef Worm (#4230) creates a single cascading token:
The HEAD parser misread this as a modal token choice —
Effect::ChooseOneOfover three distinct tokens (Fish / Whale / Kraken) — instead of one Fish token carrying a quoted death-triggered ability. At runtime that offers the player a choice of which single token to make, so the cascade never happens.Root cause
try_parse_create_token_choiceusessplit_choice_list_itemsto splitcreate A, B, or C tokenintoChooseOneOfbranches. The splitter's item combinator was not quote-aware:parse_choice_list_separatormatched the,inside the quoted granted ability ("When this token dies, create …"), severing one cascading token into three bogus branches (and double-emittingcreate).Fix
The choice-list item combinator now consumes a double-quoted span as one opaque unit, so a
,/orinside quoted granted-ability text can never fabricate extra branches. With Reef Worm there is no separator outside the quotes, so the splitter yields a single item,try_parse_create_token_choicedeclines (needs ≥2), and the normal single-token-with-quoted-ability grammar parses the cascade correctly.create a Food token or a Treasure token; counter-choice lists) are unchanged — they contain no double quotes.owner's) are untouched — only double-quoted spans are special-cased, and the nested single quotes here are always inside a double-quoted span.CR 608.2d (choose-one token instructions) + CR 113.3 (granted abilities).
Tests
split_choice_list_items_is_quote_aware— building-block test: a quoted ability with an inner comma stays one item; genuine disjunctions still split; a mixed list (one quoted branch) splits at the real separator.reef_worm_nested_token_is_not_modal_choice— Reef Worm parses to a singleEffect::Token { name: "Fish", .. }, notChooseOneOf.Full engine lib suite green (14227 passed, 0 failed);
clippy -D warningsclean.Closes #4230
🤖 Generated with Claude Code