azure-policy parser: allow overriding the column-width limit#673
azure-policy parser: allow overriding the column-width limit#673anakrish merged 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurable lexer column-width limits to the Azure Policy JSON parser so very long single-line policy documents (e.g., deeply nested ARM template expressions) can be parsed by allowing callers to raise the default 1024-column limit.
Changes:
- Add
Parser::new_with_max_col()to optionally override the lexer'smax_colfor Azure Policy parsing. - Add
parse_policy_rule_with_max_col()/parse_policy_definition_with_max_col()public entry points and route existing APIs through them. - Increase
ExprParser’s internal lexermax_colto 65536 to better handle large template expressions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/languages/azure_policy/parser/mod.rs |
Adds new public *_with_max_col entry points and updates existing parse APIs to delegate. |
src/languages/azure_policy/parser/core.rs |
Introduces Parser::new_with_max_col() and applies the override to the internal lexer configuration. |
src/languages/azure_policy/expr.rs |
Raises the expression lexer max column limit to accommodate very long ARM template expressions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Some Azure Policy JSON documents contain very long lines — ARM template expressions with deeply nested if()/concat() calls can easily exceed the default 1024-column lexer limit. Add Parser::new_with_max_col() and corresponding parse_policy_rule_with_max_col() / parse_policy_definition_with_max_col() entry points so callers can raise the limit when needed. Also bump ExprParser's own default to 65536 since template expressions are routinely thousands of characters wide.
5793fb3 to
2f9c711
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 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 3 out of 3 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.
Some Azure Policy JSON documents contain very long lines — ARM template expressions with deeply nested if()/concat() calls can easily exceed the default 1024-column lexer limit.
Add Parser::new_with_max_col() and corresponding parse_policy_rule_with_max_col() / parse_policy_definition_with_max_col() entry points so callers can raise the limit when needed. Also bump ExprParser's own default to 65536 since template expressions are routinely thousands of characters wide.