Tree-sitter extractor: extract shared dbscheme fragments into 'prefix.dbscheme'

This commit is contained in:
Arthur Baars
2023-04-20 20:00:20 +02:00
parent 2911a6cc30
commit 9f83dd5c7a
10 changed files with 226 additions and 346 deletions

View File

@@ -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/).
*/
class Location extends @location {
class Location extends @location_default {
/** Gets the file for this location. */
File getFile() { locations_default(this, result, _, _, _, _) }

View File

@@ -1,15 +1,22 @@
// CodeQL database schema for Ruby
// 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(
unique int id: @location_default,
int file: @file ref,
int start_line: int ref,
int start_column: int ref,
int end_line: int ref,
int end_column: int ref
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref
);
files(
@@ -29,9 +36,14 @@ containerparent(
unique int child: @container ref
);
sourceLocationPrefix(
string prefix: string ref
);
/*- Source location prefix -*/
/**
* The source location of the snapshot.
*/
sourceLocationPrefix(string prefix : string ref);
/*- Diagnostic messages -*/
diagnostics(
unique int id: @diagnostic,
@@ -42,14 +54,15 @@ diagnostics(
int location: @location_default ref
);
/*- Diagnostic messages: severity -*/
case @diagnostic.severity of
10 = @diagnostic_debug
| 20 = @diagnostic_info
| 30 = @diagnostic_warning
| 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_call_operator = @ruby_reserved_word
@@ -1375,9 +1388,10 @@ ruby_ast_node_info(
unique int node: @ruby_ast_node ref,
int parent: @ruby_ast_node_parent ref,
int parent_index: int ref,
int loc: @location ref
int loc: @location_default ref
);
/*- Erb dbscheme -*/
erb_comment_directive_child(
unique int erb_comment_directive: @erb_comment_directive ref,
unique int child: @erb_token_comment ref
@@ -1450,6 +1464,6 @@ erb_ast_node_info(
unique int node: @erb_ast_node ref,
int parent: @erb_ast_node_parent ref,
int parent_index: int ref,
int loc: @location ref
int loc: @location_default ref
);

View File

@@ -2636,19 +2636,19 @@
<v>17807</v>
</e>
<e>
<k>start_line</k>
<k>startLine</k>
<v>30866</v>
</e>
<e>
<k>start_column</k>
<k>startColumn</k>
<v>5140</v>
</e>
<e>
<k>end_line</k>
<k>endLine</k>
<v>30866</v>
</e>
<e>
<k>end_column</k>
<k>endColumn</k>
<v>5244</v>
</e>
</columnsizes>
@@ -2671,7 +2671,7 @@
</dep>
<dep>
<src>id</src>
<trg>start_line</trg>
<trg>startLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -2687,7 +2687,7 @@
</dep>
<dep>
<src>id</src>
<trg>start_column</trg>
<trg>startColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -2703,7 +2703,7 @@
</dep>
<dep>
<src>id</src>
<trg>end_line</trg>
<trg>endLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -2719,7 +2719,7 @@
</dep>
<dep>
<src>id</src>
<trg>end_column</trg>
<trg>endColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -2811,7 +2811,7 @@
</dep>
<dep>
<src>file</src>
<trg>start_line</trg>
<trg>startLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -2887,7 +2887,7 @@
</dep>
<dep>
<src>file</src>
<trg>start_column</trg>
<trg>startColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -2963,7 +2963,7 @@
</dep>
<dep>
<src>file</src>
<trg>end_line</trg>
<trg>endLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -3039,7 +3039,7 @@
</dep>
<dep>
<src>file</src>
<trg>end_column</trg>
<trg>endColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -3114,7 +3114,7 @@
</val>
</dep>
<dep>
<src>start_line</src>
<src>startLine</src>
<trg>id</trg>
<val>
<hist>
@@ -3195,7 +3195,7 @@
</val>
</dep>
<dep>
<src>start_line</src>
<src>startLine</src>
<trg>file</trg>
<val>
<hist>
@@ -3251,8 +3251,8 @@
</val>
</dep>
<dep>
<src>start_line</src>
<trg>start_column</trg>
<src>startLine</src>
<trg>startColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -3332,8 +3332,8 @@
</val>
</dep>
<dep>
<src>start_line</src>
<trg>end_line</trg>
<src>startLine</src>
<trg>endLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -3383,8 +3383,8 @@
</val>
</dep>
<dep>
<src>start_line</src>
<trg>end_column</trg>
<src>startLine</src>
<trg>endColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -3464,7 +3464,7 @@
</val>
</dep>
<dep>
<src>start_column</src>
<src>startColumn</src>
<trg>id</trg>
<val>
<hist>
@@ -3545,7 +3545,7 @@
</val>
</dep>
<dep>
<src>start_column</src>
<src>startColumn</src>
<trg>file</trg>
<val>
<hist>
@@ -3606,8 +3606,8 @@
</val>
</dep>
<dep>
<src>start_column</src>
<trg>start_line</trg>
<src>startColumn</src>
<trg>startLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -3677,8 +3677,8 @@
</val>
</dep>
<dep>
<src>start_column</src>
<trg>end_line</trg>
<src>startColumn</src>
<trg>endLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -3748,8 +3748,8 @@
</val>
</dep>
<dep>
<src>start_column</src>
<trg>end_column</trg>
<src>startColumn</src>
<trg>endColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -3809,7 +3809,7 @@
</val>
</dep>
<dep>
<src>end_line</src>
<src>endLine</src>
<trg>id</trg>
<val>
<hist>
@@ -3890,7 +3890,7 @@
</val>
</dep>
<dep>
<src>end_line</src>
<src>endLine</src>
<trg>file</trg>
<val>
<hist>
@@ -3946,8 +3946,8 @@
</val>
</dep>
<dep>
<src>end_line</src>
<trg>start_line</trg>
<src>endLine</src>
<trg>startLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -3997,8 +3997,8 @@
</val>
</dep>
<dep>
<src>end_line</src>
<trg>start_column</trg>
<src>endLine</src>
<trg>startColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -4073,8 +4073,8 @@
</val>
</dep>
<dep>
<src>end_line</src>
<trg>end_column</trg>
<src>endLine</src>
<trg>endColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -4154,7 +4154,7 @@
</val>
</dep>
<dep>
<src>end_column</src>
<src>endColumn</src>
<trg>id</trg>
<val>
<hist>
@@ -4235,7 +4235,7 @@
</val>
</dep>
<dep>
<src>end_column</src>
<src>endColumn</src>
<trg>file</trg>
<val>
<hist>
@@ -4296,8 +4296,8 @@
</val>
</dep>
<dep>
<src>end_column</src>
<trg>start_line</trg>
<src>endColumn</src>
<trg>startLine</trg>
<val>
<hist>
<budget>12</budget>
@@ -4367,8 +4367,8 @@
</val>
</dep>
<dep>
<src>end_column</src>
<trg>start_column</trg>
<src>endColumn</src>
<trg>startColumn</trg>
<val>
<hist>
<budget>12</budget>
@@ -4438,8 +4438,8 @@
</val>
</dep>
<dep>
<src>end_column</src>
<trg>end_line</trg>
<src>endColumn</src>
<trg>endLine</trg>
<val>
<hist>
<budget>12</budget>