Skip to content

Commit 5f1e373

Browse files
authored
Merge pull request #30 from github/string_contents
Get latest fixes from tree-sitter-ruby repo
2 parents aec9974 + 81ceb22 commit 5f1e373

6 files changed

Lines changed: 34 additions & 34 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
- name: Install rustfmt
2424
run: rustup component add rustfmt --toolchain stable-x86_64-apple-darwin
2525
if: ${{ matrix.os == 'macos-latest' }}
26-
- name: Check formatting
27-
run: cargo fmt --all -- --check
2826
- uses: actions/cache@v2
2927
with:
3028
path: |
3129
~/.cargo/registry
3230
~/.cargo/git
3331
target
34-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
32+
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
- name: Check formatting
34+
run: cargo fmt --all -- --check
3535
- name: Build
3636
run: cargo build --verbose
3737
- name: Run tests

Cargo.lock

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

extractor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
flate2 = "1.0"
1111
node-types = { path = "../node-types" }
1212
tree-sitter = "0.17"
13-
tree-sitter-ruby = "0.17"
13+
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git" }
1414
clap = "2.33"
1515
tracing = "0.1"
1616
tracing-subscriber = { version = "0.2", features = ["env-filter"] }

generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ edition = "2018"
1010
node-types = { path = "../node-types" }
1111
tracing = "0.1"
1212
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
13-
tree-sitter-ruby = "0.17"
13+
tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git" }

ql/src/codeql_ruby/ast.qll

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,9 @@ class Else extends @else, AstNode, BeginChildType, CaseChildType, ClassChildType
400400

401401
override Location getLocation() { else_def(this, result) }
402402

403-
Token getCondition() { else_condition(this, result) }
404-
405403
ElseChildType getChild(int i) { else_child(this, i, result) }
406404

407-
override AstNode getAFieldOrChild() {
408-
else_condition(this, result) or else_child(this, _, result)
409-
}
405+
override AstNode getAFieldOrChild() { else_child(this, _, result) }
410406
}
411407

412408
class ElsifAlternativeType extends @elsif_alternative_type, AstNode { }
@@ -1306,6 +1302,10 @@ class HeredocBeginning extends Token, @token_heredoc_beginning {
13061302
override string describeQlClass() { result = "HeredocBeginning" }
13071303
}
13081304

1305+
class HeredocContent extends Token, @token_heredoc_content {
1306+
override string describeQlClass() { result = "HeredocContent" }
1307+
}
1308+
13091309
class HeredocEnd extends Token, @token_heredoc_end {
13101310
override string describeQlClass() { result = "HeredocEnd" }
13111311
}
@@ -1334,6 +1334,10 @@ class Self extends Token, @token_self {
13341334
override string describeQlClass() { result = "Self" }
13351335
}
13361336

1337+
class StringContent extends Token, @token_string_content {
1338+
override string describeQlClass() { result = "StringContent" }
1339+
}
1340+
13371341
class Super extends Token, @token_super {
13381342
override string describeQlClass() { result = "Super" }
13391343
}

ql/src/ruby.dbscheme

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ assignment_def(
104104
int loc: @location ref
105105
);
106106

107-
@bare_string_child_type = @interpolation | @token_escape_sequence
107+
@bare_string_child_type = @interpolation | @token_escape_sequence | @token_string_content
108108

109109
#keyset[bare_string, index]
110110
bare_string_child(
@@ -118,7 +118,7 @@ bare_string_def(
118118
int loc: @location ref
119119
);
120120

121-
@bare_symbol_child_type = @interpolation | @token_escape_sequence
121+
@bare_symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content
122122

123123
#keyset[bare_symbol, index]
124124
bare_symbol_child(
@@ -362,11 +362,6 @@ element_reference_def(
362362
int loc: @location ref
363363
);
364364

365-
else_condition(
366-
unique int else: @else ref,
367-
unique int reserved_word: @reserved_word ref
368-
);
369-
370365
@else_child_type = @token_empty_statement | @underscore_statement
371366

372367
#keyset[else, index]
@@ -493,7 +488,7 @@ hash_splat_parameter_def(
493488
int loc: @location ref
494489
);
495490

496-
@heredoc_body_child_type = @interpolation | @token_escape_sequence | @token_heredoc_end
491+
@heredoc_body_child_type = @interpolation | @token_escape_sequence | @token_heredoc_content | @token_heredoc_end
497492

498493
#keyset[heredoc_body, index]
499494
heredoc_body_child(
@@ -768,7 +763,7 @@ redo_def(
768763
int loc: @location ref
769764
);
770765

771-
@regex_child_type = @interpolation | @token_escape_sequence
766+
@regex_child_type = @interpolation | @token_escape_sequence | @token_string_content
772767

773768
#keyset[regex, index]
774769
regex_child(
@@ -928,7 +923,7 @@ splat_parameter_def(
928923
int loc: @location ref
929924
);
930925

931-
@string_child_type = @interpolation | @token_escape_sequence
926+
@string_child_type = @interpolation | @token_escape_sequence | @token_string_content
932927

933928
#keyset[string__, index]
934929
string_child(
@@ -954,7 +949,7 @@ string_array_def(
954949
int loc: @location ref
955950
);
956951

957-
@subshell_child_type = @interpolation | @token_escape_sequence
952+
@subshell_child_type = @interpolation | @token_escape_sequence | @token_string_content
958953

959954
#keyset[subshell, index]
960955
subshell_child(
@@ -976,7 +971,7 @@ superclass_def(
976971
int loc: @location ref
977972
);
978973

979-
@symbol_child_type = @interpolation | @token_escape_sequence
974+
@symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content
980975

981976
#keyset[symbol, index]
982977
symbol_child(
@@ -1146,16 +1141,18 @@ case @token.kind of
11461141
| 9 = @token_float
11471142
| 10 = @token_global_variable
11481143
| 11 = @token_heredoc_beginning
1149-
| 12 = @token_heredoc_end
1150-
| 13 = @token_identifier
1151-
| 14 = @token_instance_variable
1152-
| 15 = @token_integer
1153-
| 16 = @token_nil
1154-
| 17 = @token_operator
1155-
| 18 = @token_self
1156-
| 19 = @token_super
1157-
| 20 = @token_true
1158-
| 21 = @token_uninterpreted
1144+
| 12 = @token_heredoc_content
1145+
| 13 = @token_heredoc_end
1146+
| 14 = @token_identifier
1147+
| 15 = @token_instance_variable
1148+
| 16 = @token_integer
1149+
| 17 = @token_nil
1150+
| 18 = @token_operator
1151+
| 19 = @token_self
1152+
| 20 = @token_string_content
1153+
| 21 = @token_super
1154+
| 22 = @token_true
1155+
| 23 = @token_uninterpreted
11591156
;
11601157

11611158

0 commit comments

Comments
 (0)