Skip to content

queries/highlights.scm:90 is malformed query syntax and fails to compile #81

Description

@Goldziher

queries/highlights.scm does not compile — line 90 is not valid tree-sitter query syntax.

Where

queries/highlights.scm:90:

(struct_expression type: ((expression(identifier)) @type .))
Query error at 90:58. Invalid syntax:
(struct_expression type: ((expression(identifier)) @type .))
                                                         ^

Note this is an Invalid syntax error, not an unknown-node error — the parser cannot even read the pattern. The inner ((expression(identifier)) @type .) is an extra parenthesised group wrapping a node pattern, with a capture and a trailing anchor attached to the group rather than to a node. A group in that position needs a leading node type.

Grammar side, for reference

grammar.js defines the field as holding a plain $.expression:

struct_expression: ... field("type", $.expression) "{" ... "}"

so the intended pattern is presumably along the lines of:

(struct_expression type: (expression (identifier) @type))

I have deliberately not opened a PR with that, because I can't tell from the query alone whether the trailing . anchor was load-bearing for your intent — you'll know better what it was meant to constrain.

Effect

Because a syntax error rejects the entire file, no highlighting from highlights.scm works at all for consumers that compile it.

Verified against 048fe686cb1fde267243739b8bdbec8fc3a55272 (current HEAD at the time of writing) — the bytes we vendor are identical to upstream, so this is not a transformation on our side. Found by a gate that compiles every bundled query across the 371 grammars we vendor in tree-sitter-language-pack.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions