blob: e130c800082241697c9c76ff7d8037512568f6f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
//go:generate go run golang.org/x/tools/cmd/stringer -type=NodeType -output zz_generated.nodetype_string.go
package dslshape
// NodeType identifies the type of AST node.
type NodeType int
const (
// Top-level
NodeTypeError NodeType = iota // error occurred; value is text of error
NodeTypeFile // The file root node
NodeTypeComment // A single or multiline comment
NodeTypeUseFlag // A use flag
NodeTypeDefinition // A definition.
NodeTypeCaveatDefinition // A caveat definition.
NodeTypeCaveatParameter // A caveat parameter.
NodeTypeCaveatExpression // A caveat expression.
NodeTypeRelation // A relation
NodeTypePermission // A permission
NodeTypeTypeReference // A type reference
NodeTypeSpecificTypeReference // A reference to a specific type.
NodeTypeCaveatReference // A caveat reference under a type.
NodeTypeTraitReference // A trait reference under a typr.
NodeTypeUnionExpression
NodeTypeIntersectExpression
NodeTypeExclusionExpression
NodeTypeArrowExpression // A TTU in arrow form.
NodeTypeIdentifier // An identifier under an expression.
NodeTypeNilExpression // A nil keyword
NodeTypeCaveatTypeReference // A type reference for a caveat parameter.
NodeTypeImport
NodeTypePartial
NodeTypePartialReference // A location where a partial is referenced
)
const (
//
// All nodes
//
// The source of this node.
NodePredicateSource = "input-source"
// The rune position in the input string at which this node begins.
NodePredicateStartRune = "start-rune"
// The rune position in the input string at which this node ends.
NodePredicateEndRune = "end-rune"
// A direct child of this node. Implementations should handle the ordering
// automatically for this predicate.
NodePredicateChild = "child-node"
//
// NodeTypeError
//
// The message for the parsing error.
NodePredicateErrorMessage = "error-message"
// The (optional) source to highlight for the parsing error.
NodePredicateErrorSource = "error-source"
//
// NodeTypeComment
//
// The value of the comment, including its delimeter(s)
NodeCommentPredicateValue = "comment-value"
//
// NodeTypeUseFlag
//
// The name of the use flag.
NodeUseFlagPredicateName = "use-flag-name"
//
// NodeTypeDefinition
//
// The name of the definition
NodeDefinitionPredicateName = "definition-name"
//
// NodeTypeCaveatDefinition
//
// The name of the definition
NodeCaveatDefinitionPredicateName = "caveat-definition-name"
// The parameters for the definition.
NodeCaveatDefinitionPredicateParameters = "parameters"
// The link to the expression for the definition.
NodeCaveatDefinitionPredicateExpession = "caveat-definition-expression"
//
// NodeTypeCaveatExpression
//
// The raw CEL expression, in string form.
NodeCaveatExpressionPredicateExpression = "caveat-expression-expressionstr"
//
// NodeTypeCaveatParameter
//
// The name of the parameter
NodeCaveatParameterPredicateName = "caveat-parameter-name"
// The defined type of the caveat parameter.
NodeCaveatParameterPredicateType = "caveat-parameter-type"
//
// NodeTypeCaveatTypeReference
//
// The type for the caveat type reference.
NodeCaveatTypeReferencePredicateType = "type-name"
// The child type(s) for the type reference.
NodeCaveatTypeReferencePredicateChildTypes = "child-types"
//
// NodeTypeRelation + NodeTypePermission
//
// The name of the relation/permission
NodePredicateName = "relation-name"
//
// NodeTypeRelation
//
// The allowed types for the relation.
NodeRelationPredicateAllowedTypes = "allowed-types"
//
// NodeTypeTypeReference
//
// A type under a type reference.
NodeTypeReferencePredicateType = "type-ref-type"
//
// NodeTypeSpecificTypeReference
//
// A type under a type reference.
NodeSpecificReferencePredicateType = "type-name"
// A relation under a type reference.
NodeSpecificReferencePredicateRelation = "relation-name"
// A wildcard under a type reference.
NodeSpecificReferencePredicateWildcard = "type-wildcard"
// A caveat under a type reference.
NodeSpecificReferencePredicateCaveat = "caveat"
// A trait under a type reference.
NodeSpecificReferencePredicateTrait = "trait"
//
// NodeTypeCaveatReference
//
// The caveat name under the caveat.
NodeCaveatPredicateCaveat = "caveat-name"
//
// NodeTypeTraitReference
//
// The trait name under the trait.
NodeTraitPredicateTrait = "trait-name"
//
// NodeTypePermission
//
// The expression to compute the permission.
NodePermissionPredicateComputeExpression = "compute-expression"
//
// NodeTypeArrowExpression
//
// The name of the function in the arrow expression.
NodeArrowExpressionFunctionName = "function-name"
//
// NodeTypeIdentifer
//
// The value of the identifier.
NodeIdentiferPredicateValue = "identifier-value"
//
// NodeTypeUnionExpression + NodeTypeIntersectExpression + NodeTypeExclusionExpression + NodeTypeArrowExpression
//
NodeExpressionPredicateLeftExpr = "left-expr"
NodeExpressionPredicateRightExpr = "right-expr"
//
// NodeTypeImport
//
NodeImportPredicatePath = "import-path"
//
// NodeTypePartial
//
NodePartialPredicateName = "partial-name"
//
// NodeTypePartialReference
//
NodePartialReferencePredicateName = "partial-reference-name"
)
|