surrealdb / surrealql-grammar

SurrealQL grammar definition for TextMate, VSCode, and other IDEs

Home Page:https://surrealdb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Grammar fallthrough

knackstedt opened this issue · comments

Describe the bug

When parsing the SurrealQL code below, the parser doesn't correctly parse some keywords like CONTAINS, and parsed array::concat incorrectly.

DEFINE FUNCTION fn::task_get_environment($task: any /*record(pipelineTask)*/) {

    LET $taskGroup = (SELECT * FROM pipelineTaskGroup WHERE tasks CONTAINS $task LIMIT 1)[0];

    RETURN array::concat(
        ($taskGroup.environment OR []),
        ($task.environment OR [])
    );
};

VSCode doesn't tokenize CONTAINS, and array::concat is tokenized differently than it normally is, where the entire segment array::concat normally is tokenized as support.function but is instead tokenized as both meta.object-literal and basic.

Steps to reproduce

  • Open an editor that uses the Textmate grammar. I used VSCode.
  • Paste in the SurrealQL code I provided
  • Inspect tokens on CONTAINS and array::concat and observe they are tokenized incorrectly

Expected behaviour

CONTAINS should be tokenized as keyword.control and array::concat should be tokenized as support.function

Grammar version
v0.2.3

Contact Details
andrewk@vivaldi.net

Is there an existing issue for this?

  • I have searched the existing issues
    Code of Conduct
  • I agree to follow this project's Code of Conduct