mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Tree-sitter extractor: extract shared dbscheme fragments into 'prefix.dbscheme'
This commit is contained in:
@@ -1,15 +1,26 @@
|
|||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"javascript/ql/lib/semmlecode.javascript.dbscheme",
|
"javascript/ql/lib/semmlecode.javascript.dbscheme",
|
||||||
|
"ruby/ql/lib/ruby.dbscheme",
|
||||||
|
"ql/ql/src/ql.dbscheme"
|
||||||
],
|
],
|
||||||
"fragments": [
|
"fragments": [
|
||||||
"/*- External data -*/",
|
"/*- External data -*/",
|
||||||
"/*- Files and folders -*/",
|
"/*- Files and folders -*/",
|
||||||
|
"/*- Diagnostic messages -*/",
|
||||||
|
"/*- Diagnostic messages: severity -*/",
|
||||||
"/*- Source location prefix -*/",
|
"/*- Source location prefix -*/",
|
||||||
"/*- Lines of code -*/",
|
"/*- Lines of code -*/",
|
||||||
"/*- Configuration files with key value pairs -*/",
|
"/*- Configuration files with key value pairs -*/",
|
||||||
"/*- YAML -*/",
|
"/*- YAML -*/",
|
||||||
"/*- XML Files -*/",
|
"/*- XML Files -*/",
|
||||||
"/*- JavaScript-specific part -*/"
|
"/*- JavaScript-specific part -*/",
|
||||||
|
"/*- Ruby dbscheme -*/",
|
||||||
|
"/*- Erb dbscheme -*/",
|
||||||
|
"/*- QL dbscheme -*/",
|
||||||
|
"/*- Dbscheme dbscheme -*/",
|
||||||
|
"/*- Yaml dbscheme -*/",
|
||||||
|
"/*- Blame dbscheme -*/",
|
||||||
|
"/*- JSON dbscheme -*/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import files.FileSystem
|
|||||||
*
|
*
|
||||||
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||||
*/
|
*/
|
||||||
class Location extends @location {
|
class Location extends @location_default {
|
||||||
/** Gets the file for this location. */
|
/** Gets the file for this location. */
|
||||||
File getFile() { locations_default(this, result, _, _, _, _) }
|
File getFile() { locations_default(this, result, _, _, _, _) }
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
// CodeQL database schema for QL
|
// CodeQL database schema for QL
|
||||||
// Automatically generated from the tree-sitter grammar; do not edit
|
// Automatically generated from the tree-sitter grammar; do not edit
|
||||||
|
|
||||||
@location = @location_default
|
/*- Files and folders -*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of an element.
|
||||||
|
* The location spans column `startcolumn` of line `startline` to
|
||||||
|
* column `endcolumn` of line `endline` in file `file`.
|
||||||
|
* For more information, see
|
||||||
|
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||||
|
*/
|
||||||
locations_default(
|
locations_default(
|
||||||
unique int id: @location_default,
|
unique int id: @location_default,
|
||||||
int file: @file ref,
|
int file: @file ref,
|
||||||
int start_line: int ref,
|
int beginLine: int ref,
|
||||||
int start_column: int ref,
|
int beginColumn: int ref,
|
||||||
int end_line: int ref,
|
int endLine: int ref,
|
||||||
int end_column: int ref
|
int endColumn: int ref
|
||||||
);
|
);
|
||||||
|
|
||||||
files(
|
files(
|
||||||
@@ -29,9 +36,14 @@ containerparent(
|
|||||||
unique int child: @container ref
|
unique int child: @container ref
|
||||||
);
|
);
|
||||||
|
|
||||||
sourceLocationPrefix(
|
/*- Source location prefix -*/
|
||||||
string prefix: string ref
|
|
||||||
);
|
/**
|
||||||
|
* The source location of the snapshot.
|
||||||
|
*/
|
||||||
|
sourceLocationPrefix(string prefix : string ref);
|
||||||
|
|
||||||
|
/*- Diagnostic messages -*/
|
||||||
|
|
||||||
diagnostics(
|
diagnostics(
|
||||||
unique int id: @diagnostic,
|
unique int id: @diagnostic,
|
||||||
@@ -42,14 +54,15 @@ diagnostics(
|
|||||||
int location: @location_default ref
|
int location: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Diagnostic messages: severity -*/
|
||||||
|
|
||||||
case @diagnostic.severity of
|
case @diagnostic.severity of
|
||||||
10 = @diagnostic_debug
|
10 = @diagnostic_debug
|
||||||
| 20 = @diagnostic_info
|
| 20 = @diagnostic_info
|
||||||
| 30 = @diagnostic_warning
|
| 30 = @diagnostic_warning
|
||||||
| 40 = @diagnostic_error
|
| 40 = @diagnostic_error
|
||||||
;
|
;
|
||||||
|
/*- QL dbscheme -*/
|
||||||
|
|
||||||
@ql_add_expr_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_add_expr_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_add_expr_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
|
@ql_add_expr_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
|
||||||
@@ -926,9 +939,10 @@ ql_ast_node_info(
|
|||||||
unique int node: @ql_ast_node ref,
|
unique int node: @ql_ast_node ref,
|
||||||
int parent: @ql_ast_node_parent ref,
|
int parent: @ql_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Dbscheme dbscheme -*/
|
||||||
dbscheme_annotation_args_annotation(
|
dbscheme_annotation_args_annotation(
|
||||||
unique int dbscheme_annotation: @dbscheme_annotation ref,
|
unique int dbscheme_annotation: @dbscheme_annotation ref,
|
||||||
unique int args_annotation: @dbscheme_args_annotation ref
|
unique int args_annotation: @dbscheme_args_annotation ref
|
||||||
@@ -1112,9 +1126,10 @@ dbscheme_ast_node_info(
|
|||||||
unique int node: @dbscheme_ast_node ref,
|
unique int node: @dbscheme_ast_node ref,
|
||||||
int parent: @dbscheme_ast_node_parent ref,
|
int parent: @dbscheme_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Yaml dbscheme -*/
|
||||||
yaml_comment_def(
|
yaml_comment_def(
|
||||||
unique int id: @yaml_comment,
|
unique int id: @yaml_comment,
|
||||||
int child: @yaml_token_value ref
|
int child: @yaml_token_value ref
|
||||||
@@ -1184,9 +1199,10 @@ yaml_ast_node_info(
|
|||||||
unique int node: @yaml_ast_node ref,
|
unique int node: @yaml_ast_node ref,
|
||||||
int parent: @yaml_ast_node_parent ref,
|
int parent: @yaml_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Blame dbscheme -*/
|
||||||
#keyset[blame_blame_entry, index]
|
#keyset[blame_blame_entry, index]
|
||||||
blame_blame_entry_line(
|
blame_blame_entry_line(
|
||||||
int blame_blame_entry: @blame_blame_entry ref,
|
int blame_blame_entry: @blame_blame_entry ref,
|
||||||
@@ -1246,9 +1262,10 @@ blame_ast_node_info(
|
|||||||
unique int node: @blame_ast_node ref,
|
unique int node: @blame_ast_node ref,
|
||||||
int parent: @blame_ast_node_parent ref,
|
int parent: @blame_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- JSON dbscheme -*/
|
||||||
#keyset[json_array, index]
|
#keyset[json_array, index]
|
||||||
json_array_child(
|
json_array_child(
|
||||||
int json_array: @json_array ref,
|
int json_array: @json_array ref,
|
||||||
@@ -1327,6 +1344,6 @@ json_ast_node_info(
|
|||||||
unique int node: @json_ast_node ref,
|
unique int node: @json_ast_node ref,
|
||||||
int parent: @json_ast_node_parent ref,
|
int parent: @json_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1060,19 +1060,19 @@
|
|||||||
<v>8553</v>
|
<v>8553</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>start_line</k>
|
<k>startLine</k>
|
||||||
<v>74697</v>
|
<v>74697</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>start_column</k>
|
<k>startColumn</k>
|
||||||
<v>2236</v>
|
<v>2236</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>end_line</k>
|
<k>endLine</k>
|
||||||
<v>74730</v>
|
<v>74730</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>end_column</k>
|
<k>endColumn</k>
|
||||||
<v>2415</v>
|
<v>2415</v>
|
||||||
</e>
|
</e>
|
||||||
</columnsizes>
|
</columnsizes>
|
||||||
@@ -1095,7 +1095,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1111,7 +1111,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1127,7 +1127,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1143,7 +1143,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1235,7 +1235,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1316,7 +1316,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1392,7 +1392,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1473,7 +1473,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1548,7 +1548,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -1624,7 +1624,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -1675,8 +1675,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1751,8 +1751,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1797,8 +1797,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -1873,7 +1873,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -1949,7 +1949,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -2025,8 +2025,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2101,8 +2101,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2177,8 +2177,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2248,7 +2248,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -2324,7 +2324,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -2375,8 +2375,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2421,8 +2421,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2497,8 +2497,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2573,7 +2573,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -2649,7 +2649,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -2725,8 +2725,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2801,8 +2801,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2872,8 +2872,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ predicate anotherPredicate(int i) { none() }
|
|||||||
|
|
||||||
predicate yetAnotherPredicate(int i, int y) { none() }
|
predicate yetAnotherPredicate(int i, int y) { none() }
|
||||||
|
|
||||||
predicate dbTypePredicate(@location l) { none() }
|
predicate dbTypePredicate(@location_default l) { none() }
|
||||||
|
|
||||||
string predicateWithResult(int i) { none() }
|
string predicateWithResult(int i) { none() }
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ class SmallInt extends int {
|
|||||||
SmallInt() { this = [0 .. 10] }
|
SmallInt() { this = [0 .. 10] }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Location extends @location {
|
class Location extends @location_default {
|
||||||
string toString() { result = "" }
|
string toString() { result = "" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ private string locationToString(Location loc) {
|
|||||||
*
|
*
|
||||||
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
* For more information about locations see [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||||
*/
|
*/
|
||||||
class Location extends @location {
|
class Location extends @location_default {
|
||||||
/** Gets the file for this location. */
|
/** Gets the file for this location. */
|
||||||
File getFile() { locations_default(this, result, _, _, _, _) }
|
File getFile() { locations_default(this, result, _, _, _, _) }
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
// CodeQL database schema for Ruby
|
// CodeQL database schema for Ruby
|
||||||
// Automatically generated from the tree-sitter grammar; do not edit
|
// Automatically generated from the tree-sitter grammar; do not edit
|
||||||
|
|
||||||
@location = @location_default
|
/*- Files and folders -*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of an element.
|
||||||
|
* The location spans column `startcolumn` of line `startline` to
|
||||||
|
* column `endcolumn` of line `endline` in file `file`.
|
||||||
|
* For more information, see
|
||||||
|
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||||
|
*/
|
||||||
locations_default(
|
locations_default(
|
||||||
unique int id: @location_default,
|
unique int id: @location_default,
|
||||||
int file: @file ref,
|
int file: @file ref,
|
||||||
int start_line: int ref,
|
int beginLine: int ref,
|
||||||
int start_column: int ref,
|
int beginColumn: int ref,
|
||||||
int end_line: int ref,
|
int endLine: int ref,
|
||||||
int end_column: int ref
|
int endColumn: int ref
|
||||||
);
|
);
|
||||||
|
|
||||||
files(
|
files(
|
||||||
@@ -29,9 +36,14 @@ containerparent(
|
|||||||
unique int child: @container ref
|
unique int child: @container ref
|
||||||
);
|
);
|
||||||
|
|
||||||
sourceLocationPrefix(
|
/*- Source location prefix -*/
|
||||||
string prefix: string ref
|
|
||||||
);
|
/**
|
||||||
|
* The source location of the snapshot.
|
||||||
|
*/
|
||||||
|
sourceLocationPrefix(string prefix : string ref);
|
||||||
|
|
||||||
|
/*- Diagnostic messages -*/
|
||||||
|
|
||||||
diagnostics(
|
diagnostics(
|
||||||
unique int id: @diagnostic,
|
unique int id: @diagnostic,
|
||||||
@@ -42,14 +54,15 @@ diagnostics(
|
|||||||
int location: @location_default ref
|
int location: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Diagnostic messages: severity -*/
|
||||||
|
|
||||||
case @diagnostic.severity of
|
case @diagnostic.severity of
|
||||||
10 = @diagnostic_debug
|
10 = @diagnostic_debug
|
||||||
| 20 = @diagnostic_info
|
| 20 = @diagnostic_info
|
||||||
| 30 = @diagnostic_warning
|
| 30 = @diagnostic_warning
|
||||||
| 40 = @diagnostic_error
|
| 40 = @diagnostic_error
|
||||||
;
|
;
|
||||||
|
/*- Ruby dbscheme -*/
|
||||||
|
|
||||||
@ruby_underscore_arg = @ruby_assignment | @ruby_binary | @ruby_conditional | @ruby_operator_assignment | @ruby_range | @ruby_unary | @ruby_underscore_primary
|
@ruby_underscore_arg = @ruby_assignment | @ruby_binary | @ruby_conditional | @ruby_operator_assignment | @ruby_range | @ruby_unary | @ruby_underscore_primary
|
||||||
|
|
||||||
@ruby_underscore_call_operator = @ruby_reserved_word
|
@ruby_underscore_call_operator = @ruby_reserved_word
|
||||||
@@ -1375,9 +1388,10 @@ ruby_ast_node_info(
|
|||||||
unique int node: @ruby_ast_node ref,
|
unique int node: @ruby_ast_node ref,
|
||||||
int parent: @ruby_ast_node_parent ref,
|
int parent: @ruby_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Erb dbscheme -*/
|
||||||
erb_comment_directive_child(
|
erb_comment_directive_child(
|
||||||
unique int erb_comment_directive: @erb_comment_directive ref,
|
unique int erb_comment_directive: @erb_comment_directive ref,
|
||||||
unique int child: @erb_token_comment ref
|
unique int child: @erb_token_comment ref
|
||||||
@@ -1450,6 +1464,6 @@ erb_ast_node_info(
|
|||||||
unique int node: @erb_ast_node ref,
|
unique int node: @erb_ast_node ref,
|
||||||
int parent: @erb_ast_node_parent ref,
|
int parent: @erb_ast_node_parent ref,
|
||||||
int parent_index: int ref,
|
int parent_index: int ref,
|
||||||
int loc: @location ref
|
int loc: @location_default ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -2636,19 +2636,19 @@
|
|||||||
<v>17807</v>
|
<v>17807</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>start_line</k>
|
<k>startLine</k>
|
||||||
<v>30866</v>
|
<v>30866</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>start_column</k>
|
<k>startColumn</k>
|
||||||
<v>5140</v>
|
<v>5140</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>end_line</k>
|
<k>endLine</k>
|
||||||
<v>30866</v>
|
<v>30866</v>
|
||||||
</e>
|
</e>
|
||||||
<e>
|
<e>
|
||||||
<k>end_column</k>
|
<k>endColumn</k>
|
||||||
<v>5244</v>
|
<v>5244</v>
|
||||||
</e>
|
</e>
|
||||||
</columnsizes>
|
</columnsizes>
|
||||||
@@ -2671,7 +2671,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2687,7 +2687,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2703,7 +2703,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2719,7 +2719,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>id</src>
|
<src>id</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2811,7 +2811,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2887,7 +2887,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -2963,7 +2963,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3039,7 +3039,7 @@
|
|||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>file</src>
|
<src>file</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3114,7 +3114,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3195,7 +3195,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3251,8 +3251,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3332,8 +3332,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3383,8 +3383,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_line</src>
|
<src>startLine</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3464,7 +3464,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3545,7 +3545,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3606,8 +3606,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3677,8 +3677,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3748,8 +3748,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>start_column</src>
|
<src>startColumn</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3809,7 +3809,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3890,7 +3890,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -3946,8 +3946,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -3997,8 +3997,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -4073,8 +4073,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_line</src>
|
<src>endLine</src>
|
||||||
<trg>end_column</trg>
|
<trg>endColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -4154,7 +4154,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>id</trg>
|
<trg>id</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -4235,7 +4235,7 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>file</trg>
|
<trg>file</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
@@ -4296,8 +4296,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>start_line</trg>
|
<trg>startLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -4367,8 +4367,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>start_column</trg>
|
<trg>startColumn</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
@@ -4438,8 +4438,8 @@
|
|||||||
</val>
|
</val>
|
||||||
</dep>
|
</dep>
|
||||||
<dep>
|
<dep>
|
||||||
<src>end_column</src>
|
<src>endColumn</src>
|
||||||
<trg>end_line</trg>
|
<trg>endLine</trg>
|
||||||
<val>
|
<val>
|
||||||
<hist>
|
<hist>
|
||||||
<budget>12</budget>
|
<budget>12</budget>
|
||||||
|
|||||||
@@ -30,21 +30,7 @@ pub fn generate(
|
|||||||
languages[0].name
|
languages[0].name
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (diagnostics_case, diagnostics_table) = create_diagnostics();
|
write!(dbscheme_writer, include_str!("prefix.dbscheme"))?;
|
||||||
dbscheme::write(
|
|
||||||
&mut dbscheme_writer,
|
|
||||||
&[
|
|
||||||
create_location_union(),
|
|
||||||
create_locations_default_table(),
|
|
||||||
create_files_table(),
|
|
||||||
create_folders_table(),
|
|
||||||
create_container_union(),
|
|
||||||
create_containerparent_table(),
|
|
||||||
create_source_location_prefix_table(),
|
|
||||||
dbscheme::Entry::Table(diagnostics_table),
|
|
||||||
dbscheme::Entry::Case(diagnostics_case),
|
|
||||||
],
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
|
let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
|
||||||
write!(
|
write!(
|
||||||
@@ -74,6 +60,7 @@ pub fn generate(
|
|||||||
let nodes = node_types::read_node_types_str(&prefix, language.node_types)?;
|
let nodes = node_types::read_node_types_str(&prefix, language.node_types)?;
|
||||||
let (dbscheme_entries, mut ast_node_members, token_kinds) = convert_nodes(&nodes);
|
let (dbscheme_entries, mut ast_node_members, token_kinds) = convert_nodes(&nodes);
|
||||||
ast_node_members.insert(&token_name);
|
ast_node_members.insert(&token_name);
|
||||||
|
write!(&mut dbscheme_writer, "/*- {} dbscheme -*/\n", language.name)?;
|
||||||
dbscheme::write(&mut dbscheme_writer, &dbscheme_entries)?;
|
dbscheme::write(&mut dbscheme_writer, &dbscheme_entries)?;
|
||||||
let token_case = create_token_case(&token_name, token_kinds);
|
let token_case = create_token_case(&token_name, token_kinds);
|
||||||
dbscheme::write(
|
dbscheme::write(
|
||||||
@@ -388,7 +375,7 @@ fn create_ast_node_info_table<'a>(
|
|||||||
unique: false,
|
unique: false,
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
db_type: dbscheme::DbColumnType::Int,
|
||||||
name: "loc",
|
name: "loc",
|
||||||
ql_type: ql::Type::At("location"),
|
ql_type: ql::Type::At("location_default"),
|
||||||
ql_type_is_ref: true,
|
ql_type_is_ref: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -437,213 +424,3 @@ fn create_token_case<'a>(name: &'a str, token_kinds: Map<&'a str, usize>) -> dbs
|
|||||||
branches,
|
branches,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_location_union<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Union(dbscheme::Union {
|
|
||||||
name: "location",
|
|
||||||
members: vec!["location_default"].into_iter().collect(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_files_table<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Table(dbscheme::Table {
|
|
||||||
name: "files",
|
|
||||||
keysets: None,
|
|
||||||
columns: vec![
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: true,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "id",
|
|
||||||
ql_type: ql::Type::At("file"),
|
|
||||||
ql_type_is_ref: false,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "name",
|
|
||||||
unique: false,
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
fn create_folders_table<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Table(dbscheme::Table {
|
|
||||||
name: "folders",
|
|
||||||
keysets: None,
|
|
||||||
columns: vec![
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: true,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "id",
|
|
||||||
ql_type: ql::Type::At("folder"),
|
|
||||||
ql_type_is_ref: false,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "name",
|
|
||||||
unique: false,
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_locations_default_table<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Table(dbscheme::Table {
|
|
||||||
name: "locations_default",
|
|
||||||
keysets: None,
|
|
||||||
columns: vec![
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: true,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "id",
|
|
||||||
ql_type: ql::Type::At("location_default"),
|
|
||||||
ql_type_is_ref: false,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "file",
|
|
||||||
ql_type: ql::Type::At("file"),
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "start_line",
|
|
||||||
ql_type: ql::Type::Int,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "start_column",
|
|
||||||
ql_type: ql::Type::Int,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "end_line",
|
|
||||||
ql_type: ql::Type::Int,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "end_column",
|
|
||||||
ql_type: ql::Type::Int,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_container_union<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Union(dbscheme::Union {
|
|
||||||
name: "container",
|
|
||||||
members: vec!["folder", "file"].into_iter().collect(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_containerparent_table<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Table(dbscheme::Table {
|
|
||||||
name: "containerparent",
|
|
||||||
columns: vec![
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "parent",
|
|
||||||
ql_type: ql::Type::At("container"),
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: true,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "child",
|
|
||||||
ql_type: ql::Type::At("container"),
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
keysets: None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_source_location_prefix_table<'a>() -> dbscheme::Entry<'a> {
|
|
||||||
dbscheme::Entry::Table(dbscheme::Table {
|
|
||||||
name: "sourceLocationPrefix",
|
|
||||||
keysets: None,
|
|
||||||
columns: vec![dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "prefix",
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
}],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_diagnostics<'a>() -> (dbscheme::Case<'a>, dbscheme::Table<'a>) {
|
|
||||||
let table = dbscheme::Table {
|
|
||||||
name: "diagnostics",
|
|
||||||
keysets: None,
|
|
||||||
columns: vec![
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: true,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "id",
|
|
||||||
ql_type: ql::Type::At("diagnostic"),
|
|
||||||
ql_type_is_ref: false,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "severity",
|
|
||||||
ql_type: ql::Type::Int,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "error_tag",
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "error_message",
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::String,
|
|
||||||
name: "full_error_message",
|
|
||||||
ql_type: ql::Type::String,
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
dbscheme::Column {
|
|
||||||
unique: false,
|
|
||||||
db_type: dbscheme::DbColumnType::Int,
|
|
||||||
name: "location",
|
|
||||||
ql_type: ql::Type::At("location_default"),
|
|
||||||
ql_type_is_ref: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
let severities: Vec<(usize, &str)> = vec![
|
|
||||||
(10, "diagnostic_debug"),
|
|
||||||
(20, "diagnostic_info"),
|
|
||||||
(30, "diagnostic_warning"),
|
|
||||||
(40, "diagnostic_error"),
|
|
||||||
];
|
|
||||||
let case = dbscheme::Case {
|
|
||||||
name: "diagnostic",
|
|
||||||
column: "severity",
|
|
||||||
branches: severities,
|
|
||||||
};
|
|
||||||
(case, table)
|
|
||||||
}
|
|
||||||
|
|||||||
61
shared/tree-sitter-extractor/src/generator/prefix.dbscheme
Normal file
61
shared/tree-sitter-extractor/src/generator/prefix.dbscheme
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*- Files and folders -*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The location of an element.
|
||||||
|
* The location spans column `startcolumn` of line `startline` to
|
||||||
|
* column `endcolumn` of line `endline` in file `file`.
|
||||||
|
* For more information, see
|
||||||
|
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
|
||||||
|
*/
|
||||||
|
locations_default(
|
||||||
|
unique int id: @location_default,
|
||||||
|
int file: @file ref,
|
||||||
|
int beginLine: int ref,
|
||||||
|
int beginColumn: int ref,
|
||||||
|
int endLine: int ref,
|
||||||
|
int endColumn: int ref
|
||||||
|
);
|
||||||
|
|
||||||
|
files(
|
||||||
|
unique int id: @file,
|
||||||
|
string name: string ref
|
||||||
|
);
|
||||||
|
|
||||||
|
folders(
|
||||||
|
unique int id: @folder,
|
||||||
|
string name: string ref
|
||||||
|
);
|
||||||
|
|
||||||
|
@container = @file | @folder
|
||||||
|
|
||||||
|
containerparent(
|
||||||
|
int parent: @container ref,
|
||||||
|
unique int child: @container ref
|
||||||
|
);
|
||||||
|
|
||||||
|
/*- Source location prefix -*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The source location of the snapshot.
|
||||||
|
*/
|
||||||
|
sourceLocationPrefix(string prefix : string ref);
|
||||||
|
|
||||||
|
/*- Diagnostic messages -*/
|
||||||
|
|
||||||
|
diagnostics(
|
||||||
|
unique int id: @diagnostic,
|
||||||
|
int severity: int ref,
|
||||||
|
string error_tag: string ref,
|
||||||
|
string error_message: string ref,
|
||||||
|
string full_error_message: string ref,
|
||||||
|
int location: @location_default ref
|
||||||
|
);
|
||||||
|
|
||||||
|
/*- Diagnostic messages: severity -*/
|
||||||
|
|
||||||
|
case @diagnostic.severity of
|
||||||
|
10 = @diagnostic_debug
|
||||||
|
| 20 = @diagnostic_info
|
||||||
|
| 30 = @diagnostic_warning
|
||||||
|
| 40 = @diagnostic_error
|
||||||
|
;
|
||||||
Reference in New Issue
Block a user