Draft
Conversation
- Modified grammar to support parsing expressions as well as ClassAds - Added ParseExpr function to parse expressions - Updated Parse function documentation to clarify it accepts both ClassAds and expressions - Updated ParseClassAd to return an error when input is not a ClassAd - Added comprehensive tests for ParseExpr - All existing tests pass Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
- Updated ParseClassAd and ParseExpr to include actual node type in error messages - Makes debugging easier by showing what was actually parsed Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add ParseExpr to parser package and update documentation
Add ParseExpr function to parser package
Dec 30, 2025
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
The parser package lacked a direct way to parse standalone expressions—only ClassAds could be parsed via
ParseClassAd.Changes
startrule to acceptexprin addition toclassad, allowing bare expressions like2 + 3to parse successfullyParseExpr(input string) (ast.Expr, error)for expression-only parsingParseto clarify it accepts both ClassAds and expressions; updatedParseClassAdto note it rejects non-ClassAd inputParseClassAdto return descriptive errors (e.g.,"parsed input is not a ClassAd, got *ast.BinaryOp") instead of(nil, nil)Usage
Note: Grammar now has 2 reduce/reduce conflicts due to ambiguity between
classadandexprfor record literals like[a = 1]. The parser resolves this correctly by preferring the first production (classad).Original prompt
parserpackage #8✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.