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

Error when using parentheses in arithmetic expansion #175

Closed
ObserverOfTime opened this issue May 12, 2023 · 1 comment
Closed

Error when using parentheses in arithmetic expansion #175

ObserverOfTime opened this issue May 12, 2023 · 1 comment

Comments

@ObserverOfTime
Copy link
Member

ObserverOfTime commented May 12, 2023

This code is parsed "correctly":

echo $((1 + 2 - 3 * 4))
(command) ; [1:1 - 23]
 name: (command_name) ; [1:1 - 4]
  (word) ; [1:1 - 4]
 argument: (command_substitution) ; [1:6 - 23]
  (subshell) ; [1:8 - 22]
   (command) ; [1:9 - 21]
    name: (command_name) ; [1:9 - 9]
     (word) ; [1:9 - 9]
    argument: (word) ; [1:11 - 11]
    argument: (word) ; [1:13 - 13]
    argument: (word) ; [1:15 - 15]
    argument: (word) ; [1:17 - 17]
    argument: (word) ; [1:19 - 19]
    argument: (word) ; [1:21 - 21]

This code is not parsed correctly:

echo $((1 + (2 - 3) * 4))
(command) ; [1:1 - 24]
 name: (command_name) ; [1:1 - 4]
  (word) ; [1:1 - 4]
 argument: (command_substitution) ; [1:6 - 24]
  (ERROR) ; [1:8 - 21]
   (subshell) ; [1:8 - 19]
    (command) ; [1:9 - 18]
     name: (command_name) ; [1:9 - 9]
      (word) ; [1:9 - 9]
     argument: (concatenation) ; [1:11 - 14]
      (word) ; [1:11 - 11]
      (ERROR) ; [1:13 - 13]
      (word) ; [1:14 - 14]
     argument: (word) ; [1:16 - 16]
     argument: (word) ; [1:18 - 18]
   (special_variable_name) ; [1:21 - 21]
  (command) ; [1:23 - 23]
   name: (command_name) ; [1:23 - 23]
    (word) ; [1:23 - 23]
(ERROR) ; [1:25 - 25]

#55 should solve this issue if it is ever merged.

@LGFae
Copy link

LGFae commented Jul 13, 2023

I am also running into this issue with some scripts of mine.

@amaanq amaanq closed this as completed Aug 15, 2023
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

3 participants