Debian Codegraph @

tests/snippets/rego/test_assignment_and_equality.txt

raw
1 ---input---
2 package example
3
4 # Rego Policy References: https://www.openpolicyagent.org/docs/latest/policy-reference/
5
6 # assign variable x to value of field foo.bar.baz in input
7 x := input.foo.bar.baz
8
9 # check if variable x has same value as variable y
10 x == y
11
12 # check if variable x is a set containing "foo" and "bar"
13 x == {"foo", "bar"}
14
15 # OR
16
17 {"foo", "bar"} == x
18
19 ---tokens---
20 'package' Keyword
21 ' ' Text.Whitespace
22 'example' Name
23 '\n' Text.Whitespace
24
25 '\n' Text.Whitespace
26
27 '# Rego Policy References: https://www.openpolicyagent.org/docs/latest/policy-reference/' Comment.Single
28 '\n' Text.Whitespace
29
30 '\n' Text.Whitespace
31
32 '# assign variable x to value of field foo.bar.baz in input' Comment.Single
33 '\n' Text.Whitespace
34
35 'x' Name
36 ' ' Text.Whitespace
37 ':=' Operator
38 ' ' Text.Whitespace
39 'input' Name.Builtin
40 '.' Punctuation
41 'foo' Name
42 '.' Punctuation
43 'bar' Name
44 '.' Punctuation
45 'baz' Name
46 '\n' Text.Whitespace
47
48 '\n' Text.Whitespace
49
50 '# check if variable x has same value as variable y' Comment.Single
51 '\n' Text.Whitespace
52
53 'x' Name
54 ' ' Text.Whitespace
55 '==' Operator
56 ' ' Text.Whitespace
57 'y' Name
58 '\n' Text.Whitespace
59
60 '\n' Text.Whitespace
61
62 '# check if variable x is a set containing "foo" and "bar"' Comment.Single
63 '\n' Text.Whitespace
64
65 'x' Name
66 ' ' Text.Whitespace
67 '==' Operator
68 ' ' Text.Whitespace
69 '{' Punctuation
70 '"foo"' Literal.String.Double
71 ',' Punctuation
72 ' ' Text.Whitespace
73 '"bar"' Literal.String.Double
74 '}' Punctuation
75 '\n' Text.Whitespace
76
77 '\n' Text.Whitespace
78
79 '# OR' Comment.Single
80 '\n' Text.Whitespace
81
82 '\n' Text.Whitespace
83
84 '{' Punctuation
85 '"foo"' Literal.String.Double
86 ',' Punctuation
87 ' ' Text.Whitespace
88 '"bar"' Literal.String.Double
89 '}' Punctuation
90 ' ' Text.Whitespace
91 '==' Operator
92 ' ' Text.Whitespace
93 'x' Name
94 '\n' Text.Whitespace