'main': Highlight the parentheses of array assignments as reserved words.
Fixes #585.
This commit is contained in:
@@ -33,6 +33,7 @@ bar(){}
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 3 assign' # a=(
|
||||
'3 3 reserved-word' # (
|
||||
'5 7 default' # foo
|
||||
'9 9 unknown-token' # |
|
||||
# zsh reports a parse error at this point. Nevertheless, we test how we
|
||||
|
||||
@@ -32,8 +32,10 @@ BUFFER=$'a=( foo ; bar )'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 3 assign' # a=(
|
||||
'3 3 reserved-word' # (
|
||||
'5 7 default' # foo
|
||||
'9 9 unknown-token' # ; (not commandseparator; see highlighter source code)
|
||||
'11 13 default' # bar
|
||||
'15 15 assign' # )
|
||||
'15 15 reserved-word' # )
|
||||
)
|
||||
|
||||
@@ -32,8 +32,10 @@ BUFFER=$'a=( foo \n bar )'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 3 assign' # a=(
|
||||
'3 3 reserved-word' # (
|
||||
'5 7 default' # foo
|
||||
'9 9 commandseparator' # \n
|
||||
'11 13 default' # bar
|
||||
'15 15 assign' # )
|
||||
'15 15 reserved-word' # )
|
||||
)
|
||||
|
||||
@@ -31,7 +31,9 @@ BUFFER='a+=(lorem ipsum)'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 4 assign" # a+=(
|
||||
"4 4 reserved-word" # (
|
||||
"5 9 default" # lorem
|
||||
"11 15 default" # ipsum
|
||||
"16 16 assign" # )
|
||||
"16 16 reserved-word" # )
|
||||
)
|
||||
|
||||
@@ -32,8 +32,10 @@ BUFFER='(A=(hello world))'
|
||||
expected_region_highlight=(
|
||||
"1 1 reserved-word" # (
|
||||
"2 4 assign" # A=(
|
||||
"4 4 reserved-word" # (
|
||||
"5 9 default" # hello
|
||||
"11 15 default" # world
|
||||
"16 16 assign" # )
|
||||
"16 16 reserved-word" # )
|
||||
"17 17 reserved-word" # )
|
||||
)
|
||||
|
||||
@@ -31,8 +31,10 @@ BUFFER='A=(hello world) ls'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 3 assign" # A=(
|
||||
"3 3 reserved-word" # (
|
||||
"4 8 default" # hello
|
||||
"10 14 default" # world
|
||||
"15 15 assign" # )
|
||||
"15 15 reserved-word" # )
|
||||
"17 18 command" # ls
|
||||
)
|
||||
|
||||
@@ -31,9 +31,11 @@ BUFFER='A=(hello world) b=42'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 3 assign" # A=(
|
||||
"3 3 reserved-word" # (
|
||||
"4 8 default" # hello
|
||||
"10 14 default" # world
|
||||
"15 15 assign" # )
|
||||
"15 15 reserved-word" # )
|
||||
"17 20 assign" # b=42
|
||||
"19 20 default" # 42
|
||||
)
|
||||
|
||||
@@ -33,8 +33,10 @@ expected_region_highlight=(
|
||||
"1 3 assign" # A=1
|
||||
"3 3 default" # 1
|
||||
"5 7 assign" # b=(
|
||||
"7 7 reserved-word" # (
|
||||
"8 12 default" # "foo"
|
||||
"8 12 double-quoted-argument" # "foo"
|
||||
"14 16 default" # bar
|
||||
"17 17 assign" # )
|
||||
"17 17 reserved-word" # )
|
||||
)
|
||||
|
||||
@@ -32,9 +32,11 @@ BUFFER=$'foo=(bar abaz) \! ls'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 5 assign' # foo=(
|
||||
'5 5 reserved-word' # (
|
||||
'6 8 default' # bar
|
||||
'10 13 default' # abaz
|
||||
'14 14 assign' # )
|
||||
'14 14 reserved-word' # )
|
||||
'16 16 unknown-token' # \!
|
||||
'18 19 command' # ls
|
||||
)
|
||||
|
||||
@@ -32,8 +32,10 @@ BUFFER=$'foo=(\nbar) env'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 5 assign' # foo=(
|
||||
'5 5 reserved-word' # (
|
||||
'6 6 commandseparator' # \n
|
||||
'7 9 default' # bar
|
||||
'10 10 assign' # )
|
||||
'10 10 reserved-word' # )
|
||||
'12 14 precommand' # env
|
||||
)
|
||||
|
||||
@@ -34,5 +34,6 @@ BUFFER=$'l+=( $1'
|
||||
|
||||
expected_region_highlight=(
|
||||
'1 4 assign' # l+=(
|
||||
'4 4 reserved-word' # (
|
||||
'6 7 default' # $1
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user