22# This language definition is based upon https://github.com/Benvie/JavaScriptNext.tmLanguage
33# Repo: https://github.com/rhaiscript
44name : Rhai
5- version : v0.6.3
5+ version : v0.6.6
66fileTypes : [rhai]
77uuid : 1e76f176-ee1c-4331-a781-eb21c0da77cf
88scopeName : source.rhai
@@ -68,7 +68,7 @@ repository:
6868 square-brackets :
6969 patterns :
7070 - name : meta.group.braces.square
71- begin : \[
71+ begin : \[|\?\[
7272 beginCaptures :
7373 ' 0 ' : {name: meta.brace.square.rhai}
7474 end : \]
@@ -262,7 +262,7 @@ repository:
262262 - name : meta.function-call.method.without-arguments.rhai
263263 match : >-
264264 (?x)
265- (?<=\. )
265+ (?<=(\.|\?\.) )
266266 \s*([_a-zA-Z]\w*)\s*
267267 (\(\s*\))
268268 captures :
@@ -272,7 +272,7 @@ repository:
272272 - name : meta.function-call.method.with-arguments.rhai
273273 match : >-
274274 (?x)
275- (?<=\. )
275+ (?<=(\.|\?\.) )
276276 \s*([_a-zA-Z]\w*)\s*
277277 (?=\()
278278 captures :
@@ -328,44 +328,48 @@ repository:
328328 !(?!=)| # logical-not right-to-left right
329329 && | # logical-and left-to-right both
330330 \|\| # logical-or left-to-right both
331+ - name : keyword.operator.coalesce.rhai
332+ match : >-
333+ (?x)
334+ \?\? # null-coalesce left-to-right both
331335 - name : keyword.operator.assignment.rhai
332336 match : >-
333337 (?x)
334- =(?![=>]) # assignment right-to-left both
338+ =(?![=>]) # assignment right-to-left both
335339 - name : keyword.operator.assignment.augmented.rhai
336340 match : >-
337341 (?x)
338- %= | # assignment right-to-left both
339- &= | # assignment right-to-left both
340- \*\*=| # assignment right-to-left both
341- (?<!\*)\*= | # assignment right-to-left both
342- \+= | # assignment right-to-left both
343- -= | # assignment right-to-left both
344- /= | # assignment right-to-left both
345- \^= | # assignment right-to-left both
346- \|= | # assignment right-to-left both
347- <<= | # assignment right-to-left both
348- >>= # assignment right-to-left both
342+ %= | # assignment right-to-left both
343+ &= | # assignment right-to-left both
344+ \*\*=| # assignment right-to-left both
345+ (?<!\*)\*= | # assignment right-to-left both
346+ \+= | # assignment right-to-left both
347+ -= | # assignment right-to-left both
348+ /= | # assignment right-to-left both
349+ \^= | # assignment right-to-left both
350+ \|= | # assignment right-to-left both
351+ <<= | # assignment right-to-left both
352+ >>= # assignment right-to-left both
349353 - name : keyword.operator.bitwise.rhai
350354 match : >-
351355 (?x)
352- << | # bitwise-shift left-to-right both
353- >> | # bitwise-shift left-to-right both
354- & | # bitwise-and left-to-right both
355- \^ | # bitwise-xor left-to-right both
356- \| # bitwise-or left-to-right both
356+ << | # bitwise-shift left-to-right both
357+ >> | # bitwise-shift left-to-right both
358+ & | # bitwise-and left-to-right both
359+ \^ | # bitwise-xor left-to-right both
360+ \| # bitwise-or left-to-right both
357361 - name : keyword.operator.relational.rhai
358362 match : >-
359363 (?x)
360- <= | # relational left -to-right both
361- >= | # relational left-to-right both
362- <(?!-) | # relational left-to-right both
363- (?<!-)> # relational left-to-right both
364+ <= | # relational ;eft -to-right both
365+ >= | # relational left-to-right both
366+ <(?!-) | # relational left-to-right both
367+ (?<!-)> # relational left-to-right both
364368 - name : keyword.operator.comparison.rhai
365369 match : >-
366370 (?x)
367- ==(?!=) | # equality left-to-right both
368- !=(?!=) # equality left-to-right both
371+ ==(?!=) | # equality left-to-right both
372+ !=(?!=) # equality left-to-right both
369373 - name : keyword.operator.arithmetic.rhai
370374 match : >-
371375 (?x)
@@ -375,12 +379,14 @@ repository:
375379 \*(?!\)) | # multiplication left-to-right both
376380 \+(?!\+) | # addition left-to-right both
377381 -(?![>-]) # subtraction left-to-right both
382+ - name : keyword.operator.range.rhai
383+ match : \.\.(?!\.)
378384 - name : keyword.operator.accessor.rhai punctuation.accessor.rhai
379- match : \.(?!\.)
385+ match : \.(?!\.)|\?\.
380386 - name : punctuation.separator.switch.case.rhai
381387 match : =>
382388 - name : invalid.illegal.operator.rhai
383- match : (\(\*|\*\)|\+\+|--|\.\.+|~|#(?!{)|@|\$(?!{)|->|<-|===|!==|\:=|\:\:<)
389+ match : (\(\*|\*\)|\+\+|--|\.\.\. +|~|#(?!{)|@|\? |\$(?!{)|->|<-|===|!==|\:=|\:\:<)
384390
385391 literal-labels :
386392 patterns :
@@ -496,12 +502,12 @@ repository:
496502 match : ' [A-Z][_\dA-Z]*\b'
497503
498504 # e.g. obj.property
499- - match : (?<!\.)\s*([_a-zA-Z]\w*)\s*(?=\. )
505+ - match : (?<!\.)\s*([_a-zA-Z]\w*)\s*(?=(\.|\?\.) )
500506 captures :
501507 ' 1 ' : {name: variable.other.object.rhai}
502508
503509 # e.g. obj.property
504- - match : (?<=\. )\s*([_a-zA-Z]\w*)
510+ - match : (?<=(\.|\?\.) )\s*([_a-zA-Z]\w*)
505511 captures :
506512 ' 1 ' : {name: variable.other.property.rhai entity.name.property.rhai}
507513
0 commit comments