Skip to content

Commit 495576c

Browse files
tausbnerik-krogh
authored andcommitted
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.
1 parent 2ee1979 commit 495576c

File tree

5 files changed

+48
-532
lines changed

5 files changed

+48
-532
lines changed

ql/Cargo.lock

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ql/generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ clap = "2.33"
1111
node-types = { path = "../node-types" }
1212
tracing = "0.1"
1313
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
14-
tree-sitter-ql = { git = "https://github.com/erik-krogh/tree-sitter-ql.git", rev = "343cc5873e20510586ade803659ef8ce153bd603" }
14+
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git" }

ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll

Lines changed: 1 addition & 316 deletions
Original file line numberDiff line numberDiff line change
@@ -405,250 +405,6 @@ module QL {
405405
final override AstNode getAFieldOrChild() { ql_datatype_branches_child(this, _, result) }
406406
}
407407

408-
/** A class representing `db_annotation` nodes. */
409-
class DbAnnotation extends @ql_db_annotation, AstNode {
410-
/** Gets the name of the primary QL class for this element. */
411-
final override string getAPrimaryQlClass() { result = "DbAnnotation" }
412-
413-
/** Gets the node corresponding to the field `argsAnnotation`. */
414-
final DbArgsAnnotation getArgsAnnotation() { ql_db_annotation_args_annotation(this, result) }
415-
416-
/** Gets the node corresponding to the field `simpleAnnotation`. */
417-
final AnnotName getSimpleAnnotation() { ql_db_annotation_simple_annotation(this, result) }
418-
419-
/** Gets a field or child node of this node. */
420-
final override AstNode getAFieldOrChild() {
421-
ql_db_annotation_args_annotation(this, result) or
422-
ql_db_annotation_simple_annotation(this, result)
423-
}
424-
}
425-
426-
/** A class representing `db_argsAnnotation` nodes. */
427-
class DbArgsAnnotation extends @ql_db_args_annotation, AstNode {
428-
/** Gets the name of the primary QL class for this element. */
429-
final override string getAPrimaryQlClass() { result = "DbArgsAnnotation" }
430-
431-
/** Gets the node corresponding to the field `name`. */
432-
final AnnotName getName() { ql_db_args_annotation_def(this, result) }
433-
434-
/** Gets the `i`th child of this node. */
435-
final SimpleId getChild(int i) { ql_db_args_annotation_child(this, i, result) }
436-
437-
/** Gets a field or child node of this node. */
438-
final override AstNode getAFieldOrChild() {
439-
ql_db_args_annotation_def(this, result) or ql_db_args_annotation_child(this, _, result)
440-
}
441-
}
442-
443-
/** A class representing `db_boolean` tokens. */
444-
class DbBoolean extends @ql_token_db_boolean, Token {
445-
/** Gets the name of the primary QL class for this element. */
446-
final override string getAPrimaryQlClass() { result = "DbBoolean" }
447-
}
448-
449-
/** A class representing `db_branch` nodes. */
450-
class DbBranch extends @ql_db_branch, AstNode {
451-
/** Gets the name of the primary QL class for this element. */
452-
final override string getAPrimaryQlClass() { result = "DbBranch" }
453-
454-
/** Gets the node corresponding to the field `qldoc`. */
455-
final Qldoc getQldoc() { ql_db_branch_qldoc(this, result) }
456-
457-
/** Gets the `i`th child of this node. */
458-
final AstNode getChild(int i) { ql_db_branch_child(this, i, result) }
459-
460-
/** Gets a field or child node of this node. */
461-
final override AstNode getAFieldOrChild() {
462-
ql_db_branch_qldoc(this, result) or ql_db_branch_child(this, _, result)
463-
}
464-
}
465-
466-
/** A class representing `db_case` tokens. */
467-
class DbCase extends @ql_token_db_case, Token {
468-
/** Gets the name of the primary QL class for this element. */
469-
final override string getAPrimaryQlClass() { result = "DbCase" }
470-
}
471-
472-
/** A class representing `db_caseDecl` nodes. */
473-
class DbCaseDecl extends @ql_db_case_decl, AstNode {
474-
/** Gets the name of the primary QL class for this element. */
475-
final override string getAPrimaryQlClass() { result = "DbCaseDecl" }
476-
477-
/** Gets the node corresponding to the field `base`. */
478-
final Dbtype getBase() { ql_db_case_decl_def(this, result, _) }
479-
480-
/** Gets the node corresponding to the field `discriminator`. */
481-
final SimpleId getDiscriminator() { ql_db_case_decl_def(this, _, result) }
482-
483-
/** Gets the `i`th child of this node. */
484-
final AstNode getChild(int i) { ql_db_case_decl_child(this, i, result) }
485-
486-
/** Gets a field or child node of this node. */
487-
final override AstNode getAFieldOrChild() {
488-
ql_db_case_decl_def(this, result, _) or
489-
ql_db_case_decl_def(this, _, result) or
490-
ql_db_case_decl_child(this, _, result)
491-
}
492-
}
493-
494-
/** A class representing `db_colType` nodes. */
495-
class DbColType extends @ql_db_col_type, AstNode {
496-
/** Gets the name of the primary QL class for this element. */
497-
final override string getAPrimaryQlClass() { result = "DbColType" }
498-
499-
/** Gets the child of this node. */
500-
final AstNode getChild() { ql_db_col_type_def(this, result) }
501-
502-
/** Gets a field or child node of this node. */
503-
final override AstNode getAFieldOrChild() { ql_db_col_type_def(this, result) }
504-
}
505-
506-
/** A class representing `db_column` nodes. */
507-
class DbColumn extends @ql_db_column, AstNode {
508-
/** Gets the name of the primary QL class for this element. */
509-
final override string getAPrimaryQlClass() { result = "DbColumn" }
510-
511-
/** Gets the node corresponding to the field `colName`. */
512-
final SimpleId getColName() { ql_db_column_def(this, result, _, _) }
513-
514-
/** Gets the node corresponding to the field `colType`. */
515-
final DbColType getColType() { ql_db_column_def(this, _, result, _) }
516-
517-
/** Gets the node corresponding to the field `isRef`. */
518-
final DbRef getIsRef() { ql_db_column_is_ref(this, result) }
519-
520-
/** Gets the node corresponding to the field `isUnique`. */
521-
final DbUnique getIsUnique() { ql_db_column_is_unique(this, result) }
522-
523-
/** Gets the node corresponding to the field `qldoc`. */
524-
final Qldoc getQldoc() { ql_db_column_qldoc(this, result) }
525-
526-
/** Gets the node corresponding to the field `reprType`. */
527-
final DbReprType getReprType() { ql_db_column_def(this, _, _, result) }
528-
529-
/** Gets a field or child node of this node. */
530-
final override AstNode getAFieldOrChild() {
531-
ql_db_column_def(this, result, _, _) or
532-
ql_db_column_def(this, _, result, _) or
533-
ql_db_column_is_ref(this, result) or
534-
ql_db_column_is_unique(this, result) or
535-
ql_db_column_qldoc(this, result) or
536-
ql_db_column_def(this, _, _, result)
537-
}
538-
}
539-
540-
/** A class representing `db_date` tokens. */
541-
class DbDate extends @ql_token_db_date, Token {
542-
/** Gets the name of the primary QL class for this element. */
543-
final override string getAPrimaryQlClass() { result = "DbDate" }
544-
}
545-
546-
/** A class representing `db_entry` nodes. */
547-
class DbEntry extends @ql_db_entry, AstNode {
548-
/** Gets the name of the primary QL class for this element. */
549-
final override string getAPrimaryQlClass() { result = "DbEntry" }
550-
551-
/** Gets the child of this node. */
552-
final AstNode getChild() { ql_db_entry_def(this, result) }
553-
554-
/** Gets a field or child node of this node. */
555-
final override AstNode getAFieldOrChild() { ql_db_entry_def(this, result) }
556-
}
557-
558-
/** A class representing `db_float` tokens. */
559-
class DbFloat extends @ql_token_db_float, Token {
560-
/** Gets the name of the primary QL class for this element. */
561-
final override string getAPrimaryQlClass() { result = "DbFloat" }
562-
}
563-
564-
/** A class representing `db_int` tokens. */
565-
class DbInt extends @ql_token_db_int, Token {
566-
/** Gets the name of the primary QL class for this element. */
567-
final override string getAPrimaryQlClass() { result = "DbInt" }
568-
}
569-
570-
/** A class representing `db_ref` tokens. */
571-
class DbRef extends @ql_token_db_ref, Token {
572-
/** Gets the name of the primary QL class for this element. */
573-
final override string getAPrimaryQlClass() { result = "DbRef" }
574-
}
575-
576-
/** A class representing `db_reprType` nodes. */
577-
class DbReprType extends @ql_db_repr_type, AstNode {
578-
/** Gets the name of the primary QL class for this element. */
579-
final override string getAPrimaryQlClass() { result = "DbReprType" }
580-
581-
/** Gets the `i`th child of this node. */
582-
final AstNode getChild(int i) { ql_db_repr_type_child(this, i, result) }
583-
584-
/** Gets a field or child node of this node. */
585-
final override AstNode getAFieldOrChild() { ql_db_repr_type_child(this, _, result) }
586-
}
587-
588-
/** A class representing `db_string` tokens. */
589-
class DbString extends @ql_token_db_string, Token {
590-
/** Gets the name of the primary QL class for this element. */
591-
final override string getAPrimaryQlClass() { result = "DbString" }
592-
}
593-
594-
/** A class representing `db_table` nodes. */
595-
class DbTable extends @ql_db_table, AstNode {
596-
/** Gets the name of the primary QL class for this element. */
597-
final override string getAPrimaryQlClass() { result = "DbTable" }
598-
599-
/** Gets the node corresponding to the field `tableName`. */
600-
final DbTableName getTableName() { ql_db_table_def(this, result) }
601-
602-
/** Gets the `i`th child of this node. */
603-
final AstNode getChild(int i) { ql_db_table_child(this, i, result) }
604-
605-
/** Gets a field or child node of this node. */
606-
final override AstNode getAFieldOrChild() {
607-
ql_db_table_def(this, result) or ql_db_table_child(this, _, result)
608-
}
609-
}
610-
611-
/** A class representing `db_tableName` nodes. */
612-
class DbTableName extends @ql_db_table_name, AstNode {
613-
/** Gets the name of the primary QL class for this element. */
614-
final override string getAPrimaryQlClass() { result = "DbTableName" }
615-
616-
/** Gets the child of this node. */
617-
final SimpleId getChild() { ql_db_table_name_def(this, result) }
618-
619-
/** Gets a field or child node of this node. */
620-
final override AstNode getAFieldOrChild() { ql_db_table_name_def(this, result) }
621-
}
622-
623-
/** A class representing `db_unionDecl` nodes. */
624-
class DbUnionDecl extends @ql_db_union_decl, AstNode {
625-
/** Gets the name of the primary QL class for this element. */
626-
final override string getAPrimaryQlClass() { result = "DbUnionDecl" }
627-
628-
/** Gets the node corresponding to the field `base`. */
629-
final Dbtype getBase() { ql_db_union_decl_def(this, result) }
630-
631-
/** Gets the `i`th child of this node. */
632-
final Dbtype getChild(int i) { ql_db_union_decl_child(this, i, result) }
633-
634-
/** Gets a field or child node of this node. */
635-
final override AstNode getAFieldOrChild() {
636-
ql_db_union_decl_def(this, result) or ql_db_union_decl_child(this, _, result)
637-
}
638-
}
639-
640-
/** A class representing `db_unique` tokens. */
641-
class DbUnique extends @ql_token_db_unique, Token {
642-
/** Gets the name of the primary QL class for this element. */
643-
final override string getAPrimaryQlClass() { result = "DbUnique" }
644-
}
645-
646-
/** A class representing `db_varchar` tokens. */
647-
class DbVarchar extends @ql_token_db_varchar, Token {
648-
/** Gets the name of the primary QL class for this element. */
649-
final override string getAPrimaryQlClass() { result = "DbVarchar" }
650-
}
651-
652408
/** A class representing `dbtype` tokens. */
653409
class Dbtype extends @ql_token_dbtype, Token {
654410
/** Gets the name of the primary QL class for this element. */
@@ -1188,7 +944,7 @@ module QL {
1188944
final override string getAPrimaryQlClass() { result = "Ql" }
1189945

1190946
/** Gets the `i`th child of this node. */
1191-
final AstNode getChild(int i) { ql_ql_child(this, i, result) }
947+
final ModuleMember getChild(int i) { ql_ql_child(this, i, result) }
1192948

1193949
/** Gets a field or child node of this node. */
1194950
final override AstNode getAFieldOrChild() { ql_ql_child(this, _, result) }
@@ -1524,75 +1280,4 @@ module QL {
15241280
/** Gets a field or child node of this node. */
15251281
final override AstNode getAFieldOrChild() { ql_variable_def(this, result) }
15261282
}
1527-
1528-
/** A class representing `yaml_comment` nodes. */
1529-
class YamlComment extends @ql_yaml_comment, AstNode {
1530-
/** Gets the name of the primary QL class for this element. */
1531-
final override string getAPrimaryQlClass() { result = "YamlComment" }
1532-
1533-
/** Gets the child of this node. */
1534-
final YamlValue getChild() { ql_yaml_comment_def(this, result) }
1535-
1536-
/** Gets a field or child node of this node. */
1537-
final override AstNode getAFieldOrChild() { ql_yaml_comment_def(this, result) }
1538-
}
1539-
1540-
/** A class representing `yaml_entry` nodes. */
1541-
class YamlEntry extends @ql_yaml_entry, AstNode {
1542-
/** Gets the name of the primary QL class for this element. */
1543-
final override string getAPrimaryQlClass() { result = "YamlEntry" }
1544-
1545-
/** Gets the child of this node. */
1546-
final AstNode getChild() { ql_yaml_entry_def(this, result) }
1547-
1548-
/** Gets a field or child node of this node. */
1549-
final override AstNode getAFieldOrChild() { ql_yaml_entry_def(this, result) }
1550-
}
1551-
1552-
/** A class representing `yaml_key` nodes. */
1553-
class YamlKey extends @ql_yaml_key, AstNode {
1554-
/** Gets the name of the primary QL class for this element. */
1555-
final override string getAPrimaryQlClass() { result = "YamlKey" }
1556-
1557-
/** Gets the `i`th child of this node. */
1558-
final AstNode getChild(int i) { ql_yaml_key_child(this, i, result) }
1559-
1560-
/** Gets a field or child node of this node. */
1561-
final override AstNode getAFieldOrChild() { ql_yaml_key_child(this, _, result) }
1562-
}
1563-
1564-
/** A class representing `yaml_keyvaluepair` nodes. */
1565-
class YamlKeyvaluepair extends @ql_yaml_keyvaluepair, AstNode {
1566-
/** Gets the name of the primary QL class for this element. */
1567-
final override string getAPrimaryQlClass() { result = "YamlKeyvaluepair" }
1568-
1569-
/** Gets the node corresponding to the field `key`. */
1570-
final YamlKey getKey() { ql_yaml_keyvaluepair_def(this, result, _) }
1571-
1572-
/** Gets the node corresponding to the field `value`. */
1573-
final YamlValue getValue() { ql_yaml_keyvaluepair_def(this, _, result) }
1574-
1575-
/** Gets a field or child node of this node. */
1576-
final override AstNode getAFieldOrChild() {
1577-
ql_yaml_keyvaluepair_def(this, result, _) or ql_yaml_keyvaluepair_def(this, _, result)
1578-
}
1579-
}
1580-
1581-
/** A class representing `yaml_listitem` nodes. */
1582-
class YamlListitem extends @ql_yaml_listitem, AstNode {
1583-
/** Gets the name of the primary QL class for this element. */
1584-
final override string getAPrimaryQlClass() { result = "YamlListitem" }
1585-
1586-
/** Gets the child of this node. */
1587-
final YamlValue getChild() { ql_yaml_listitem_def(this, result) }
1588-
1589-
/** Gets a field or child node of this node. */
1590-
final override AstNode getAFieldOrChild() { ql_yaml_listitem_def(this, result) }
1591-
}
1592-
1593-
/** A class representing `yaml_value` tokens. */
1594-
class YamlValue extends @ql_token_yaml_value, Token {
1595-
/** Gets the name of the primary QL class for this element. */
1596-
final override string getAPrimaryQlClass() { result = "YamlValue" }
1597-
}
15981283
}

0 commit comments

Comments
 (0)