-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathprelude.py
More file actions
114 lines (83 loc) · 2.09 KB
/
prelude.py
File metadata and controls
114 lines (83 loc) · 2.09 KB
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
from misc.codegen.lib.schemadefs import *
include("../shared/tree-sitter-extractor/src/generator/prefix.dbscheme")
include("prefix.dbscheme")
File = imported("File", "codeql.files.FileSystem")
@qltest.skip
class Element:
pass
@qltest.skip
class Locatable(Element):
pass
@qltest.skip
class AstNode(Locatable):
pass
@qltest.skip
class Token(AstNode):
"""
The base class for all tokens.
"""
pass
class Comment(Token):
"""
A comment. For example:
```rust
// this is a comment
/// This is a doc comment
```
"""
parent: AstNode
text: string
@qltest.skip
class Unextracted(Element):
"""
The base class marking everything that was not properly extracted for some reason, such as:
* syntax errors
* insufficient context information
* yet unimplemented parts of the extractor
"""
pass
@qltest.skip
class Missing(Unextracted):
"""
The base class marking errors during parsing or resolution.
"""
@qltest.skip
class Unimplemented(Unextracted):
"""
The base class for unimplemented nodes. This is used to mark nodes that are not yet extracted.
"""
pass
class Callable(AstNode):
"""
A callable. Either a `Function` or a `ClosureExpr`.
"""
param_list: optional["ParamList"] | child
attrs: list["Attr"] | child
params: list["Param"] | synth
body: optional["Expr"] | synth
class Addressable(AstNode):
"""
Something that can be addressed by a path.
TODO: This does not yet include all possible cases.
"""
class PathAstNode(AstNode):
"""
An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
"""
path: optional["Path"] | child
@qltest.skip
@ql.internal
class ExtractorStep(Element):
action: string
file: optional[File]
duration_ms: int
class Crate(Locatable):
name: optional[string]
version: optional[string]
cfg_options: list[string]
named_dependencies: list["NamedCrate"] | ql.internal
@qltest.skip
@ql.internal
class NamedCrate(Element):
name: string
crate: "Crate"