Skip to content

Parsing error when using reserved keywords in text_macro_usage #45

@gmlarumbe

Description

@gmlarumbe

According to tree-sitter doc:

Reserved Keywords : reserved(wordset, rule) — This function will override the 
global reserved word set with the one passed into the wordset parameter. 
This is useful for contextual keywords, such as if in JavaScript, 
hich cannot be used as a variable name in most contexts, 
but can be used as a property name.

And taking tree-sitter/tree-sitter#3896 (comment) as a reference:

After commit 78ddb99 the global reserved wordset has been replaced with macros which is empty:

  formal_argument: $ => reserved('macros', seq(
    $.simple_identifier,
    optseq('=', optchoice($.default_text, $.string_literal, $.tf_call, $.text_macro_usage, $.simple_identifier)),
  )),

  text_macro_identifier: $ => reserved('macros', $._identifier),

  text_macro_usage: $ => prec.right(seq(
    '`',
    $.text_macro_identifier,
    reserved('macros', optseq('(', optional($.list_of_actual_arguments), ')'))
  )),

However the following snippets result in parsing errors:

`module(foo)
`foo(module)

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