QL: Add body as a field of charpred

This commit is contained in:
Taus
2021-05-26 17:26:15 +00:00
committed by GitHub
parent 88972f04f4
commit e554fa8277
5 changed files with 13 additions and 14 deletions

2
Cargo.lock generated
View File

@@ -589,7 +589,7 @@ dependencies = [
[[package]]
name = "tree-sitter-ql"
version = "0.19.0"
source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=dee83b7a1c159f2c71d8d3d3bce3ee1203ed653a#dee83b7a1c159f2c71d8d3d3bce3ee1203ed653a"
source = "git+https://github.com/tausbn/tree-sitter-ql.git?rev=4125f8b919f80889dec4b74842419d287ccf1782#4125f8b919f80889dec4b74842419d287ccf1782"
dependencies = [
"cc",
"tree-sitter",

View File

@@ -10,7 +10,7 @@ edition = "2018"
flate2 = "1.0"
node-types = { path = "../node-types" }
tree-sitter = "0.19"
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "dee83b7a1c159f2c71d8d3d3bce3ee1203ed653a" }
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "4125f8b919f80889dec4b74842419d287ccf1782" }
clap = "2.33"
tracing = "0.1"
tracing-subscriber = { version = "0.2", features = ["env-filter"] }

View File

@@ -10,4 +10,4 @@ edition = "2018"
node-types = { path = "../node-types" }
tracing = "0.1"
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "dee83b7a1c159f2c71d8d3d3bce3ee1203ed653a" }
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "4125f8b919f80889dec4b74842419d287ccf1782" }

View File

@@ -180,11 +180,15 @@ module Generated {
class Charpred extends @charpred, AstNode {
override string getAPrimaryQlClass() { result = "Charpred" }
override Location getLocation() { charpred_def(this, result) }
override Location getLocation() { charpred_def(this, _, _, result) }
AstNode getChild(int i) { charpred_child(this, i, result) }
AstNode getBody() { charpred_def(this, result, _, _) }
override AstNode getAFieldOrChild() { charpred_child(this, _, result) }
ClassName getChild() { charpred_def(this, _, result, _) }
override AstNode getAFieldOrChild() {
charpred_def(this, result, _, _) or charpred_def(this, _, result, _)
}
}
class ClassMember extends @class_member, AstNode {

View File

@@ -176,17 +176,12 @@ call_or_unqual_agg_expr_def(
int loc: @location ref
);
@charpred_child_type = @add_expr | @aggregate | @call_or_unqual_agg_expr | @comp_term | @conjunction | @disjunction | @expr_annotation | @if_term | @implication | @in_expr | @instance_of | @literal | @mul_expr | @negation | @par_expr | @prefix_cast | @qualified_expr | @quantified | @range | @set_literal | @special_call | @super_ref | @token_class_name | @unary_expr | @variable
#keyset[charpred, index]
charpred_child(
int charpred: @charpred ref,
int index: int ref,
unique int child: @charpred_child_type ref
);
@charpred_body_type = @add_expr | @aggregate | @call_or_unqual_agg_expr | @comp_term | @conjunction | @disjunction | @expr_annotation | @if_term | @implication | @in_expr | @instance_of | @literal | @mul_expr | @negation | @par_expr | @prefix_cast | @qualified_expr | @quantified | @range | @set_literal | @special_call | @super_ref | @unary_expr | @variable
charpred_def(
unique int id: @charpred,
int body: @charpred_body_type ref,
int child: @token_class_name ref,
int loc: @location ref
);