From 495576c438f98adf39ea4bfbf76d268666b5b118 Mon Sep 17 00:00:00 2001 From: Taus Date: Fri, 22 Jul 2022 12:58:03 +0000 Subject: [PATCH] Use upstream `tree-sitter-ql` This gets rid of all of the `dbscheme` and YAML bits. These will be added in later commits. (Doing it all in one go made for an unreadable diff.) Also modifies `create-extractor-path.sh` to automatically install `gh codeql` if there is no CodeQL CLI available for autoformatting. --- ql/Cargo.lock | 13 +- ql/generator/Cargo.toml | 2 +- .../src/codeql_ql/ast/internal/TreeSitter.qll | 317 +----------------- ql/ql/src/ql.dbscheme | 237 ++----------- ql/scripts/create-extractor-pack.sh | 11 +- 5 files changed, 48 insertions(+), 532 deletions(-) diff --git a/ql/Cargo.lock b/ql/Cargo.lock index 852382e1c86..90d0e07999b 100644 --- a/ql/Cargo.lock +++ b/ql/Cargo.lock @@ -273,7 +273,7 @@ dependencies = [ "tracing", "tracing-subscriber", "tree-sitter", - "tree-sitter-ql", + "tree-sitter-ql 0.19.0 (git+https://github.com/erik-krogh/tree-sitter-ql.git?rev=343cc5873e20510586ade803659ef8ce153bd603)", ] [[package]] @@ -284,7 +284,7 @@ dependencies = [ "node-types", "tracing", "tracing-subscriber", - "tree-sitter-ql", + "tree-sitter-ql 0.19.0 (git+https://github.com/tree-sitter/tree-sitter-ql.git)", ] [[package]] @@ -520,6 +520,15 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-ql" +version = "0.19.0" +source = "git+https://github.com/tree-sitter/tree-sitter-ql.git#24c72ad09f05982df4085c481d9b02ba9e79e7fc" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "unicode-width" version = "0.1.9" diff --git a/ql/generator/Cargo.toml b/ql/generator/Cargo.toml index 6b63b9515e4..fc0cba8f608 100644 --- a/ql/generator/Cargo.toml +++ b/ql/generator/Cargo.toml @@ -11,4 +11,4 @@ clap = "2.33" node-types = { path = "../node-types" } tracing = "0.1" tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } -tree-sitter-ql = { git = "https://github.com/erik-krogh/tree-sitter-ql.git", rev = "343cc5873e20510586ade803659ef8ce153bd603" } +tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git" } diff --git a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll index 015ca8cf608..2ac6642de36 100644 --- a/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll +++ b/ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll @@ -405,250 +405,6 @@ module QL { final override AstNode getAFieldOrChild() { ql_datatype_branches_child(this, _, result) } } - /** A class representing `db_annotation` nodes. */ - class DbAnnotation extends @ql_db_annotation, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbAnnotation" } - - /** Gets the node corresponding to the field `argsAnnotation`. */ - final DbArgsAnnotation getArgsAnnotation() { ql_db_annotation_args_annotation(this, result) } - - /** Gets the node corresponding to the field `simpleAnnotation`. */ - final AnnotName getSimpleAnnotation() { ql_db_annotation_simple_annotation(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_annotation_args_annotation(this, result) or - ql_db_annotation_simple_annotation(this, result) - } - } - - /** A class representing `db_argsAnnotation` nodes. */ - class DbArgsAnnotation extends @ql_db_args_annotation, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbArgsAnnotation" } - - /** Gets the node corresponding to the field `name`. */ - final AnnotName getName() { ql_db_args_annotation_def(this, result) } - - /** Gets the `i`th child of this node. */ - final SimpleId getChild(int i) { ql_db_args_annotation_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_args_annotation_def(this, result) or ql_db_args_annotation_child(this, _, result) - } - } - - /** A class representing `db_boolean` tokens. */ - class DbBoolean extends @ql_token_db_boolean, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbBoolean" } - } - - /** A class representing `db_branch` nodes. */ - class DbBranch extends @ql_db_branch, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbBranch" } - - /** Gets the node corresponding to the field `qldoc`. */ - final Qldoc getQldoc() { ql_db_branch_qldoc(this, result) } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_db_branch_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_branch_qldoc(this, result) or ql_db_branch_child(this, _, result) - } - } - - /** A class representing `db_case` tokens. */ - class DbCase extends @ql_token_db_case, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbCase" } - } - - /** A class representing `db_caseDecl` nodes. */ - class DbCaseDecl extends @ql_db_case_decl, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbCaseDecl" } - - /** Gets the node corresponding to the field `base`. */ - final Dbtype getBase() { ql_db_case_decl_def(this, result, _) } - - /** Gets the node corresponding to the field `discriminator`. */ - final SimpleId getDiscriminator() { ql_db_case_decl_def(this, _, result) } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_db_case_decl_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_case_decl_def(this, result, _) or - ql_db_case_decl_def(this, _, result) or - ql_db_case_decl_child(this, _, result) - } - } - - /** A class representing `db_colType` nodes. */ - class DbColType extends @ql_db_col_type, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbColType" } - - /** Gets the child of this node. */ - final AstNode getChild() { ql_db_col_type_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_db_col_type_def(this, result) } - } - - /** A class representing `db_column` nodes. */ - class DbColumn extends @ql_db_column, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbColumn" } - - /** Gets the node corresponding to the field `colName`. */ - final SimpleId getColName() { ql_db_column_def(this, result, _, _) } - - /** Gets the node corresponding to the field `colType`. */ - final DbColType getColType() { ql_db_column_def(this, _, result, _) } - - /** Gets the node corresponding to the field `isRef`. */ - final DbRef getIsRef() { ql_db_column_is_ref(this, result) } - - /** Gets the node corresponding to the field `isUnique`. */ - final DbUnique getIsUnique() { ql_db_column_is_unique(this, result) } - - /** Gets the node corresponding to the field `qldoc`. */ - final Qldoc getQldoc() { ql_db_column_qldoc(this, result) } - - /** Gets the node corresponding to the field `reprType`. */ - final DbReprType getReprType() { ql_db_column_def(this, _, _, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_column_def(this, result, _, _) or - ql_db_column_def(this, _, result, _) or - ql_db_column_is_ref(this, result) or - ql_db_column_is_unique(this, result) or - ql_db_column_qldoc(this, result) or - ql_db_column_def(this, _, _, result) - } - } - - /** A class representing `db_date` tokens. */ - class DbDate extends @ql_token_db_date, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbDate" } - } - - /** A class representing `db_entry` nodes. */ - class DbEntry extends @ql_db_entry, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbEntry" } - - /** Gets the child of this node. */ - final AstNode getChild() { ql_db_entry_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_db_entry_def(this, result) } - } - - /** A class representing `db_float` tokens. */ - class DbFloat extends @ql_token_db_float, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbFloat" } - } - - /** A class representing `db_int` tokens. */ - class DbInt extends @ql_token_db_int, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbInt" } - } - - /** A class representing `db_ref` tokens. */ - class DbRef extends @ql_token_db_ref, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbRef" } - } - - /** A class representing `db_reprType` nodes. */ - class DbReprType extends @ql_db_repr_type, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbReprType" } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_db_repr_type_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_db_repr_type_child(this, _, result) } - } - - /** A class representing `db_string` tokens. */ - class DbString extends @ql_token_db_string, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbString" } - } - - /** A class representing `db_table` nodes. */ - class DbTable extends @ql_db_table, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbTable" } - - /** Gets the node corresponding to the field `tableName`. */ - final DbTableName getTableName() { ql_db_table_def(this, result) } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_db_table_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_table_def(this, result) or ql_db_table_child(this, _, result) - } - } - - /** A class representing `db_tableName` nodes. */ - class DbTableName extends @ql_db_table_name, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbTableName" } - - /** Gets the child of this node. */ - final SimpleId getChild() { ql_db_table_name_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_db_table_name_def(this, result) } - } - - /** A class representing `db_unionDecl` nodes. */ - class DbUnionDecl extends @ql_db_union_decl, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbUnionDecl" } - - /** Gets the node corresponding to the field `base`. */ - final Dbtype getBase() { ql_db_union_decl_def(this, result) } - - /** Gets the `i`th child of this node. */ - final Dbtype getChild(int i) { ql_db_union_decl_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_db_union_decl_def(this, result) or ql_db_union_decl_child(this, _, result) - } - } - - /** A class representing `db_unique` tokens. */ - class DbUnique extends @ql_token_db_unique, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbUnique" } - } - - /** A class representing `db_varchar` tokens. */ - class DbVarchar extends @ql_token_db_varchar, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "DbVarchar" } - } - /** A class representing `dbtype` tokens. */ class Dbtype extends @ql_token_dbtype, Token { /** Gets the name of the primary QL class for this element. */ @@ -1188,7 +944,7 @@ module QL { final override string getAPrimaryQlClass() { result = "Ql" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_ql_child(this, i, result) } + final ModuleMember getChild(int i) { ql_ql_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { ql_ql_child(this, _, result) } @@ -1524,75 +1280,4 @@ module QL { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { ql_variable_def(this, result) } } - - /** A class representing `yaml_comment` nodes. */ - class YamlComment extends @ql_yaml_comment, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlComment" } - - /** Gets the child of this node. */ - final YamlValue getChild() { ql_yaml_comment_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_yaml_comment_def(this, result) } - } - - /** A class representing `yaml_entry` nodes. */ - class YamlEntry extends @ql_yaml_entry, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlEntry" } - - /** Gets the child of this node. */ - final AstNode getChild() { ql_yaml_entry_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_yaml_entry_def(this, result) } - } - - /** A class representing `yaml_key` nodes. */ - class YamlKey extends @ql_yaml_key, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlKey" } - - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { ql_yaml_key_child(this, i, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_yaml_key_child(this, _, result) } - } - - /** A class representing `yaml_keyvaluepair` nodes. */ - class YamlKeyvaluepair extends @ql_yaml_keyvaluepair, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlKeyvaluepair" } - - /** Gets the node corresponding to the field `key`. */ - final YamlKey getKey() { ql_yaml_keyvaluepair_def(this, result, _) } - - /** Gets the node corresponding to the field `value`. */ - final YamlValue getValue() { ql_yaml_keyvaluepair_def(this, _, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - ql_yaml_keyvaluepair_def(this, result, _) or ql_yaml_keyvaluepair_def(this, _, result) - } - } - - /** A class representing `yaml_listitem` nodes. */ - class YamlListitem extends @ql_yaml_listitem, AstNode { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlListitem" } - - /** Gets the child of this node. */ - final YamlValue getChild() { ql_yaml_listitem_def(this, result) } - - /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { ql_yaml_listitem_def(this, result) } - } - - /** A class representing `yaml_value` tokens. */ - class YamlValue extends @ql_token_yaml_value, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "YamlValue" } - } } diff --git a/ql/ql/src/ql.dbscheme b/ql/ql/src/ql.dbscheme index 51891374146..671a012d70d 100644 --- a/ql/ql/src/ql.dbscheme +++ b/ql/ql/src/ql.dbscheme @@ -291,145 +291,6 @@ ql_datatype_branches_def( unique int id: @ql_datatype_branches ); -ql_db_annotation_args_annotation( - unique int ql_db_annotation: @ql_db_annotation ref, - unique int args_annotation: @ql_db_args_annotation ref -); - -ql_db_annotation_simple_annotation( - unique int ql_db_annotation: @ql_db_annotation ref, - unique int simple_annotation: @ql_token_annot_name ref -); - -ql_db_annotation_def( - unique int id: @ql_db_annotation -); - -#keyset[ql_db_args_annotation, index] -ql_db_args_annotation_child( - int ql_db_args_annotation: @ql_db_args_annotation ref, - int index: int ref, - unique int child: @ql_token_simple_id ref -); - -ql_db_args_annotation_def( - unique int id: @ql_db_args_annotation, - int name: @ql_token_annot_name ref -); - -ql_db_branch_qldoc( - unique int ql_db_branch: @ql_db_branch ref, - unique int qldoc: @ql_token_qldoc ref -); - -@ql_db_branch_child_type = @ql_token_dbtype | @ql_token_integer - -#keyset[ql_db_branch, index] -ql_db_branch_child( - int ql_db_branch: @ql_db_branch ref, - int index: int ref, - unique int child: @ql_db_branch_child_type ref -); - -ql_db_branch_def( - unique int id: @ql_db_branch -); - -@ql_db_caseDecl_child_type = @ql_db_branch | @ql_token_db_case - -#keyset[ql_db_case_decl, index] -ql_db_case_decl_child( - int ql_db_case_decl: @ql_db_case_decl ref, - int index: int ref, - unique int child: @ql_db_caseDecl_child_type ref -); - -ql_db_case_decl_def( - unique int id: @ql_db_case_decl, - int base: @ql_token_dbtype ref, - int discriminator: @ql_token_simple_id ref -); - -@ql_db_colType_child_type = @ql_token_db_boolean | @ql_token_db_date | @ql_token_db_float | @ql_token_db_int | @ql_token_db_string | @ql_token_dbtype - -ql_db_col_type_def( - unique int id: @ql_db_col_type, - int child: @ql_db_colType_child_type ref -); - -ql_db_column_is_ref( - unique int ql_db_column: @ql_db_column ref, - unique int is_ref: @ql_token_db_ref ref -); - -ql_db_column_is_unique( - unique int ql_db_column: @ql_db_column ref, - unique int is_unique: @ql_token_db_unique ref -); - -ql_db_column_qldoc( - unique int ql_db_column: @ql_db_column ref, - unique int qldoc: @ql_token_qldoc ref -); - -ql_db_column_def( - unique int id: @ql_db_column, - int col_name: @ql_token_simple_id ref, - int col_type: @ql_db_col_type ref, - int repr_type: @ql_db_repr_type ref -); - -@ql_db_entry_child_type = @ql_db_case_decl | @ql_db_table | @ql_db_union_decl | @ql_token_qldoc - -ql_db_entry_def( - unique int id: @ql_db_entry, - int child: @ql_db_entry_child_type ref -); - -@ql_db_reprType_child_type = @ql_token_db_boolean | @ql_token_db_date | @ql_token_db_float | @ql_token_db_int | @ql_token_db_string | @ql_token_db_varchar | @ql_token_integer - -#keyset[ql_db_repr_type, index] -ql_db_repr_type_child( - int ql_db_repr_type: @ql_db_repr_type ref, - int index: int ref, - unique int child: @ql_db_reprType_child_type ref -); - -ql_db_repr_type_def( - unique int id: @ql_db_repr_type -); - -@ql_db_table_child_type = @ql_db_annotation | @ql_db_column - -#keyset[ql_db_table, index] -ql_db_table_child( - int ql_db_table: @ql_db_table ref, - int index: int ref, - unique int child: @ql_db_table_child_type ref -); - -ql_db_table_def( - unique int id: @ql_db_table, - int table_name: @ql_db_table_name ref -); - -ql_db_table_name_def( - unique int id: @ql_db_table_name, - int child: @ql_token_simple_id ref -); - -#keyset[ql_db_union_decl, index] -ql_db_union_decl_child( - int ql_db_union_decl: @ql_db_union_decl ref, - int index: int ref, - unique int child: @ql_token_dbtype ref -); - -ql_db_union_decl_def( - unique int id: @ql_db_union_decl, - int base: @ql_token_dbtype ref -); - @ql_disjunction_left_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable @ql_disjunction_right_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable @@ -764,13 +625,11 @@ ql_prefix_cast_def( unique int id: @ql_prefix_cast ); -@ql_ql_child_type = @ql_db_entry | @ql_module_member | @ql_yaml_entry - #keyset[ql_ql, index] ql_ql_child( int ql_ql: @ql_ql ref, int index: int ref, - unique int child: @ql_ql_child_type ref + unique int child: @ql_module_member ref ); ql_ql_def( @@ -1023,42 +882,6 @@ ql_variable_def( int child: @ql_variable_child_type ref ); -ql_yaml_comment_def( - unique int id: @ql_yaml_comment, - int child: @ql_token_yaml_value ref -); - -@ql_yaml_entry_child_type = @ql_yaml_comment | @ql_yaml_keyvaluepair | @ql_yaml_listitem - -ql_yaml_entry_def( - unique int id: @ql_yaml_entry, - int child: @ql_yaml_entry_child_type ref -); - -@ql_yaml_key_child_type = @ql_token_simple_id | @ql_yaml_key - -#keyset[ql_yaml_key, index] -ql_yaml_key_child( - int ql_yaml_key: @ql_yaml_key ref, - int index: int ref, - unique int child: @ql_yaml_key_child_type ref -); - -ql_yaml_key_def( - unique int id: @ql_yaml_key -); - -ql_yaml_keyvaluepair_def( - unique int id: @ql_yaml_keyvaluepair, - int key__: @ql_yaml_key ref, - int value: @ql_token_yaml_value ref -); - -ql_yaml_listitem_def( - unique int id: @ql_yaml_listitem, - int child: @ql_token_yaml_value ref -); - ql_tokeninfo( unique int id: @ql_token, int kind: int ref, @@ -1074,43 +897,33 @@ case @ql_token.kind of | 5 = @ql_token_class_name | 6 = @ql_token_closure | 7 = @ql_token_compop -| 8 = @ql_token_db_boolean -| 9 = @ql_token_db_case -| 10 = @ql_token_db_date -| 11 = @ql_token_db_float -| 12 = @ql_token_db_int -| 13 = @ql_token_db_ref -| 14 = @ql_token_db_string -| 15 = @ql_token_db_unique -| 16 = @ql_token_db_varchar -| 17 = @ql_token_dbtype -| 18 = @ql_token_direction -| 19 = @ql_token_empty -| 20 = @ql_token_false -| 21 = @ql_token_float -| 22 = @ql_token_integer -| 23 = @ql_token_line_comment -| 24 = @ql_token_literal_id -| 25 = @ql_token_mulop -| 26 = @ql_token_predicate -| 27 = @ql_token_predicate_name -| 28 = @ql_token_primitive_type -| 29 = @ql_token_qldoc -| 30 = @ql_token_quantifier -| 31 = @ql_token_result -| 32 = @ql_token_simple_id -| 33 = @ql_token_special_id -| 34 = @ql_token_string -| 35 = @ql_token_super -| 36 = @ql_token_this -| 37 = @ql_token_true -| 38 = @ql_token_underscore -| 39 = @ql_token_unop -| 40 = @ql_token_yaml_value +| 8 = @ql_token_dbtype +| 9 = @ql_token_direction +| 10 = @ql_token_empty +| 11 = @ql_token_false +| 12 = @ql_token_float +| 13 = @ql_token_integer +| 14 = @ql_token_line_comment +| 15 = @ql_token_literal_id +| 16 = @ql_token_mulop +| 17 = @ql_token_predicate +| 18 = @ql_token_predicate_name +| 19 = @ql_token_primitive_type +| 20 = @ql_token_qldoc +| 21 = @ql_token_quantifier +| 22 = @ql_token_result +| 23 = @ql_token_simple_id +| 24 = @ql_token_special_id +| 25 = @ql_token_string +| 26 = @ql_token_super +| 27 = @ql_token_this +| 28 = @ql_token_true +| 29 = @ql_token_underscore +| 30 = @ql_token_unop ; -@ql_ast_node = @ql_add_expr | @ql_aggregate | @ql_annot_arg | @ql_annotation | @ql_arityless_predicate_expr | @ql_as_expr | @ql_as_exprs | @ql_body | @ql_bool | @ql_call_body | @ql_call_or_unqual_agg_expr | @ql_charpred | @ql_class_member | @ql_classless_predicate | @ql_comp_term | @ql_conjunction | @ql_dataclass | @ql_datatype | @ql_datatype_branch | @ql_datatype_branches | @ql_db_annotation | @ql_db_args_annotation | @ql_db_branch | @ql_db_case_decl | @ql_db_col_type | @ql_db_column | @ql_db_entry | @ql_db_repr_type | @ql_db_table | @ql_db_table_name | @ql_db_union_decl | @ql_disjunction | @ql_expr_aggregate_body | @ql_expr_annotation | @ql_field | @ql_full_aggregate_body | @ql_higher_order_term | @ql_if_term | @ql_implication | @ql_import_directive | @ql_import_module_expr | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_member_predicate | @ql_module | @ql_module_alias_body | @ql_module_expr | @ql_module_instantiation | @ql_module_member | @ql_module_name | @ql_module_param | @ql_mul_expr | @ql_negation | @ql_order_by | @ql_order_bys | @ql_par_expr | @ql_predicate_alias_body | @ql_predicate_expr | @ql_prefix_cast | @ql_ql | @ql_qual_module_expr | @ql_qualified_expr | @ql_qualified_rhs | @ql_quantified | @ql_range | @ql_select | @ql_set_literal | @ql_signature_expr | @ql_special_call | @ql_super_ref | @ql_token | @ql_type_alias_body | @ql_type_expr | @ql_type_union_body | @ql_unary_expr | @ql_unqual_agg_body | @ql_var_decl | @ql_var_name | @ql_variable | @ql_yaml_comment | @ql_yaml_entry | @ql_yaml_key | @ql_yaml_keyvaluepair | @ql_yaml_listitem +@ql_ast_node = @ql_add_expr | @ql_aggregate | @ql_annot_arg | @ql_annotation | @ql_arityless_predicate_expr | @ql_as_expr | @ql_as_exprs | @ql_body | @ql_bool | @ql_call_body | @ql_call_or_unqual_agg_expr | @ql_charpred | @ql_class_member | @ql_classless_predicate | @ql_comp_term | @ql_conjunction | @ql_dataclass | @ql_datatype | @ql_datatype_branch | @ql_datatype_branches | @ql_disjunction | @ql_expr_aggregate_body | @ql_expr_annotation | @ql_field | @ql_full_aggregate_body | @ql_higher_order_term | @ql_if_term | @ql_implication | @ql_import_directive | @ql_import_module_expr | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_member_predicate | @ql_module | @ql_module_alias_body | @ql_module_expr | @ql_module_instantiation | @ql_module_member | @ql_module_name | @ql_module_param | @ql_mul_expr | @ql_negation | @ql_order_by | @ql_order_bys | @ql_par_expr | @ql_predicate_alias_body | @ql_predicate_expr | @ql_prefix_cast | @ql_ql | @ql_qual_module_expr | @ql_qualified_expr | @ql_qualified_rhs | @ql_quantified | @ql_range | @ql_select | @ql_set_literal | @ql_signature_expr | @ql_special_call | @ql_super_ref | @ql_token | @ql_type_alias_body | @ql_type_expr | @ql_type_union_body | @ql_unary_expr | @ql_unqual_agg_body | @ql_var_decl | @ql_var_name | @ql_variable @ql_ast_node_parent = @file | @ql_ast_node diff --git a/ql/scripts/create-extractor-pack.sh b/ql/scripts/create-extractor-pack.sh index 43577e5c448..d1b3c6312d9 100755 --- a/ql/scripts/create-extractor-pack.sh +++ b/ql/scripts/create-extractor-pack.sh @@ -10,10 +10,19 @@ else exit 1 fi +if which codeql >/dev/null; then + CODEQL_BINARY="codeql" +elif gh codeql >/dev/null; then + CODEQL_BINARY="gh codeql" +else + gh extension install github/gh-codeql + CODEQL_BINARY="gh codeql" +fi + cargo build --release cargo run --release -p ql-generator -- --dbscheme ql/src/ql.dbscheme --library ql/src/codeql_ql/ast/internal/TreeSitter.qll -codeql query format -i ql/src/codeql_ql/ast/internal/TreeSitter.qll +$CODEQL_BINARY query format -i ql/src/codeql_ql/ast/internal/TreeSitter.qll rm -rf extractor-pack mkdir -p extractor-pack