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

Command subsisution with backticks is incorrectly parsed when theres a space after the tick #278

Open
ire4ever1190 opened this issue Nov 11, 2024 · 0 comments

Comments

@ire4ever1190
Copy link

This example code here

echo `echo "foo"`

echo `echo "bar"`

gets correctly parsed as

program [0, 0] - [3, 0]
  command [0, 0] - [0, 17]
    name: command_name [0, 0] - [0, 4]
      word [0, 0] - [0, 4]
    argument: command_substitution [0, 5] - [0, 17]
      command [0, 6] - [0, 16]
        name: command_name [0, 6] - [0, 10]
          word [0, 6] - [0, 10]
        argument: string [0, 11] - [0, 16]
          string_content [0, 12] - [0, 15]
  command [2, 0] - [2, 17]
    name: command_name [2, 0] - [2, 4]
      word [2, 0] - [2, 4]
    argument: command_substitution [2, 5] - [2, 17]
      command [2, 6] - [2, 16]
        name: command_name [2, 6] - [2, 10]
          word [2, 6] - [2, 10]
        argument: string [2, 11] - [2, 16]
          string_content [2, 12] - [2, 15]

but if a space is added in the backtick on the second line then it gets incorrectly parsed

echo `echo "foo"`

echo ` echo "bar"`
program [0, 0] - [3, 0]
  command [0, 0] - [2, 18]
    name: command_name [0, 0] - [0, 4]
      word [0, 0] - [0, 4]
    # Now the substitution continues onto the second line of code instead of ending at the first
    argument: command_substitution [0, 5] - [2, 18]
      command [0, 6] - [2, 17]
        name: command_name [0, 6] - [0, 10]
          word [0, 6] - [0, 10]
        argument: concatenation [0, 11] - [2, 6]
          string [0, 11] - [0, 16]
            string_content [0, 12] - [0, 15]
          command_substitution [0, 16] - [2, 6]
            command [2, 0] - [2, 4]
              name: command_name [2, 0] - [2, 4]
                word [2, 0] - [2, 4]
        argument: word [2, 7] - [2, 11]
        argument: string [2, 12] - [2, 17]
          string_content [2, 13] - [2, 16]
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

1 participant