Skip to content

Commit b03d402

Browse files
authored
Support floats, binary & octal literals, with underscores everywhere (#200)
1 parent cabc695 commit b03d402

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

syntaxes/nushell.tmLanguage.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,19 @@
163163
"name": "constant.numeric.nushell"
164164
},
165165
"numbers-hexa": {
166-
"match": "(?<![\\w-])0x[0-9a-fA-F]+(?![\\w.])",
166+
"match": "(?<![\\w-])_*+0_*+x_*+[0-9a-fA-F][0-9a-fA-F_]*+(?![\\w.])",
167+
"name": "constant.numeric.nushell"
168+
},
169+
"numbers-octal": {
170+
"match": "(?<![\\w-])_*+0_*+o_*+[0-7][0-7_]*+(?![\\w.])",
171+
"name": "constant.numeric.nushell"
172+
},
173+
"numbers-binary": {
174+
"match": "(?<![\\w-])_*+0_*+b_*+[01][01_]*+(?![\\w.])",
167175
"name": "constant.numeric.nushell"
168176
},
169177
"numbers": {
170-
"match": "(?<![\\w-])[-+]?(?:\\d+|\\d{1,3}(?:_\\d{3})*)(?:\\.\\d*)?(?i:ns|us|µs|ms|sec|min|hr|day|wk|b|kb|mb|gb|tb|pt|eb|zb|kib|mib|gib|tib|pit|eib|zib)?(?:(?![\\w.])|(?=\\.\\.))",
178+
"match": "(?<![\\w-])_*+[-+]?_*+(?:(?i:NaN|infinity|inf)_*+|(?:\\d[\\d_]*+\\.?|\\._*+\\d)[\\d_]*+(?i:E_*+[-+]?_*+\\d[\\d_]*+)?)(?i:ns|us|µs|ms|sec|min|hr|day|wk|b|kb|mb|gb|tb|pt|eb|zb|kib|mib|gib|tib|pit|eib|zib)?(?:(?![\\w.])|(?=\\.\\.))",
171179
"name": "constant.numeric.nushell"
172180
},
173181
"binary": {
@@ -195,6 +203,8 @@
195203
{ "include": "#datetime" },
196204
{ "include": "#numbers" },
197205
{ "include": "#numbers-hexa" },
206+
{ "include": "#numbers-octal" },
207+
{ "include": "#numbers-binary" },
198208
{ "include": "#binary" }
199209
]
200210
},

0 commit comments

Comments
 (0)