feat: Safeguard against panics in parser

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-12-18 11:01:12 -06:00
parent 93a633750c
commit fd4bb3081f
3 changed files with 58 additions and 13 deletions

View File

@@ -163,6 +163,12 @@ cases:
num_statements: 0
want_result: {}
- note: invalid-future-component
rego: |
package test
import future.keywords.foo.bar
error: "invalid future keyword"
- note: shadow/1
rego: |
package test

View File

@@ -78,3 +78,21 @@ cases:
some a, 5
}
error: encountered `5` while expecting identifier
- note: no-vars-before-in
rego: |
package test
import future.keywords.in
x = y {
some in xs
}
error: "unexpected keyword `in`"
- note: too-many-before-in
rego: |
package test
import future.keywords.in
x = y {
some a, b, c in xs
}
error: "encountered `c` while expecting `in`"