Skip to content

Error when using parentheses in arithmetic expansion #175

@ObserverOfTime

Description

@ObserverOfTime

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions