Add ES6-style shorthand property syntax for grammar object literals#1942
Merged
curtisman merged 1 commit intomicrosoft:mainfrom Feb 22, 2026
Merged
Add ES6-style shorthand property syntax for grammar object literals#1942curtisman merged 1 commit intomicrosoft:mainfrom
curtisman merged 1 commit intomicrosoft:mainfrom
Conversation
Implements JavaScript-like shorthand property syntax in .agr grammar files,
allowing `{ name }` instead of `{ name: name }` when property name matches
variable name.
Changes:
- Parser: Recognize shorthand syntax (stores as null in AST)
- Compiler: Validate shorthand variable references
- Matcher: Resolve shorthand properties during matching
- Writer: Output shorthand form in serialized grammars
- Environment: Process shorthand in value expressions
- Updated all .agr files and tests to use shorthand syntax
This improves grammar readability and reduces verbosity, especially in
parameter blocks with many variables.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
steveluc
added a commit
that referenced
this pull request
Feb 22, 2026
- Revert "what's" (double-quoted in pattern expressions) back to unquoted what's — double quotes are literal token chars in expression parsing (not string delimiters), so "what's" created the wrong token. The tmLanguage (?<!\w)' lookbehind handles syntax highlighting correctly for unquoted apostrophes. - Resolve conflict: remove calendarModule.agr (keep deletion over main's modification of the unreferenced example file) - Resolve conflict: keep our removal of the/my $(wildcard) list patterns from listSchema.agr (spurious completion fix) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
This PR implements JavaScript-style shorthand property syntax for object literals in
.agrgrammar files. When a property name matches a variable name, you can now write{ name }instead of the more verbose{ name: name }.Example transformation:
Changes
nullin the AST to distinguish from explicit valuesparseObjectPropertieshelper to process shorthand properties in value expressions.agrschema files across agents (browser, calendar, desktop, list, player) to use shorthand syntaxBenefits
{ name: name }) still works; this is purely additiveTest Plan
🤖 Generated with Claude Code