tree-sitter-bash icon indicating copy to clipboard operation
tree-sitter-bash copied to clipboard

Semicolon causes ERROR in Parameter Expansion

Open jbdyn opened this issue 8 months ago • 0 comments

Hi!

First of all, thank you all for your amazing work and precious time. :heart:

When using a semicolon ; in a parameter expansion, it causes a parsing ERROR, although it should not:

From playground :

Example 1

In:

${a:+$a;}

Out:

program [0, 0] - [1, 0]
  ERROR [0, 0] - [0, 9]
    variable_name [0, 2] - [0, 3]
    simple_expansion [0, 5] - [0, 7]
      variable_name [0, 6] - [0, 7]

Example 2

In (note the space after ;:

${a:+$a; }

Out:

program [0, 0] - [1, 0]
  command [0, 0] - [0, 10]
    name: command_name [0, 0] - [0, 10]
      expansion [0, 0] - [0, 10]
        variable_name [0, 2] - [0, 3]
        concatenation [0, 5] - [0, 9]
          simple_expansion [0, 5] - [0, 7]
            variable_name [0, 6] - [0, 7]
          ERROR [0, 7] - [0, 8]
          word [0, 8] - [0, 9]

The error occurs also when ; is not the last character in the default word. When ; is a prefix or suffix pattern, it seems to be fine.

jbdyn avatar Jun 24 '24 12:06 jbdyn