mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Indexes allow associating extra data with nodes in the AST using an array and then quickly looking up the array to fetch the extra data. - Index eidx for expressions - Index sidx for statements - Index qidx for queries. AST nodes are not cloneable. Therefore once a module is created, it is not possible to accidentally create two nodes with the same index inadvertently via clone. Also added IndexChecker in debug builds. When a module is parsed, it will assert that indexes have been constructed correctly. AST Cleanup - Make literal expressions (null, val, number, string etc) also structs to match all other expressions - Merge True and False nodes into a single Bool node. Also update dependencies. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
56 lines
1.2 KiB
YAML
56 lines
1.2 KiB
YAML
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
cases:
|
|
- note: same-line-no-body
|
|
rego: |
|
|
package test
|
|
add(x, y) := 5 sub(x, y) = 5
|
|
num_expressions: 9
|
|
num_statements: 0
|
|
num_queries: 0
|
|
package: --skip--
|
|
imports:
|
|
policy:
|
|
- spec:
|
|
span: add(x, y) := 5
|
|
head:
|
|
func:
|
|
span: add(x, y) := 5
|
|
refr:
|
|
var: add
|
|
eidx: 1
|
|
args:
|
|
- var: x
|
|
eidx: 2
|
|
- var: y
|
|
eidx: 3
|
|
assign:
|
|
span: := 5
|
|
op: :=
|
|
value:
|
|
number: 5
|
|
eidx: 4
|
|
bodies: []
|
|
- spec:
|
|
span: sub(x, y) = 5
|
|
head:
|
|
func:
|
|
span: sub(x, y) = 5
|
|
refr:
|
|
var: sub
|
|
eidx: 5
|
|
args:
|
|
- var: x
|
|
eidx: 6
|
|
- var: y
|
|
eidx: 7
|
|
assign:
|
|
span: = 5
|
|
op: =
|
|
value:
|
|
number: 5
|
|
eidx: 8
|
|
bodies: []
|
|
|