Skip to content

Commit

Permalink
Tree-sitter: Bump to 0.22.5
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed May 6, 2024
1 parent f7113e0 commit e4aba2a
Show file tree
Hide file tree
Showing 17 changed files with 236 additions and 171 deletions.
2 changes: 1 addition & 1 deletion python/extractor/tsg-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = ["Taus Brock-Nannestad <[email protected]>"]
edition = "2018"

# When changing/updating these, the `Cargo.Bazel.lock` file has to be regenerated.
# Run `CARGO_BAZEL_REPIN=true CARGO_BAZEL_REPIN_ONLY=py_deps ./build --bazel sync --only=py_deps`
# Run `CARGO_BAZEL_REPIN=true CARGO_BAZEL_REPIN_ONLY=py_deps ./tools/bazel sync --only=py_deps`
# in the `semmle-code` repository to do so.
# For more information, check out the documentation at
# https://bazelbuild.github.io/rules_rust/crate_universe.html#repinning--updating-dependencies
Expand Down
2 changes: 1 addition & 1 deletion python/extractor/tsg-python/rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# extractor. It is set to the lowest version of Rust we want to support.

[toolchain]
channel = "1.68"
channel = "1.70"
profile = "minimal"
components = [ "rustfmt" ]
18 changes: 9 additions & 9 deletions ql/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ql/buramu/tree-sitter-blame/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include = [
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "~0.20.3"
tree-sitter = "0.22.5"

[build-dependencies]
cc = "1.0"
8 changes: 4 additions & 4 deletions ql/extractor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tree-sitter = ">= 0.20, < 0.21"
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "d08db734f8dc52f6bc04db53a966603122bc6985"}
tree-sitter-ql-dbscheme = { git = "https://github.com/erik-krogh/tree-sitter-ql-dbscheme.git", rev = "63e1344353f63931e88bfbc2faa2e78e1421b213"}
tree-sitter = "0.22.5"
tree-sitter-ql = { git = "https://github.com/tree-sitter/tree-sitter-ql.git", rev = "fa5c3821dd2161f5c8528a8cbdb258daa6dc4de6"}
tree-sitter-ql-dbscheme = { git = "https://github.com/tree-sitter/tree-sitter-ql-dbscheme.git", rev = "5f770f57fa415607ff50e3d237d47c8f11440eb3"}
tree-sitter-blame = {path = "../buramu/tree-sitter-blame"}
tree-sitter-json = {git = "https://github.com/tausbn/tree-sitter-json.git", rev = "745663ee997f1576fe1e7187e6347e0db36ec7a9"}
tree-sitter-json = {git = "https://github.com/tree-sitter/tree-sitter-json.git", rev = "80e623c2165887f9829357acfa9c0a0bab34a3cd"}
clap = { version = "4.2", features = ["derive"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
28 changes: 20 additions & 8 deletions ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1767,13 +1767,15 @@ module JSON {
final override string getAPrimaryQlClass() { result = "ReservedWord" }
}

class UnderscoreValue extends @json_underscore_value, AstNode { }

/** A class representing `array` nodes. */
class Array extends @json_array, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "Array" }

/** Gets the `i`th child of this node. */
final Value getChild(int i) { json_array_child(this, i, result) }
final UnderscoreValue getChild(int i) { json_array_child(this, i, result) }

/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { json_array_child(this, _, result) }
Expand All @@ -1791,12 +1793,18 @@ module JSON {
final override string getAPrimaryQlClass() { result = "Document" }

/** Gets the `i`th child of this node. */
final Value getChild(int i) { json_document_child(this, i, result) }
final UnderscoreValue getChild(int i) { json_document_child(this, i, result) }

/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { json_document_child(this, _, result) }
}

/** A class representing `escape_sequence` tokens. */
class EscapeSequence extends @json_token_escape_sequence, Token {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "EscapeSequence" }
}

/** A class representing `false` tokens. */
class False extends @json_token_false, Token {
/** Gets the name of the primary QL class for this element. */
Expand Down Expand Up @@ -1833,10 +1841,10 @@ module JSON {
final override string getAPrimaryQlClass() { result = "Pair" }

/** Gets the node corresponding to the field `key`. */
final AstNode getKey() { json_pair_def(this, result, _) }
final String getKey() { json_pair_def(this, result, _) }

/** Gets the node corresponding to the field `value`. */
final Value getValue() { json_pair_def(this, _, result) }
final UnderscoreValue getValue() { json_pair_def(this, _, result) }

/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() {
Expand All @@ -1856,17 +1864,21 @@ module JSON {
final override AstNode getAFieldOrChild() { json_string_child(this, result) }
}

/** A class representing `string_content` tokens. */
class StringContent extends @json_token_string_content, Token {
/** A class representing `string_content` nodes. */
class StringContent extends @json_string_content, AstNode {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "StringContent" }

/** Gets the `i`th child of this node. */
final EscapeSequence getChild(int i) { json_string_content_child(this, i, result) }

/** Gets a field or child node of this node. */
final override AstNode getAFieldOrChild() { json_string_content_child(this, _, result) }
}

/** A class representing `true` tokens. */
class True extends @json_token_true, Token {
/** Gets the name of the primary QL class for this element. */
final override string getAPrimaryQlClass() { result = "True" }
}

class Value extends @json_value, AstNode { }
}
35 changes: 22 additions & 13 deletions ql/ql/src/ql.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -1239,11 +1239,13 @@ blame_ast_node_parent(
);

/*- JSON dbscheme -*/
@json_underscore_value = @json_array | @json_object | @json_string__ | @json_token_false | @json_token_null | @json_token_number | @json_token_true

#keyset[json_array, index]
json_array_child(
int json_array: @json_array ref,
int index: int ref,
unique int child: @json_value ref
unique int child: @json_underscore_value ref
);

json_array_def(
Expand All @@ -1254,7 +1256,7 @@ json_array_def(
json_document_child(
int json_document: @json_document ref,
int index: int ref,
unique int child: @json_value ref
unique int child: @json_underscore_value ref
);

json_document_def(
Expand All @@ -1272,24 +1274,31 @@ json_object_def(
unique int id: @json_object
);

@json_pair_key_type = @json_string__ | @json_token_number

json_pair_def(
unique int id: @json_pair,
int key__: @json_pair_key_type ref,
int value: @json_value ref
int key__: @json_string__ ref,
int value: @json_underscore_value ref
);

json_string_child(
unique int json_string__: @json_string__ ref,
unique int child: @json_token_string_content ref
unique int child: @json_string_content ref
);

json_string_def(
unique int id: @json_string__
);

@json_value = @json_array | @json_object | @json_string__ | @json_token_false | @json_token_null | @json_token_number | @json_token_true
#keyset[json_string_content, index]
json_string_content_child(
int json_string_content: @json_string_content ref,
int index: int ref,
unique int child: @json_token_escape_sequence ref
);

json_string_content_def(
unique int id: @json_string_content
);

json_tokeninfo(
unique int id: @json_token,
Expand All @@ -1300,15 +1309,15 @@ json_tokeninfo(
case @json_token.kind of
0 = @json_reserved_word
| 1 = @json_token_comment
| 2 = @json_token_false
| 3 = @json_token_null
| 4 = @json_token_number
| 5 = @json_token_string_content
| 2 = @json_token_escape_sequence
| 3 = @json_token_false
| 4 = @json_token_null
| 5 = @json_token_number
| 6 = @json_token_true
;


@json_ast_node = @json_array | @json_document | @json_object | @json_pair | @json_string__ | @json_token
@json_ast_node = @json_array | @json_document | @json_object | @json_pair | @json_string__ | @json_string_content | @json_token

json_ast_node_location(
unique int node: @json_ast_node ref,
Expand Down
4 changes: 2 additions & 2 deletions ql/rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# extractor. It is set to the lowest version of Rust we want to support.

[toolchain]
channel = "1.68"
channel = "1.70"
profile = "minimal"
components = [ "rustfmt" ]
components = [ "rustfmt" ]
Loading

0 comments on commit e4aba2a

Please sign in to comment.