diff --git a/fish.YAML-tmLanguage b/fish.YAML-tmLanguage
index 10b223b..637b153 100644
--- a/fish.YAML-tmLanguage
+++ b/fish.YAML-tmLanguage
@@ -63,7 +63,22 @@ repository:
'0': {name: punctuation.definition.parameter.fish meta.string.unquoted.fish}
end: (?=[\s;&)|<>]|=)
patterns:
- - include: '#argument-patterns'
+ - comment: We mimic the argument-patterns rule but use a tweaked unquoted string pattern which excludes '='
+ - include: '#command-substitution'
+
+ - name: meta.string.unquoted.fish
+ begin: (?=\$)
+ end: (?!\$)
+ patterns:
+ - include: '#variable-expansion'
+
+ - include: '#string-quoted'
+
+ - name: meta.string.unquoted.fish
+ begin: (?!['"])
+ end: (?=[\s;&()|<>'"$]|\=)
+ patterns:
+ - include: '#string-unquoted-patterns'
- comment: Consume the '=' and then use standard argument patterns
begin: (?:=)
@@ -71,9 +86,6 @@ repository:
'0': {name: variable.parameter.fish punctuation.definition.parameter.separator.fish meta.string.unquoted.fish }
end: (?=[\s;&)|<>])
patterns:
- - comment: Standard argument patterns
- - name: meta.string.unquoted.fish
- match: \=
- include: '#argument-patterns'
- comment: Argument starting with one dash (short option)
@@ -83,9 +95,6 @@ repository:
'0': {name: punctuation.definition.parameter.fish meta.string.unquoted.fish}
end: (?=[\s;&)|<>])
patterns:
- - comment: Standard argument patterns
- - name: meta.string.unquoted.fish
- match: \=
- include: '#argument-patterns'
- comment: Argument starting with no dashes
@@ -116,19 +125,12 @@ repository:
name: variable.language.fish meta.string.unquoted.fish
match: (?:self|last)(?=[\s;&)|])
- - comment: Standard argument patterns
- - name: meta.string.unquoted.fish
- match: \=
- include: '#argument-patterns'
- comment: Use standard argument patterns exclusively for the remainder of the argument
begin: (?!\s)
end: (?=[\s;&)|<>])
patterns:
- - comment: Pick up characters excluded by the string rule
- name: meta.string.unquoted.fish
- match: \=
-
- include: '#argument-patterns'
argument-patterns:
@@ -143,7 +145,7 @@ repository:
patterns:
- include: '#variable-expansion'
- - comment: Arguments are otherwise made of strings, either quoted or unquoted. The unquoted string rule handles numerics, character escapes, and the brace expansion. It excludes '=' though, so that the long option argument pattern can treat it as a special character
+ - comment: Arguments are otherwise made of strings, either quoted or unquoted. The unquoted string rule handles numerics, character escapes, and brace expansion
- include: '#string'
command-chain:
@@ -725,7 +727,7 @@ repository:
- include: '#variable-expansion'
- - comment: Manually recreate the #string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
+ - comment: Manually recreate the string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
- include: '#string-quoted'
- name: constant.numeric.fish
match: (?:[0-9]+)(?=[\s;&)|<>'"]|\]|\.\.)
@@ -854,8 +856,8 @@ repository:
- name: meta.string.unquoted.fish
begin: (?!['"])
comment: Begin unquoted string if there are no quotes present
- end: (?=[\s;&()|<>'"$=])
- comment: End unquoted string at whitespace, control operators, quoted strings, a variable expansion, or an equals sign '=' (because the long option argument pattern needs to see it)
+ end: (?=[\s;&()|<>'"$])
+ comment: End unquoted string at whitespace, control operators, quoted strings, or a variable expansion
patterns:
- include: '#string-unquoted-patterns'
@@ -899,7 +901,7 @@ repository:
- include: '#variable-expansion'
- - comment: Manually recreate the #string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
+ - comment: Manually recreate the string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
- include: '#string-quoted'
- name: constant.numeric.fish
match: (?:[0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(?=[\s;&)|<>'"]|\}|\,)
diff --git a/fish.tmLanguage b/fish.tmLanguage
index 1cb0550..3bd937b 100644
--- a/fish.tmLanguage
+++ b/fish.tmLanguage
@@ -134,9 +134,47 @@
variable.parameter.fish
patterns
+
+ comment
+ We mimic the argument-patterns rule but use a tweaked unquoted string pattern which excludes '='
+
include
- #argument-patterns
+ #command-substitution
+
+
+ begin
+ (?=\$)
+ end
+ (?!\$)
+ name
+ meta.string.unquoted.fish
+ patterns
+
+
+ include
+ #variable-expansion
+
+
+
+
+ include
+ #string-quoted
+
+
+ begin
+ (?!['"])
+ end
+ (?=[\s;&()|<>'"$]|\=)
+ name
+ meta.string.unquoted.fish
+ patterns
+
+
+ include
+ #string-unquoted-patterns
+
+
@@ -157,16 +195,6 @@
(?=[\s;&)|<>])
patterns
-
- comment
- Standard argument patterns
-
-
- match
- \=
- name
- meta.string.unquoted.fish
-
include
#argument-patterns
@@ -194,16 +222,6 @@
meta.argument.fish variable.parameter.fish
patterns
-
- comment
- Standard argument patterns
-
-
- match
- \=
- name
- meta.string.unquoted.fish
-
include
#argument-patterns
@@ -274,16 +292,6 @@
name
variable.language.fish meta.string.unquoted.fish
-
- comment
- Standard argument patterns
-
-
- match
- \=
- name
- meta.string.unquoted.fish
-
include
#argument-patterns
@@ -299,14 +307,6 @@
(?=[\s;&)|<>])
patterns
-
- comment
- Pick up characters excluded by the string rule
- match
- \=
- name
- meta.string.unquoted.fish
-
include
#argument-patterns
@@ -346,7 +346,7 @@
comment
- Arguments are otherwise made of strings, either quoted or unquoted. The unquoted string rule handles numerics, character escapes, and the brace expansion. It excludes '=' though, so that the long option argument pattern can treat it as a special character
+ Arguments are otherwise made of strings, either quoted or unquoted. The unquoted string rule handles numerics, character escapes, and brace expansion
include
@@ -1789,7 +1789,7 @@
comment
- Manually recreate the
+ Manually recreate the string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
include
@@ -2119,9 +2119,9 @@
begin
(?!['"])
comment
- End unquoted string at whitespace, control operators, quoted strings, a variable expansion, or an equals sign '=' (because the long option argument pattern needs to see it)
+ End unquoted string at whitespace, control operators, quoted strings, or a variable expansion
end
- (?=[\s;&()|<>'"$=])
+ (?=[\s;&()|<>'"$])
name
meta.string.unquoted.fish
patterns
@@ -2210,7 +2210,7 @@
comment
- Manually recreate the
+ Manually recreate the string rule with extra logic in unquoted strings, and don't repeat the meta.string.unquoted scope
include
diff --git a/syntax_test_fish.fish b/syntax_test_fish.fish
index ef4ffbe..ce1372a 100644
--- a/syntax_test_fish.fish
+++ b/syntax_test_fish.fish
@@ -135,6 +135,10 @@ echo --==
cmd
#! <- variable.function
+= arg
+#! <- variable.function meta.string.unquoted
+#! ^^ meta.argument
+
echo str \ # not-comment \ # comment
#! ^^^ meta.string.unquoted
#! ^^^ meta.string.unquoted