feat: add Azure Policy core JSON parser and expression parser#655
feat: add Azure Policy core JSON parser and expression parser#655anakrish merged 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces the initial Azure Policy parsing foundation by adding span-annotated AST types plus low-level JSON and ARM-template-expression parsing components under src/languages/azure_policy/.
Changes:
- Added Azure Policy AST types (
Constraint,Condition,ValueOrExpr, expression/count nodes, etc.) withSpanpropagation. - Added a core token-driven JSON parser (
Parser) and associated parse error types. - Added an ARM template expression sub-parser (
ExprParser) and wired new modules intoazure_policy::mod.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/languages/azure_policy/mod.rs | Exposes new ast, expr, and parser modules from the Azure Policy language entrypoint. |
| src/languages/azure_policy/ast/mod.rs | Adds span-annotated AST types for policy definitions/rules/constraints/operators/fields. |
| src/languages/azure_policy/ast/value.rs | Adds JSON value, expression AST, and count-related node types. |
| src/languages/azure_policy/expr.rs | Implements an ARM template expression parser on top of the shared lexer. |
| src/languages/azure_policy/parser/mod.rs | Adds parser module entrypoint plus helper classification functions (fields/operators/template-expr checks). |
| src/languages/azure_policy/parser/core.rs | Implements the core JSON parser (Parser) and JSON→ValueOrExpr conversion helpers. |
| src/languages/azure_policy/parser/error.rs | Defines ParseError and its Display formatting for span-aware parsing errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2109999 to
06102d2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d85e23d to
270d4a6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
270d4a6 to
2e4a86d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
807361e to
1cfd143
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1cfd143 to
a1ca621
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add the foundational parsing infrastructure for Azure Policy JSON: - ExprParser: ARM template expression parser for "[...]" strings, supporting function calls, dot access, index access, and literals - Parser (core): recursive-descent JSON tokenizer-to-AST parser that reads directly from Lexer tokens with no intermediate serde_json step - ParseError: structured error types with span context for diagnostics - Helper functions: field classification, operator kind parsing, and ARM template expression detection These components are consumed by the policy-aware parsing modules (constraint, policy_rule, policy_definition) in a subsequent PR.
a1ca621 to
cc47e68
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add the foundational parsing infrastructure for Azure Policy JSON:
supporting function calls, dot access, index access, and literals
reads directly from Lexer tokens with no intermediate serde_json step
ARM template expression detection
These components are consumed by the policy-aware parsing modules
(constraint, policy_rule, policy_definition) in a subsequent PR.