fix bare optional/star/plus quantifiers on rule references - #2765
Draft
datduyng wants to merge 4 commits into
Draft
fix bare optional/star/plus quantifiers on rule references#2765datduyng wants to merge 4 commits into
datduyng wants to merge 4 commits into
Conversation
- Parse <Name>?, <Name>*, <Name>+ as optional/repeat rule refs instead of treating "?" as a literal string part - Propagate optional/repeat through the grammar compiler (including phrase-set wrappers) - Emit bare quantifiers from the rule writer; update category docs - Add regression tests covering parse, round-trip, and match Metric (7-case bare-quantifier suite): baseline 3/7 (42.9%) → treatment 7/7 (100%), +57.1 pp match accuracy
datduyng
marked this pull request as draft
July 30, 2026 23:43
Contributor
Author
- Keep grouped (), required refs, and (the)? string groups unchanged - Reject wrong tails when optional polite is skipped or taken
datduyng
marked this pull request as ready for review
July 31, 2026 00:04
datduyng
marked this pull request as draft
July 31, 2026 00:52
Contributor
Author
|
Will work offline and review the design with @curtisman offline first - putting this in draft for now |
Contributor
Author
|
Parked for design debate. Immediate unblock (grammar-only, no language change): #2775
Leaving this PR draft until Curtis picks A vs B. |
bmerkle
pushed a commit
to bmerkle/TypeAgent
that referenced
this pull request
Aug 1, 2026
- Rewrite all bare `<Name>?` sites in shipping/test `.agr` files to the supported `(<Name>)?` form so optional rule refs actually match. - Add a code-heavy one-pager RFC for Curtis on quantifier design: **A** keep group-gated `?` (this PR) vs **B** reserved postfix `?/*/+` (direction in microsoft#2765). On main, `?` after a rule ref is a **literal** token. Quantifiers only apply after `)`. Authors wrote `<Polite>?` meaning optional; those patterns never matched. --------- Co-authored-by: typeagent-bot <typeagent-bot[bot]@users.noreply.github.com>
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.


Additive only: bare ?/*/+ now parse like grouped form; required refs, grouped (), and existing patterns unchanged.
We currently have many cases of "?" usage which represent optionality but are treated as literals.
TypeAgent/ts/packages/agents/video/src/videoSchema.agr
Line 27 in 2596224
https://github.com/search?q=repo%3Amicrosoft%2FTypeAgent+%22%3E%3F%22+path%3A**%2F*.agr&type=code
On main right now, we have below behavior. The PR fix this so that "?" is not treated as a literal