@@ -65,7 +65,7 @@ object Ast extends SchemaBase {
65
65
|""" .stripMargin
66
66
)
67
67
.mandatory(- 1 )
68
- .protoId(4 )
68
+ .protoId(ProtoIds . Order )
69
69
70
70
val astNode = builder
71
71
.addNodeBaseType(
@@ -116,7 +116,7 @@ object Ast extends SchemaBase {
116
116
|"block expression") to describe what in the CPG we call "Block".
117
117
|""" .stripMargin
118
118
)
119
- .protoId(31 )
119
+ .protoId(ProtoIds . Block )
120
120
.addProperties(typeFullName)
121
121
122
122
val literal : NodeType = builder
@@ -128,7 +128,7 @@ object Ast extends SchemaBase {
128
128
|e.g., `java.lang.Integer`.
129
129
|""" .stripMargin
130
130
)
131
- .protoId(8 )
131
+ .protoId(ProtoIds . Literal )
132
132
.addProperties(typeFullName)
133
133
.primaryKey(code)
134
134
@@ -141,7 +141,7 @@ object Ast extends SchemaBase {
141
141
|`int x = 10;`, it contains `int x`.
142
142
|""" .stripMargin
143
143
)
144
- .protoId(23 )
144
+ .protoId(ProtoIds . Local )
145
145
.addProperties(typeFullName)
146
146
.extendz(declaration, astNode)
147
147
.primaryKey(name)
@@ -154,7 +154,7 @@ object Ast extends SchemaBase {
154
154
|name in `TYPE_FULL_NAME`.
155
155
|""" .stripMargin
156
156
)
157
- .protoId(27 )
157
+ .protoId(ProtoIds . Identifier )
158
158
.addProperties(typeFullName, name)
159
159
.primaryKey(name)
160
160
@@ -172,7 +172,7 @@ object Ast extends SchemaBase {
172
172
|""" .stripMargin
173
173
)
174
174
.mandatory(PropertyDefaults .String )
175
- .protoId(2001092 )
175
+ .protoId(ProtoIds . CanonicalName )
176
176
177
177
val fieldIdentifier : NodeType = builder
178
178
.addNodeType(
@@ -189,7 +189,7 @@ object Ast extends SchemaBase {
189
189
|it.
190
190
|""" .stripMargin
191
191
)
192
- .protoId(2001081 )
192
+ .protoId(ProtoIds . FieldIdentifier )
193
193
.addProperties(canonicalName)
194
194
195
195
val modifierType = builder
@@ -201,55 +201,55 @@ object Ast extends SchemaBase {
201
201
|""" .stripMargin
202
202
)
203
203
.mandatory(PropertyDefaults .String )
204
- .protoId(26 )
204
+ .protoId(ProtoIds . ModifierType )
205
205
206
206
val modifierTypes = builder.addConstants(
207
207
category = " ModifierTypes" ,
208
208
Constant (name = " STATIC" , value = " STATIC" , valueType = ValueType .String , comment = " The static modifier" )
209
- .protoId(1 ),
209
+ .protoId(ProtoIds . Static ),
210
210
Constant (name = " PUBLIC" , value = " PUBLIC" , valueType = ValueType .String , comment = " The public modifier" )
211
- .protoId(2 ),
211
+ .protoId(ProtoIds . Public ),
212
212
Constant (
213
213
name = " PROTECTED" ,
214
214
value = " PROTECTED" ,
215
215
valueType = ValueType .String ,
216
216
comment = " The protected modifier"
217
- ).protoId(3 ),
217
+ ).protoId(ProtoIds . Protected ),
218
218
Constant (name = " PRIVATE" , value = " PRIVATE" , valueType = ValueType .String , comment = " The private modifier" )
219
- .protoId(4 ),
219
+ .protoId(ProtoIds . Private ),
220
220
Constant (name = " ABSTRACT" , value = " ABSTRACT" , valueType = ValueType .String , comment = " The abstract modifier" )
221
- .protoId(5 ),
221
+ .protoId(ProtoIds . Abstract ),
222
222
Constant (name = " NATIVE" , value = " NATIVE" , valueType = ValueType .String , comment = " The native modifier" )
223
- .protoId(6 ),
223
+ .protoId(ProtoIds . Native ),
224
224
Constant (
225
225
name = " CONSTRUCTOR" ,
226
226
value = " CONSTRUCTOR" ,
227
227
valueType = ValueType .String ,
228
228
comment = " The constructor modifier"
229
- ).protoId(7 ),
229
+ ).protoId(ProtoIds . Constructor ),
230
230
Constant (name = " VIRTUAL" , value = " VIRTUAL" , valueType = ValueType .String , comment = " The virtual modifier" )
231
- .protoId(8 ),
231
+ .protoId(ProtoIds . Virtual ),
232
232
Constant (name = " INTERNAL" , value = " INTERNAL" , valueType = ValueType .String , comment = " The internal modifier" )
233
- .protoId(9 ),
233
+ .protoId(ProtoIds . Internal ),
234
234
Constant (name = " FINAL" , value = " FINAL" , valueType = ValueType .String , comment = " The final modifier" )
235
- .protoId(10 ),
235
+ .protoId(ProtoIds . Final ),
236
236
Constant (name = " READONLY" , value = " READONLY" , valueType = ValueType .String , comment = " The readonly modifier" )
237
- .protoId(11 ),
237
+ .protoId(ProtoIds . ReadOnly ),
238
238
Constant (
239
239
name = " MODULE" ,
240
240
value = " MODULE" ,
241
241
valueType = ValueType .String ,
242
242
comment =
243
243
" Indicate that a method defines a module in the sense e.g. a python module does with the creation of a module object"
244
244
)
245
- .protoId(12 ),
245
+ .protoId(ProtoIds . Module ),
246
246
Constant (
247
247
name = " LAMBDA" ,
248
248
value = " LAMBDA" ,
249
249
valueType = ValueType .String ,
250
250
comment = " Indicate that a method is an anonymous function, lambda, or closure"
251
251
)
252
- .protoId(13 )
252
+ .protoId(ProtoIds . Lambda )
253
253
)
254
254
255
255
val modifier : NodeType = builder
@@ -260,7 +260,7 @@ object Ast extends SchemaBase {
260
260
|cannot be evaluated and cannot be passed as an argument in function calls.
261
261
|""" .stripMargin
262
262
)
263
- .protoId(300 )
263
+ .protoId(ProtoIds . Modifier )
264
264
.addProperties(modifierType)
265
265
.extendz(astNode)
266
266
@@ -273,7 +273,7 @@ object Ast extends SchemaBase {
273
273
|that this jump target is created from, e.g., "Label".
274
274
|""" .stripMargin
275
275
)
276
- .protoId(340 )
276
+ .protoId(ProtoIds . JumpTarget )
277
277
.addProperties(name, parserTypeName)
278
278
.extendz(astNode)
279
279
@@ -286,7 +286,7 @@ object Ast extends SchemaBase {
286
286
|label is created from, e.g., "Label".
287
287
|""" .stripMargin
288
288
)
289
- .protoId(341 )
289
+ .protoId(ProtoIds . JumpLabel )
290
290
.addProperties(name, parserTypeName)
291
291
.extendz(astNode)
292
292
@@ -299,12 +299,12 @@ object Ast extends SchemaBase {
299
299
|`TYPE_FULL_NAME` holds its fully-qualified type name.
300
300
|""" .stripMargin
301
301
)
302
- .protoId(333 )
302
+ .protoId(ProtoIds . MethodRef )
303
303
.addProperties(typeFullName)
304
304
305
305
val typeRef : NodeType = builder
306
306
.addNodeType(name = " TYPE_REF" , comment = " Reference to a type/class" )
307
- .protoId(335 )
307
+ .protoId(ProtoIds . TypeRef )
308
308
.addProperties(typeFullName)
309
309
310
310
val ret : NodeType = builder
@@ -315,7 +315,7 @@ object Ast extends SchemaBase {
315
315
|represented via `METHOD_RETURN` nodes.
316
316
|""" .stripMargin
317
317
)
318
- .protoId(30 )
318
+ .protoId(ProtoIds . Return )
319
319
.starterName(" ret" )
320
320
.primaryKey(code)
321
321
@@ -329,7 +329,7 @@ object Ast extends SchemaBase {
329
329
|""" .stripMargin
330
330
)
331
331
.mandatory(PropertyDefaults .String )
332
- .protoId(27 )
332
+ .protoId(ProtoIds . ControlStructureType )
333
333
334
334
val controlStructureTypes = builder.addConstants(
335
335
category = " ControlStructureTypes" ,
@@ -339,49 +339,49 @@ object Ast extends SchemaBase {
339
339
valueType = ValueType .String ,
340
340
comment = """ Represents a break statement. Labeled breaks are expected to have a JUMP_LABEL
341
341
|node AST child with ORDER 1""" .stripMargin
342
- ).protoId(1 ),
342
+ ).protoId(ProtoIds . Break ),
343
343
Constant (
344
344
name = " CONTINUE" ,
345
345
value = " CONTINUE" ,
346
346
valueType = ValueType .String ,
347
347
comment = """ Represents a continue statement. Labeled continues are expected to have a JUMP_LABEL
348
348
|node AST child with ORDER 1""" .stripMargin
349
- ).protoId(2 ),
349
+ ).protoId(ProtoIds . Continue ),
350
350
Constant (name = " WHILE" , value = " WHILE" , valueType = ValueType .String , comment = " Represents a while statement" )
351
- .protoId(3 ),
351
+ .protoId(ProtoIds . While ),
352
352
Constant (name = " DO" , value = " DO" , valueType = ValueType .String , comment = " Represents a do statement" )
353
- .protoId(4 ),
353
+ .protoId(ProtoIds . Do ),
354
354
Constant (name = " FOR" , value = " FOR" , valueType = ValueType .String , comment = " Represents a for statement" )
355
- .protoId(5 ),
355
+ .protoId(ProtoIds . For ),
356
356
Constant (name = " GOTO" , value = " GOTO" , valueType = ValueType .String , comment = " Represents a goto statement" )
357
- .protoId(6 ),
357
+ .protoId(ProtoIds . Goto ),
358
358
Constant (name = " IF" , value = " IF" , valueType = ValueType .String , comment = " Represents an if statement" )
359
- .protoId(7 ),
359
+ .protoId(ProtoIds . If ),
360
360
Constant (name = " ELSE" , value = " ELSE" , valueType = ValueType .String , comment = " Represents an else statement" )
361
- .protoId(8 ),
361
+ .protoId(ProtoIds . Else ),
362
362
Constant (
363
363
name = " SWITCH" ,
364
364
value = " SWITCH" ,
365
365
valueType = ValueType .String ,
366
366
comment = " Represents a switch statement"
367
- ).protoId(9 ),
367
+ ).protoId(ProtoIds . Switch ),
368
368
Constant (name = " TRY" , value = " TRY" , valueType = ValueType .String , comment = " Represents a try statement" )
369
- .protoId(10 ),
369
+ .protoId(ProtoIds . Try ),
370
370
Constant (name = " THROW" , value = " THROW" , valueType = ValueType .String , comment = " Represents a throw statement" )
371
- .protoId(11 ),
371
+ .protoId(ProtoIds . Throw ),
372
372
Constant (name = " MATCH" , value = " MATCH" , valueType = ValueType .String , comment = " Represents a match expression" )
373
- .protoId(12 ),
373
+ .protoId(ProtoIds . Match ),
374
374
Constant (name = " YIELD" , value = " YIELD" , valueType = ValueType .String , comment = " Represents a yield expression" )
375
- .protoId(13 ),
375
+ .protoId(ProtoIds . Yield ),
376
376
Constant (name = " CATCH" , value = " CATCH" , valueType = ValueType .String , comment = " Represents a catch clause" )
377
- .protoId(14 ),
377
+ .protoId(ProtoIds . Catch ),
378
378
Constant (
379
379
name = " FINALLY" ,
380
380
value = " FINALLY" ,
381
381
valueType = ValueType .String ,
382
382
comment = " Represents a finally clause"
383
383
)
384
- .protoId(15 )
384
+ .protoId(ProtoIds . Finally )
385
385
)
386
386
387
387
val controlStructure : NodeType = builder
@@ -399,7 +399,7 @@ object Ast extends SchemaBase {
399
399
|for construction of the control flow layer.
400
400
|""" .stripMargin
401
401
)
402
- .protoId(339 )
402
+ .protoId(ProtoIds . ControlStructure )
403
403
.addProperties(parserTypeName, controlStructureType)
404
404
405
405
val unknown : NodeType = builder
@@ -410,21 +410,21 @@ object Ast extends SchemaBase {
410
410
|included using a node of type `UNKNOWN`.
411
411
|""" .stripMargin
412
412
)
413
- .protoId(44 )
413
+ .protoId(ProtoIds . Unknown )
414
414
.addProperties(parserTypeName, typeFullName)
415
415
416
416
// Edge types
417
417
418
418
val ast = builder
419
419
.addEdgeType(name = " AST" , comment = " This edge connects a parent node to its child in the syntax tree." )
420
- .protoId(3 )
420
+ .protoId(ProtoIds . Ast )
421
421
422
422
val condition = builder
423
423
.addEdgeType(
424
424
name = " CONDITION" ,
425
425
comment = " The edge connects control structure nodes to the expressions that holds their conditions."
426
426
)
427
- .protoId(56 )
427
+ .protoId(ProtoIds . Condition )
428
428
429
429
file.addOutEdge(edge = ast, inNode = namespaceBlock, cardinalityIn = Cardinality .ZeroOrOne )
430
430
@@ -578,7 +578,7 @@ object Ast extends SchemaBase {
578
578
|any information we may have about the types of arguments and return value.
579
579
|""" .stripMargin
580
580
)
581
- .protoId(15 )
581
+ .protoId(ProtoIds . CallNode )
582
582
.extendz(callRepr)
583
583
.addProperties(typeFullName)
584
584
.primaryKey(name)
0 commit comments