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

issue with multiple assignments on same line #228

Open
lucy opened this issue Oct 23, 2023 · 1 comment
Open

issue with multiple assignments on same line #228

lucy opened this issue Oct 23, 2023 · 1 comment

Comments

@lucy
Copy link

lucy commented Oct 23, 2023

the if statement in

a= c=
b=
if true; then true; fi

gets parsed as a command name:

(program [0, 0] - [3, 0]
  (command [0, 0] - [2, 7]
    (variable_assignment [0, 0] - [0, 2]
      name: (variable_name [0, 0] - [0, 1]))
    (variable_assignment [0, 3] - [0, 5]
      name: (variable_name [0, 3] - [0, 4]))
    (variable_assignment [1, 0] - [1, 2]
      name: (variable_name [1, 0] - [1, 1]))
    name: (command_name [2, 0] - [2, 2]
      (word [2, 0] - [2, 2]))
    argument: (word [2, 3] - [2, 7]))
  (command [2, 9] - [2, 18]
    name: (command_name [2, 9] - [2, 13]
      (word [2, 9] - [2, 13]))
    argument: (word [2, 14] - [2, 18]))
  (command [2, 20] - [2, 22]
    name: (command_name [2, 20] - [2, 22]
      (word [2, 20] - [2, 22]))))

while

a= c= b=
if true; then true; fi

parses as an if_statement:

(program [0, 0] - [2, 0]
  (variable_assignments [0, 0] - [0, 8]
    (variable_assignment [0, 0] - [0, 2]
      name: (variable_name [0, 0] - [0, 1]))
    (variable_assignment [0, 3] - [0, 5]
      name: (variable_name [0, 3] - [0, 4]))
    (variable_assignment [0, 6] - [0, 8]
      name: (variable_name [0, 6] - [0, 7])))
  (if_statement [1, 0] - [1, 22]
    condition: (command [1, 3] - [1, 7]
      name: (command_name [1, 3] - [1, 7]
        (word [1, 3] - [1, 7])))
    (command [1, 14] - [1, 18]
      name: (command_name [1, 14] - [1, 18]
        (word [1, 14] - [1, 18])))))
@amaanq
Copy link
Member

amaanq commented Feb 10, 2024

reserved rules api might be needed for this (not a thing yet)

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

2 participants