-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
- Have you checked if problem occurs with fish 2.3.1?
- Tried fish without third-party customizations?
fish version installed: 2.3.1
OS/terminal used: Fedora 23, GNOME 3.18.2, using gnome-terminal
I'm writing a Sublime Text syntax schema for fish scripts, and have found what I suspect is a parsing bug
If an index-range-expanded-variable is used to select the index range of an outer variable, it appears that the syntax is only parsed as legal if the index-range-expanded-variable is the last or only term within the index brackets, and whitespace is significant. In the below reproduction steps, if $bar is replaced with (seq 3), the syntax is identically rejected
This seems like a fairly simple parsing error to me, since I can't imagine any good reason for these cases to be rejected. Whether the parsing can be appropriately tweaked is another matter, which I can't comment on
Reproduction steps
- Launch fish
set foo (seq 3)set bar (seq 3)echo $foo[ 1 ]echo $foo[$bar[1]]echo $foo[1 $bar[2]]echo $foo[$bar[1] 2]echo $foo[1 $bar[2] 3]echo $foo[ $bar[1] ]
Expected results
1
1
1 2
1 2
1 2 3
1
Actual results
1
1
1 2
Invalid index value
fish: echo $foo[$bar[1] 2]
^
Invalid index value
fish: echo $foo[1 $bar[2] 3]
^
Invalid index value
fish: echo $foo[ $bar[1] ]
^