Skip to content

Commit 18c5541

Browse files
authored
Fix TextMate regex (#137)
* tm syntax: remove verification behind command It surely has been useful in early stage of the syntax but it's seems to have no impact now * tm syntax: add variable fields in "variables" get rid of non-fixed text width lookbehind, incompatible with PCRE regex * tm syntax: fix variables regex variable can have 0 or more fields
1 parent 9abe7f3 commit 18c5541

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

syntaxes/nushell.tmLanguage.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"name": "variable.parameter.nushell"
120120
},
121121
"variables": {
122-
"match": "(\\$[a-zA-Z0-9_]+)",
122+
"match": "(\\$[a-zA-Z0-9_]+)((?:\\.(?:[\\w-]+|\"[\\w\\- ]+\"))*)",
123123
"captures": {
124124
"1": {
125125
"patterns": [
@@ -129,11 +129,14 @@
129129
"name": "variable.other.nushell"
130130
}
131131
]
132+
},
133+
"2": {
134+
"name": "variable.other.nushell"
132135
}
133136
}
134137
},
135138
"variable-fields": {
136-
"match": "(?<=\\)|\\}|\\]|\\$\\w+)(?:\\.(?:[\\w-]+|\"[\\w\\- ]+\"))+",
139+
"match": "(?<=\\)|\\}|\\])(?:\\.(?:[\\w-]+|\"[\\w\\- ]+\"))+",
137140
"name": "variable.other.nushell"
138141
},
139142
"internal-variables": {
@@ -520,7 +523,7 @@
520523
},
521524

522525
"command": {
523-
"begin": "(?<!\\w)(?:(\\^)|(?![0-9]|(?<=\\)|\\}|\\]|\\$\\w+)\\.))([\\w.!]+(?:(?: (?!-)[\\w\\-.!]+(?:(?= |\\))|$)|[\\w\\-.!]+))*|(?<=\\^)\\$?(?:\"[^\"]+\"|'[^']+'))",
526+
"begin": "(?<!\\w)(?:(\\^)|(?![0-9]|\\$))([\\w.!]+(?:(?: (?!-)[\\w\\-.!]+(?:(?= |\\))|$)|[\\w\\-.!]+))*|(?<=\\^)\\$?(?:\"[^\"]+\"|'[^']+'))",
524527
"beginCaptures": {
525528
"1": { "name": "keyword.operator.nushell" },
526529
"2": {

0 commit comments

Comments
 (0)