Skip to content

azure-policy parser: allow overriding the column-width limit#673

Merged
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-compiler-v2
Apr 10, 2026
Merged

azure-policy parser: allow overriding the column-width limit#673
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-compiler-v2

Conversation

@anakrish
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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's max_col for 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 lexer max_col to 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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@anakrish anakrish marked this pull request as ready for review April 10, 2026 17:27
@anakrish anakrish merged commit 3d34021 into microsoft:main Apr 10, 2026
67 checks passed
@anakrish anakrish deleted the azure-policy-compiler-v2 branch April 10, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants