Open avlec opened 9 months ago
Same here, trying to capture all the deps and versions in Cargo.toml
file using this query:
(document
(table [
;; capture the dependencies key and from simple:
;;
;; [dependencies]
;; $dep = $ver
;;
;; and capture from inline tables
;;
;; [dependencies]
;; $dep = { version = $ver }
((bare_key) @dependencies-key
(pair (bare_key) @dep
[
((string) @ver)
(inline_table (pair (bare_key) @ver-key
(string) @ver)+)
]))
;; capture the dependencies key large-like tables
;;
;; [dependencies.$dep]
;; version = $ver
((dotted_key (bare_key) @dependencies-key (bare_key) @dep)
(pair (bare_key) @ver-key
(string) @ver)+)
])
(.eq? @dependencies-key "dependencies")
(.eq? @ver-key "version"))
But getting the same error with the last line. May be I'm missing something
In my case, also, logs are refereing to:
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/runner/.cargo/git/checkouts/tree-sitter-ae9a8b878b09f085/475b822/lib/binding_rust/lib.rs:1833:72
Building queries like the following example which is for C++. Where the
storage_class_specifier
has zero or one (?
) OR zero or more (*
) matches throws a rust panic.Error: (rust-panic "Any { .. }")
Note that one or more (+
) works. I have only tested it for this case where there will be either one or none.