Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repetitions and Predicate Problems #269

Open
avlec opened this issue Feb 10, 2024 · 2 comments
Open

Repetitions and Predicate Problems #269

avlec opened this issue Feb 10, 2024 · 2 comments

Comments

@avlec
Copy link

avlec commented Feb 10, 2024

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.

(
    (declaration (storage_class_specifier)? @storage) @test
    (.not-eq? @storage "")
)
@Velnbur
Copy link

Velnbur commented Jul 9, 2024

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

@Velnbur
Copy link

Velnbur commented Jul 9, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants