diff --git a/assets/asm.x86.sublime-syntax b/assets/asm.x86.sublime-syntax new file mode 100644 index 0000000..1d91df8 --- /dev/null +++ b/assets/asm.x86.sublime-syntax @@ -0,0 +1,1367 @@ +%YAML 1.2 +--- +file_extensions: [yasm, nasm, asm, inc, mac] +scope: source.asm.x86_64 + +variables: + num_bin: '(?:[01][01_]*)' + num_oct: '(?:[0-7][0-7_]*)' + num_dec: '(?:[0-9][0-9_]*)' + num_hex: '(?:[[:xdigit:]][[:xdigit:]_]*)' + num_bin_exp: '(?:p[+-]?{{num_dec}})' + num_dec_exp: '(?:e[+-]?{{num_dec}})' + identifier_body: '(?:[[:alnum:]_$#@~.?]*)' + valid_identifier: '(?:[[:alpha:]_?]{{identifier_body}})' + +contexts: + prototype: + - include: comments + + line-continuation: + - match: '(\\)$\n' + captures: + 1: punctuation.separator.continuation.asm.x86_64 + - match: '\\(\s+?)$' + captures: + 1: invalid.illegal.space-after-continuation.asm.x86_64 + line-ending: + - match: '$\n' + pop: true + pop: + - match: '(?=.|$)' + pop: true + pop-if-not-whitespace: + - match: '(?=\S)' + set: pop + + main: + - include: comments + - include: prefixes + - include: data-types + - include: registers + - include: mnemonics + - include: strings + - include: numbers + - include: operators + - include: support + - include: directives + - include: entities + - include: structs + - include: preprocessor + - include: labels + + numbers: + - include: floating-point + - include: integers + floating-point: + # binary + - match: '(?i)\b0[by]{{num_bin}}\.(?:{{num_bin}}?{{num_bin_exp}}?\b)?' + scope: constant.numeric.binary.floating-point.asm.x86_64 + - match: '(?i)\b0[by]{{num_bin}}{{num_bin_exp}}\b' + scope: constant.numeric.binary.floating-point.asm.x86_64 + # octal + - match: '(?i)\b0[oq]{{num_oct}}\.(?:{{num_oct}}?{{num_bin_exp}}?\b)?' + scope: constant.numeric.octal.floating-point.asm.x86_64 + - match: '(?i)\b0[oq]{{num_oct}}{{num_bin_exp}}\b' + scope: constant.numeric.octal.floating-point.asm.x86_64 + # decimal + - match: '(?i)\b(?:0[dt])?{{num_dec}}\.(?:{{num_dec}}?{{num_dec_exp}}?\b)?' + scope: constant.numeric.decimal.floating-point.asm.x86_64 + - match: '(?i)\b{{num_dec}}{{num_dec_exp}}\b' + scope: constant.numeric.decimal.floating-point.asm.x86_64 + #- match: '(?i)\.{{num_dec}}{{num_dec_exp}}?\b' + # scope: invalid.illegal.constant.numeric.decimal.floating-point.asm.x86_64 + - match: '(?i)\b{{num_dec}}p{{num_dec}}?\b' + scope: constant.numeric.decimal.packed-bcd.asm.x86_64 + # hex + - match: '(?i)\b0[xh]{{num_hex}}\.(?:{{num_hex}}?{{num_bin_exp}}?\b)?' + scope: constant.numeric.hex.floating-point.asm.x86_64 + - match: '(?i)\b0[xh]{{num_hex}}{{num_bin_exp}}\b' + scope: constant.numeric.hex.floating-point.asm.x86_64 + - match: '(?i)\$[0-9]\_?{{num_hex}}?\.(?:{{num_hex}}?{{num_bin_exp}}?\b)?' + scope: constant.numeric.hex.floating-point.asm.x86_64 + - match: '(?i)\$[0-9]\_?{{num_hex}}{{num_bin_exp}}\b' + scope: constant.numeric.hex.floating-point.asm.x86_64 + integers: + - match: '(?i)\b(?:(?:0[by]{{num_bin}})|(?:{{num_bin}}[by]))\b' + scope: constant.numeric.binary.asm.x86_64 + - match: '(?i)\b(?:(?:0[oq]{{num_oct}})|(?:{{num_oct}}[oq]))\b' + scope: constant.numeric.octal.asm.x86_64 + - match: '(?i)\b(?:(?:0[dt]{{num_dec}})|(?:{{num_dec}}[dt]?))\b' + scope: constant.numeric.decimal.asm.x86_64 + - match: '(?i)(?:\$[0-9]\_?{{num_hex}}?)\b' + scope: constant.numeric.hex.asm.x86_64 + - match: '(?i)\b(?:(?:0[xh]{{num_hex}})|(?:{{num_hex}}[hxHX]))\b' + scope: constant.numeric.hex.asm.x86_64 + + labels: + # http://www.nasm.us/doc/nasmdoc3.html#section-3.9 + - match: '(\.\.@)({{valid_identifier}})(?:(\:)?|\b)' + captures: + 1: punctuation.separator.asm.x86_64 storage.modifier.asm.x86_64 + 2: entity.name.constant.special.asm.x86_64 + 3: punctuation.separator.asm.x86_64 + - match: '(?:(\.)?|\b)({{valid_identifier}})(?:(\:)?|\b)' + captures: + 1: punctuation.separator.asm.x86_64 storage.modifier.asm.x86_64 + 2: entity.name.constant.asm.x86_64 + 3: punctuation.separator.asm.x86_64 + - match: '(\.)([0-9]+{{identifier_body}})(?:(\:)?|\b)' + captures: + 1: punctuation.separator.asm.x86_64 storage.modifier.asm.x86_64 + 2: entity.name.constant.asm.x86_64 + 3: punctuation.separator.asm.x86_64 + - match: '(?:(\.)?|\b)([0-9$@~]{{identifier_body}})(?:(\:)?|\b)' + captures: + 1: punctuation.separator.asm.x86_64 storage.modifier.asm.x86_64 + 2: invalid.illegal.entity.name.constant.asm.x86_64 + 3: punctuation.separator.asm.x86_64 + - match: '((%)(\d+))' + captures: + 1: invalid.illegal.meta.preprocessor.asm.x86_64 + #1: meta.preprocessor.asm.x86_64 + 2: punctuation.definition.variable.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 3: variable.other.preprocessor.asm.x86_64 + - match: '((%%)({{valid_identifier}})(?:(\:)?|\b))' + captures: + 1: invalid.illegal.meta.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 3: entity.name.constant.special.asm.x86_64 + 4: punctuation.separator.asm.x86_64 + + data-types: + # Initialized & uninitialized data: http://www.nasm.us/doc/nasmdoc3.html#section-3.2.1 + - match: '(?i)\b(?:s?byte|(?:[doqtyz]|dq|s[dq]?)?word|(?:d|res)[bdoqtwyz]|ddq)\b' + scope: storage.type.asm.x86_64 + - match: '(?i)\b(?:incbin|equ|times)\b' + scope: support.function.asm.x86_64 + + prefixes: + - match: '(?i)\b(?:strict|nosplit|near|far|abs|rel)\b' + scope: storage.modifier.asm.x86_64 + - match: '(?i)\b(?:[ao](?:16|32|64))\b' + scope: storage.modifier.prefix.asm.x86_64 + - match: '(?i)\b(?:rep(?:n?[ez])?|lock|xacquire|xrelease|(?:no)?bnd)\b' + scope: storage.modifier.prefix.asm.x86_64 + - match: '{(vex[23]|evex)}' + captures: + 1: storage.modifier.prefix.vex.asm.x86_64 + - match: '{(k[1-7])}' + captures: + 1: storage.modifier.opmask.asm.x86_64 + - match: '{(1to(?:8|16))}' + captures: + 1: storage.modifier.precision.asm.x86_64 + - match: '{(z|(?:r[nudz]-)?sae)}' + captures: + 1: storage.modifier.rounding.asm.x86_64 + + support: + # http://www.nasm.us/doc/nasmdoc7.html#section-7.4.6 + - match: '\.\.(?:start|imagebase|tlvp|got(?:pc(?:rel)?|(?:tp)?off)?|plt|sym|tlsie)\b' + scope: support.constant.asm.x86_64 + - match: '\b__(?:utf(?:(?:16|32)(?:[lb]e)?)|float(?:8|16|32|64|80[me]|128[lh])|Infinity|[QS]?NaN)__\b' + scope: support.function.asm.x86_64 + # http://www.nasm.us/doc/nasmdoc4.html#section-4.11 + - match: '\b__NASM_(?:MAJOR|(?:SUB)?MINOR|SNAPSHOT|VER(?:SION_ID)?)__\b' + scope: support.function.asm.x86_64 + - match: '\b___NASM_PATCHLEVEL__\b' + scope: support.function.asm.x86_64 + - match: '\b__(?:FILE|LINE|BITS|OUTPUT_FORMAT)__\b' + scope: support.function.asm.x86_64 + - match: '\b__(?:(?:UTC_)?(?:DATE|TIME)(?:_NUM)?|POSIX_TIME)__\b' + scope: support.function.asm.x86_64 + - match: '\b__USE_(?:ALTREG|SMARTALIGN|FP|IFUNC)__\b' + scope: support.function.asm.x86_64 + - match: '\b__PASS__\b' + scope: invalid.deprecated.support.constant.altreg.asm.x86_64 + - match: '(?i)\balignmode\b' + scope: support.function.smartalign.asm.x86_64 + push: + - include: line-continuation + - include: line-ending + - match: '\b(?:generic|nop|k7|k8|p6)\b' + scope: support.constant.smartalign.asm.x86_64 + pop: true + - match: '\w+' + scope: invalid.illegal.constant.smartalign.asm.x86_64 + pop: true + - match: '\b__ALIGNMODE__\b' + scope: support.constant.smartalign.asm.x86_64 + - match: '\b(?:Inf|[QS]?NaN)\b' + scope: support.constant.fp.asm.x86_64 + - match: '\b(?:float(?:8|16|32|64|80[me]|128[lh]))\b' + scope: support.function.fp.asm.x86_64 + - match: '(?i)\bilog2(?:[ewfc]|[fc]w)?\b' + scope: support.function.ifunc.asm.x86_64 + + directives: + - match: '(?i)\b(?:ideal|jumps|p[345]86|end)\b' + scope: invalid.deprecated.tasm.asm.x86_64 + - match: '(?i)\b(?:bits|use(?:16|32|64)|org|uppercase|safeseh|osabi)\b' + scope: support.function.directive.asm.x86_64 + - match: '(?i)\b(default)(?:\s+(rel|abs|(?:no)?bnd))?\b' + captures: + 1: support.function.directive.asm.x86_64 + 2: support.constant.directive.asm.x86_64 + - match: '(?i)\b(?:section|segment)\b' + scope: support.function.directive.asm.x86_64 + push: [section-parameters, section-name] + - match: '(?i)\bgroup\b' + scope: support.function.directive.asm.x86_64 + push: section-name + - match: '\b(?:__SECT__|__NASMDEFSEG|_?_GLOBAL_OFFSET_TABLE_)\b' + scope: support.constant.directive.asm.x86_64 + - match: '(?i)\b(?:absolute|common)\b' + scope: support.function.directive.asm.x86_64 + - match: '(?i)\b(?:subsections_via_symbols|no_dead_strip)\b' + scope: support.function.directive.macho.asm.x86_64 + - match: '(?i)import\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '{{valid_identifier}}' + scope: entity.name.function.asm.x86_64 + set: + - match: '{{valid_identifier}}' + scope: meta.path.asm.x86_64 string.unquoted.asm.x86_64 + set: + - match: '{{valid_identifier}}' + scope: variable.function.asm.x86_64 + set: + - include: comments + - match: '{{valid_identifier}}' + scope: invalid.illegal.asm.x86_64 + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - match: '(?i)export\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '{{valid_identifier}}' + scope: entity.name.constant.asm.x86_64 + set: + - match: '{{valid_identifier}}' + scope: variable.function.asm.x86_64 + set: export-parameters + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - match: '(?i)global\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '(?<=\:)(?:function|data|export)\b' + scope: storage.type.directive.asm.x86_64 + - match: '\b(?:default|internal|hidden|protected|proc|data)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.asm.x86_64 + - include: line-continuation + - include: line-ending + - include: preprocessor-macro-parameter + - include: main + - match: '(?i)extern\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '(?<=\:)(?:import)\b' + scope: storage.type.directive.asm.x86_64 + - match: '\b(?:proc|data)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.asm.x86_64 + - include: line-continuation + - include: line-ending + - include: preprocessor-macro-parameter + - include: main + - match: '(?i)library\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '{{valid_identifier}}' + scope: meta.path.asm.x86_64 string.unquoted.asm.x86_64 + pop: true + - include: line-continuation + - include: line-ending + - include: pop-if-not-whitespace + - match: '(?i)module\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '\$?{{valid_identifier}}' + scope: entity.name.namespace.asm.x86_64 + pop: true + - include: line-continuation + - include: line-ending + - include: pop-if-not-whitespace + - match: '(?i)\bcpu\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '(?i)\b(?:(?:80|[1-6])86|pentium|ppro|p[234]|katmai|willamette|prescott|(?:x|ia)64)\b' + scope: support.constant.directive.asm.x86_64 + pop: true + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: main + - match: '(?i)\bfloat\b' + scope: support.function.directive.asm.x86_64 + push: + - match: '(?i)\b(?:(?:no)?daz|near|up|down|zero|default)\b' + scope: support.constant.directive.asm.x86_64 + pop: true + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: main + - match: '(?i)(\[)\s*(warning)\b' + captures: + 2: support.function.directive.asm.x86_64 + push: + - match: '(?i)([+\-*])|(error)\s*(=)\s*' + captures: + 1: keyword.control.warning.asm.x86_64 + 2: support.constant.directive.warning.asm.x86_64 + 3: keyword.operator.assignment.asm.x86_64 + push: + - match: '(?i)\b(other|macro-(?:params|selfref|defaults)|orphan-labels|number-overflow|gnu-elf-extensions|float-(?:overflow|denorm|underflow|toolong)|user|lock|hle|bnd|zext-reloc|ptr|(?:bad|unknown|not-my)-pragma|unknown-warning|all)(?=\]|\s)' + scope: support.constant.directive.warning.asm.x86_64 + pop: true + - match: '\S+(?=\])' + scope: invalid.illegal.support.constant.directive.warning.asm.x86_64 + pop: true + - match: '\S+' + scope: invalid.illegal.support.constant.directive.warning.asm.x86_64 + pop: true + - match: '(?i)\b(?:all|error)\b' + scope: support.constant.directive.warning.asm.x86_64 + - match: ']' + pop: true + - include: line-continuation + - include: line-ending + - match: '(?i)(\[)\s*(map)\b' + captures: + 2: support.function.directive.asm.x86_64 + push: + - match: '(?i)\b(?:all|brief|sections|segments|symbols)\b' + scope: support.constant.directive.map.asm.x86_64 + - match: '(?i)\b(?:std(?:out|err))\b' + scope: meta.path.asm.x86_64 support.constant.directive.map.asm.x86_64 + - match: '{{valid_identifier}}' + scope: meta.path.asm.x86_64 string.unquoted.asm.x86_64 + - match: ']' + pop: true + - include: line-continuation + - include: line-ending + section-parameters: + - match: '=' + scope: keyword.operator.assignment.asm.x86_64 + - match: '(?i)\b(?:(?:v)?start|align|absolute)\b' + scope: variable.parameter.directive.asm.x86_64 + - match: '(?i)\b(?:(?:prog|no)bits|private|public|common|stack|code|text|data|bss|rdata|info)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.asm.x86_64 + - match: '(?i)\b(?:mixed|zerofill|no_dead_strip|live_support|strip_static_syms)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.macho.asm.x86_64 + - match: '(?i)\b(?:(?:no)?(?:alloc|exec|write)|tls)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.elf.asm.x86_64 + - match: '(?i)\b(?:(?:v)?follows)\b' + scope: variable.parameter.directive.asm.x86_64 + push: + - match: '=' + scope: keyword.operator.assignment.asm.x86_64 + set: [pop, section-name] + - include: line-continuation + - include: line-ending + - match: '(?i)\b(?:class|overlay)\b' + scope: variable.parameter.directive.asm.x86_64 + push: + - match: '=' + scope: keyword.operator.assignment.asm.x86_64 + - match: '{{valid_identifier}}' + scope: entity.name.class.asm.x86_64 string.unquoted.asm.x86_64 + pop: true + - include: line-continuation + - include: line-ending + - include: line-continuation + - include: line-ending + - include: main + section-name: + - match: '(?:\.|\b)(?:text|bss|(?:[rpx]|ro)?data|code)\b' + scope: entity.name.section.asm.x86_64 string.unquoted.asm.x86_64 support.constant.section.asm.x86_64 + pop: true + - match: '\b__(?:text|const|data|bss|TEXT|CONST|DATA|BSS)\b' + scope: entity.name.section.asm.x86_64 string.unquoted.asm.x86_64 support.constant.section.macho.asm.x86_64 + pop: true + - match: '(?:\.)(?:[lt](?:data|bss)|lrodata|comment)\b' + scope: entity.name.section.asm.x86_64 string.unquoted.asm.x86_64 support.constant.section.elf.asm.x86_64 + pop: true + - match: '(?:\.|\b){{valid_identifier}}\b' + scope: entity.name.section.asm.x86_64 string.unquoted.asm.x86_64 + pop: true + - match: '(?=`|''|")' + set: + - meta_scope: entity.name.section.asm.x86_64 + - include: strings + - include: pop + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + export-parameters: + - match: '=' + scope: keyword.operator.assignment.asm.x86_64 + - match: '(?i)\b(?:resident|nodata)\b' + scope: storage.modifier.directive.asm.x86_64 variable.parameter.directive.asm.x86_64 + - match: '(?i)\b(?:parm)\b' + scope: variable.parameter.directive.asm.x86_64 + - include: primitive-directive-end + - include: line-continuation + - include: line-ending + - include: main + + operators: + - match: '[+\-*/]' + scope: keyword.operator.arithmetic.asm.x86_64 + - match: '(%%|%)[[:space:]]' + captures: + 1: keyword.operator.arithmetic.asm.x86_64 + - match: '[|&^~!]|<<|>>' + scope: keyword.operator.bitwise.asm.x86_64 + - match: '(?i)\b(seg|wrt)\b' + scope: keyword.operator.word.asm.x86_64 + - match: ',' + scope: operator.separator.asm.x86_64 + + structs: + - match: '(?i)\bstruc\b' + scope: support.function.asm.x86_64 meta.struct.asm.x86_64 + push: + - meta_content_scope: meta.struct.asm.x86_64.1 + - match: '{{valid_identifier}}' + scope: entity.name.struct.asm.x86_64 + set: + - meta_scope: meta.struct.asm.x86_64 + - match: '(?i)\bendstruc\b' + scope: support.function.asm.x86_64 meta.struct.asm.x86_64 + pop: true + - include: main + - match: '\w' + scope: invalid.illegal.entity.name.struct.asm.x86_64 + - match: '(?i)\bendstruc\b' + scope: invalid.illegal.support.function.asm.x86_64 meta.struct.asm.x86_64 + - match: '(?i)\bistruc\b' + scope: support.function.asm.x86_64 meta.struct.asm.x86_64 + push: + - meta_content_scope: meta.struct.asm.x86_64.1 + - match: '{{valid_identifier}}' + scope: variable.other.asm.x86_64 + set: + - meta_scope: meta.struct.asm.x86_64 + - match: '(?i)\bat\b' + scope: support.function.asm.x86_64 meta.struct.asm.x86_64 + - match: '(?i)\biend\b' + scope: support.function.asm.x86_64 meta.struct.asm.x86_64 + pop: true + - include: main + - match: '\w' + scope: invalid.illegal.variable.struct.asm.x86_64 + - match: '(?i)\biend\b' + scope: invalid.illegal.support.function.asm.x86_64 meta.struct.asm.x86_64 + - match: '(?i)\balignb?\b' + scope: support.function.asm.x86_64 + - match: '(?i)\b(sectalign)\s+(on|off)?' + captures: + 1: support.function.asm.x86_64 + 2: support.constant.asm.x86_64 + + entities: + - match: '\$@feat\.00\b' + scope: variable.language.sseh.asm.x86_64 + - match: '(\$)(?:\w+)\b' + scope: variable.other.asm.x86_64 + captures: + 1: punctuation.definition.variable.asm.x86_64 + - match: '\${3,}' + scope: invalid.illegal.variable.language.asm.x86_64 + - match: '\$' + scope: variable.language.asm.x86_64 + + comments: + - match: (?:(;)|(?:^|\s)(#)\s).*$ + scope: comment.line.asm.x86_64 + captures: + 1: punctuation.definition.comment.asm.x86_64 + 2: punctuation.definition.comment.asm.x86_64 + - match: /\* + scope: punctuation.definition.comment.asm.x86_64 + push: + - meta_scope: comment.block.asm.x86_64 + - match: \*/ + scope: punctuation.definition.comment.asm.x86_64 + pop: true + + preprocessor: # http://www.nasm.us/doc/nasmdoc4.html + - include: preprocessor-macro-multiline + - include: preprocessor-macro-define + - include: preprocessor-macro-indirection + - include: preprocessor-conditions + - include: preprocessor-other + # single-line macro + preprocessor-macro-define: + - match: '^\s*((%)x?i?define)\b' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.import.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - match: '(?:{{valid_identifier}})(?=\()' + scope: entity.name.function.preprocessor.asm.x86_64 + set: + - match: '\(' + scope: punctuation.section.group.begin.asm.x86_64 + set: preprocessor-macro-params + - match: '{{valid_identifier}}' + scope: entity.name.constant.preprocessor.asm.x86_64 + set: preprocessor-macro-definition + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - match: '^\s*((%)(?:include|depend))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.import.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-macro-definition + - match: '^\s*((%)use)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.import.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 string.unquoted.asm.x86_64 + - include: strings + - include: line-ending + - include: preprocessor-macro-indirection + - match: '^\s*((%)(?:assign|i?deftok|strcat|strlen|substr|pathsearch|push|pop|repl|line|clear))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-macro-indirection + - include: preprocessor-conditions-constant + - match: '^\s*((%)(?:arg|local))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - match: '({{valid_identifier}})(\:)(?=\w+)' + captures: + 1: meta.preprocessor.asm.x86_64 variable.parameter.macro.asm.x86_64 + 2: punctuation.separator.asm.x86_64 + - match: '\,' + scope: punctuation.separator.asm.x86_64 + - include: data-types + - match: '\w+\b' + scope: invalid.illegal.storage.type.asm.x86_64 + - include: line-continuation + - include: line-ending + - match: '^\s*((%)stacksize)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - match: '\b(flat(?:64)?|large|small)\b' + scope: support.constant.macro.asm.x86_64 + - match: '\w+\b' + scope: invalid.illegal.storage.type.asm.x86_64 + - include: line-continuation + - include: line-ending + - match: '^\s*((%)i?defstr)\s+(?:({{valid_identifier}})|(%%)({{valid_identifier}}))\b' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.import.preprocessor.assign.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: entity.name.constant.preprocessor.asm.x86_64 + 4: punctuation.definition.keyword.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 5: entity.name.constant.special.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 string.unquoted.asm.x86_64 + - include: preprocessor-macro-indirection + - include: line-ending + - match: '^\s*((%)(?:warning|error|fatal|pragma))(?=\s|$)' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.preprocessor.assign.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: entity.name.constant.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 string.unquoted.asm.x86_64 + - include: strings + - include: preprocessor-macro-indirection + - include: line-ending + preprocessor-macro-params-illegal: + - meta_scope: invalid.illegal.asm.x86_64 + - include: preprocessor-macro-params + preprocessor-macro-params: + - meta_scope: meta.preprocessor.macro.parameters.asm.x86_64 meta.group.asm.x86_64 + - match: '{{valid_identifier}}' + scope: variable.parameter.asm.x86_64 + - match: '\)' + scope: punctuation.section.group.end.asm.x86_64 + set: preprocessor-macro-definition + - match: ',' + scope: punctuation.separator.asm.x86_64 + push: + - match: '{{valid_identifier}}' + scope: variable.parameter.asm.x86_64 + pop: true + - include: line-continuation + - include: preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.asm.x86_64 + - match: '(?=\))' + pop: true + - match: '(/\*).*(\*/)' + scope: comment.block.asm.x86_64 + captures: + 1: punctuation.definition.comment.asm.x86_64 + 2: punctuation.definition.comment.asm.x86_64 + - match: '\S+' + scope: invalid.illegal.unexpected-character.asm.x86_64 + - include: line-continuation + - include: preprocessor-comments + - match: '\.\.\.' + scope: keyword.operator.variadic.asm.x86_64 + - match: '(/\*).*(\*/)' + scope: comment.block.asm.x86_64 + captures: + 1: punctuation.definition.comment.asm.x86_64 + 2: punctuation.definition.comment.asm.x86_64 + - match: '$\n' + scope: invalid.illegal.unexpected-end-of-line.asm.x86_64 + preprocessor-macro-definition: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - include: line-continuation + - include: line-ending + - include: main + preprocessor-macro-indirection: + - match: '((%)(\[))' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: meta.brackets.asm.x86_64 punctuation.section.brackets.begin.asm.x86_64 + push: + - meta_scope: meta.brackets.asm.x86_64 meta.preprocessor.macro.asm.x86_64 + - include: line-continuation + - include: line-ending + - include: main + - match: '\]' + scope: punctuation.section.brackets.end.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + pop: true + - match: '((%)\+)\s+' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.operator.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + - match: '((%)(\?\??))' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.operator.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: variable.language.preprocessor.asm.x86_64 + - match: '((%\$+)({{valid_identifier}})(?:(\:)?|\b))' + captures: + 1: meta.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 3: entity.name.constant.special.asm.x86_64 + 4: punctuation.separator.asm.x86_64 + - match: '((%)(\!))' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.operator.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: punctuation.definition.variable.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.asm.x86_64 keyword.operator.preprocessor.asm.x86_64 variable.parameter.preprocessor.environment.asm.x86_64 + - match: '{{valid_identifier}}' + scope: variable.parameter.preprocessor.environment.unquoted.asm.x86_64 + pop: true + - match: '(?=`|''|")' + set: + - meta_scope: variable.parameter.preprocessor.environment.quoted.asm.x86_64 + - include: strings + - include: pop + - include: pop + preprocessor-conditions: # also see preprocessor-macro-conditions-multiline + - match: '^\s*((%)ifn?(?:idni?|id|num|str|token|empty|env)?)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-conditions-content-block + - match: '^\s*((%)ifn?(?:def|ctx))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: [preprocessor-conditions-content-block, preprocessor-conditions-constant] + - match: '^\s*((%)rep)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-conditions-content-block + - match: '^\s*((%)ifn?macro)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: [preprocessor-conditions-content-block, preprocessor-macro-arguments-signature] + - include: preprocessor-conditions-parity + preprocessor-conditions-constant: + - meta_content_scope: meta.preprocessor.asm.x86_64 + - match: '(?:{{valid_identifier}})(?=\()' + scope: entity.name.constant.preprocessor.asm.x86_64 + set: + - match: '\(' + scope: punctuation.section.group.begin.asm.x86_64 + set: preprocessor-macro-params-illegal + - match: '{{valid_identifier}}\b' + scope: meta.preprocessor.asm.x86_64 entity.name.constant.preprocessor.asm.x86_64 + pop: true + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + - include: main + preprocessor-conditions-content-block: + - meta_content_scope: meta.block.preprocessor.asm.x86_64 + - include: preprocessor-conditions-content-block-common + - include: main + preprocessor-conditions-content-block-common: + - match: '^\s*((%)(?:elifn?(?:idni?|id|num|str|token|empty|env)?|else|exitrep))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + - match: '^\s*((%)(?:elifn?(?:def|ctx)))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-conditions-constant + - match: '^\s*((%)elifn?macro)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-macro-arguments-signature + - match: '^\s*((%)(?:end(?:if|rep)))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + pop: true + preprocessor-conditions-parity: + - match: '^\s*((%)(?:elifn?(?:macro|def|ctx|idni?|id|num|str|token|empty|env)?|else|(?:end(?:if|rep))|exitrep))\b' + captures: + 1: invalid.illegal.meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + preprocessor-other: + - include: preprocessor-macro-indirection + - match: '^\s*((%)undef)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_scope: meta.preprocessor.asm.x86_64 + - include: line-continuation + - include: line-ending + - include: preprocessor-comments + - match: '{{valid_identifier}}' + scope: entity.name.constant.preprocessor.asm.x86_64 + pop: true + - match: '^\s*((%)unmacro)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.import.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-macro-arguments-signature + preprocessor-macro-arguments-signature: + - meta_scope: meta.preprocessor.asm.x86_64 + - include: preprocessor-comments + - match: '({{valid_identifier}})(?:\s+(?:(\d+(?:(-)(?:\d+|\*))?)(\+)?(\.nolist\b)?))' + captures: + 1: entity.name.function.preprocessor.asm.x86_64 + 2: variable.parameter.preprocessor.asm.x86_64 + 3: keyword.operator.preprocessor.range.asm.x86_64 + 4: storage.modifier.preprocessor.greedy.asm.x86_64 + 5: storage.modifier.preprocessor.listing.asm.x86_64 + pop: true + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + # multi-line macro + preprocessor-macro-multiline: + - match: '^\s*((%)i?macro)\b' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.import.define.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - match: '(?:{{valid_identifier}})(?=\()' + scope: entity.name.constant.preprocessor.asm.x86_64 + set: + - meta_content_scope: invalid.illegal.asm.x86_64 + - match: '\(' + scope: punctuation.section.group.begin.asm.x86_64 + set: preprocessor-macro-params-illegal + - match: '({{valid_identifier}})(?:\s+(?:(\d+(?:(-)(?:\d+|\*))?)(\+)?(\.nolist\b)?))' + captures: + 1: entity.name.function.preprocessor.asm.x86_64 + 2: variable.parameter.preprocessor.asm.x86_64 + 3: keyword.operator.preprocessor.range.asm.x86_64 + 4: storage.modifier.preprocessor.greedy.asm.x86_64 + 5: storage.modifier.preprocessor.listing.asm.x86_64 + set: preprocessor-macro-definition-multiline-with-parameters + - match: '^\s*((%)endmacro)\b' + captures: + 1: invalid.illegal.meta.preprocessor.asm.x86_64 keyword.control.import.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + preprocessor-macro-parameter: + - match: '((%)(\-?\d+))' + captures: + 1: meta.preprocessor.asm.x86_64 + 2: punctuation.definition.variable.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 3: variable.other.preprocessor.asm.x86_64 + preprocessor-macro-definition-multiline-with-parameters: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - include: preprocessor-macro-parameter + - include: preprocessor-macro-indirection + - include: preprocessor-macro-conditions-multiline + - include: preprocessor-macro-definition-multiline + preprocessor-macro-definition-multiline: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - match: '^\s*((%)endmacro)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.import.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + pop: true + - match: '((%%)({{valid_identifier}})(?:(\:)?|\b))' + captures: + 1: meta.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 3: entity.name.constant.special.asm.x86_64 + 4: punctuation.separator.asm.x86_64 + - match: '((%)({))' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + 3: meta.braces.asm.x86_64 punctuation.section.braces.begin.asm.x86_64 + push: + - meta_scope: meta.braces.asm.x86_64 meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-macro-indirection + - match: ':' + scope: punctuation.separator.asm.x86_64 + - match: '}' + scope: punctuation.section.braces.end.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + pop: true + - match: '^\s*((%)(?:rotate))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.operator.word.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + - match: '^\s*((%)(?:include|depend))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.import.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + set: preprocessor-macro-definition-multiline-with-parameters + - match: '^\s*((%)(?:pathsearch))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + set: [preprocessor-macro-definition-multiline-with-parameters, preprocessor-conditions-constant] + - match: '^\s*((%)x?i?define)\b' + captures: + 1: meta.preprocessor.macro.asm.x86_64 keyword.control.import.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-comments + - match: '(?:{{valid_identifier}})(?=\()' + scope: entity.name.function.preprocessor.asm.x86_64 + set: + - match: '\(' + scope: punctuation.section.group.begin.asm.x86_64 + set: preprocessor-macro-params + - match: '{{valid_identifier}}' + scope: entity.name.constant.preprocessor.asm.x86_64 + set: preprocessor-macro-definition-inside-multiline + - include: line-continuation + - include: pop-if-not-whitespace + - include: line-ending + + - include: preprocessor-macro-indirection + - include: preprocessor-conditions + - include: main + preprocessor-macro-conditions-multiline: # also see preprocessor-conditions + - match: '^\s*((%)ifn?(?:idni?|id|num|str|token|empty|env)?)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-conditions-content-block-multiline + - match: '^\s*((%)ifn?(?:def|ctx))\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: [preprocessor-conditions-content-block-multiline, preprocessor-conditions-constant] + - match: '^\s*((%)rep)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: preprocessor-conditions-content-block-multiline + - match: '^\s*((%)ifn?macro)\b' + captures: + 1: meta.preprocessor.asm.x86_64 keyword.control.preprocessor.asm.x86_64 + 2: punctuation.definition.keyword.preprocessor.asm.x86_64 + push: [preprocessor-macro-arguments-signature, preprocessor-conditions-content-block-multiline] + - include: preprocessor-conditions-parity + preprocessor-conditions-content-block-multiline: + - meta_content_scope: meta.block.preprocessor.asm.x86_64 + - include: preprocessor-conditions-content-block-common + - include: preprocessor-macro-definition-multiline-with-parameters + preprocessor-macro-definition-inside-multiline: + - meta_content_scope: meta.preprocessor.macro.asm.x86_64 + - include: preprocessor-macro-parameter + - include: preprocessor-macro-definition + + strings: # Character strings: http://www.nasm.us/doc/nasmdoc3.html#section-3.4.2 + - match: '`' + scope: punctuation.definition.string.begin.asm.x86_64 + push: string-backquote + - match: '''' + scope: punctuation.definition.string.begin.asm.x86_64 + push: string-single + - match: '"' + scope: punctuation.definition.string.begin.asm.x86_64 + push: string-double + string-content: + - match: '\\u[[:xdigit:]]{4}' + scope: constant.character.escape.asm.x86_64 + - match: '\\U[[:xdigit:]]{8}' + scope: constant.character.escape.asm.x86_64 + - match: '\\x[[:xdigit:]]{1,2}' + scope: constant.character.escape.asm.x86_64 + - match: '\\[0-7]{1,3}' + scope: constant.character.escape.asm.x86_64 + - match: '\\[''"`\\?abtnvfre]' + scope: constant.character.escape.asm.x86_64 + - match: '\\.' + scope: invalid.illegal.constant.character.escape.asm.x86_64 + string-backquote: + - meta_scope: string.quoted.other.asm.x86_64 + - meta_include_prototype: false + - include: string-content + - match: '`' + scope: punctuation.definition.string.end + pop: true + string-single: + - meta_scope: string.quoted.single.asm.x86_64 + - meta_include_prototype: false + - match: '''' + scope: punctuation.definition.string.end + pop: true + string-double: + - meta_scope: string.quoted.double.asm.x86_64 + - meta_include_prototype: false + - match: '"' + scope: punctuation.definition.string.end + pop: true + + registers: + - match: '(?i)\b(?:[abcd][hl]|[er]?[abcd]x|[er]?(?:di|si|bp|sp)|dil|sil|bpl|spl|r(?:8|9|1[0-5])[bdlw]?)\b' + scope: constant.language.register.general-purpose.asm.x86_64 + - match: '(?i)\b(?:[cdefgs]s)\b' + scope: constant.language.register.segment.asm.x86_64 + - match: '(?i)\b(?:[er]?flags)\b' + scope: constant.language.register.flags.asm.x86_64 + - match: '(?i)\b(?:[er]?ip)\b' + scope: constant.language.register.instruction-pointer.asm.x86_64 + - match: '(?i)\b(?:cr[02-4])\b' + scope: constant.language.register.control.asm.x86_64 + - match: '(?i)\b(?:(?:mm|st|fpr)[0-7])\b' + scope: constant.language.register.mmx.asm.x86_64 + - match: '(?i)\b(?:[xy]mm(?:[0-9]|1[0-5])|mxcsr)\b' + scope: constant.language.register.sse_avx.asm.x86_64 + - match: '(?i)\b(?:zmm(?:[12]?[0-9]|30|31))\b' + scope: constant.language.register.avx512.asm.x86_64 + - match: '(?i)\b(?:bnd(?:[0-3]|cfg[su]|status))\b' + scope: constant.language.register.memory-protection.asm.x86_64 + - match: '(?i)\b(?:(?:[gil]dt)r?|tr)\b' + scope: constant.language.register.system-table-pointer.asm.x86_64 + - match: '(?i)\b(?:dr[0-367])\b' + scope: constant.language.register.debug.asm.x86_64 + - match: '(?i)\b(?:cr8|dr(?:[89]|1[0-5])|efer|tpr|syscfg)\b' + scope: constant.language.register.amd.asm.x86_64 + - match: '(?i)\b(?:db[0-367]|t[67]|tr[3-7]|st)\b' + scope: invalid.deprecated.constant.language.register.asm.x86_64 + - match: '(?i)\b[xy]mm(?:1[6-9]|2[0-9]|3[01])\b' + scope: invalid.deprecated.constant.language.register.asm.x86_64 + + mnemonics: # see valid.asm for references + - include: mnemonics-general-purpose + - include: mnemonics-fpu + - include: mnemonics-mmx + - include: mnemonics-sse + - include: mnemonics-sse2 + - include: mnemonics-sse3 + - include: mnemonics-sse4 + - include: mnemonics-aesni + - include: mnemonics-avx + - include: mnemonics-avx2 + - include: mnemonics-tsx + - include: mnemonics-system + - include: mnemonics-64bit + - include: mnemonics-vmx + - include: mnemonics-smx + - include: mnemonics-intel-isa-sgx + - include: mnemonics-intel-isa-mpx + - include: mnemonics-intel-isa-sha + - include: mnemonics-supplemental-amd + - include: mnemonics-supplemental-cyrix + - include: mnemonics-supplemental-via + - include: mnemonics-undocumented + - include: mnemonics-future-intel + - include: mnemonics-pseudo-ops + #- include: mnemonics-invalid + mnemonics-general-purpose: + - match: '(?i)\b(?:mov(?:[sz]x)?|cmov(?:n?[abceglopsz]|n?[abgl]e|p[eo]))\b' + scope: keyword.operator.word.mnemonic.general-purpose.data-transfer.mov + - match: '(?i)\b(xchg|bswap|xadd|cmpxchg(8b)?)\b' + scope: keyword.operator.word.mnemonic.general-purpose.data-transfer.xchg + - match: '(?i)\b((push|pop)(ad?)?|cwde?|cdq|cbw)\b' + scope: keyword.operator.word.mnemonic.general-purpose.data-transfer.other + - match: '(?i)\b(adcx?|adox|add|sub|sbb|i?mul|i?div|inc|dec|neg|cmp)\b' + scope: keyword.operator.word.mnemonic.general-purpose.binary-arithmetic + - match: '(?i)\b(daa|das|aaa|aas|aam|aad)\b' + scope: keyword.operator.word.mnemonic.general-purpose.decimal-arithmetic + - match: '(?i)\b(and|x?or|not)\b' + scope: keyword.operator.word.mnemonic.general-purpose.logical + - match: '(?i)\b(s[ah][rl]|sh[rl]d|r[co][rl])\b' + scope: keyword.operator.word.mnemonic.general-purpose.rotate + - match: '(?i)\b(set(n?[abceglopsz]|n?[abgl]e|p[eo]))\b' + scope: keyword.operator.word.mnemonic.general-purpose.bit-and-byte.set + - match: '(?i)\b(bt[crs]?|bs[fr]|test|crc32|popcnt)\b' + scope: keyword.operator.word.mnemonic.general-purpose.bit-and-byte.other + - match: '(?i)\b(jmp|jn?[abceglopsz]|jn?[abgl]e|jp[eo]|j[er]?cxz)\b' + scope: keyword.operator.word.mnemonic.general-purpose.control-transfer.jmp + - match: '(?i)\b(loop(n?[ez])?|call|ret|iret[dq]?|into?|bound|enter|leave)\b' + scope: keyword.operator.word.mnemonic.general-purpose.control-transfer.other + - match: '(?i)\b((mov|cmp|sca|lod|sto)(s[bdw]?)|rep(n?[ez])?)\b' + scope: keyword.operator.word.mnemonic.general-purpose.strings + - match: '(?i)\b((in|out)(s[bdw]?)?)\b' + scope: keyword.operator.word.mnemonic.general-purpose.io + - match: '(?i)\b((st|cl)[cdi]|cmc|[ls]ahf|(push|pop)f[dq]?)\b' + scope: keyword.operator.word.mnemonic.general-purpose.flag-control + - match: '(?i)\b(l[defgs]s)\b' + scope: keyword.operator.word.mnemonic.general-purpose.segment-registers + - match: '(?i)\b(lea|nop|ud2|xlatb?|cpuid|movbe)\b' + scope: keyword.operator.word.mnemonic.general-purpose.misc + - match: '(?i)\b(rdrand|rdseed)\b' + scope: keyword.operator.word.mnemonic.general-purpose.rng + - match: '(?i)\b(andn|bextr|bls(i|r|msk)|bzhi|pdep|pext|[lt]zcnt|(mul|ror|sar|shl|shr)x)\b' + scope: keyword.operator.word.mnemonic.general-purpose.bmi + mnemonics-fpu: + - match: '(?i)\b(fcmov(n?([beu]|be)))\b' + scope: keyword.operator.word.mnemonic.fpu.data-transfer.mov + - match: '(?i)\b(f(i?(ld|stp?)|b(ld|stp)|xch))\b' + scope: keyword.operator.word.mnemonic.fpu.data-transfer.other + - match: '(?i)\b(f((add|div|mul|sub)p?|i(add|div|mul|sub)|(div|sub)rp?|i(div|sub)r))\b' + scope: keyword.operator.word.mnemonic.fpu.basic-arithmetic.basic + - match: '(?i)\b(f(prem1?|abs|chs|rndint|scale|sqrt|xtract))\b' + scope: keyword.operator.word.mnemonic.fpu.basic-arithmetic.other + - match: '(?i)\b(f(u?com[ip]?p?|icomp?|tst|xam))\b' + scope: keyword.operator.word.mnemonic.fpu.comparison + - match: '(?i)\b(f(sin|cos|sincos|pa?tan|2xm1|yl2x(p1)?))\b' + scope: keyword.operator.word.mnemonic.fpu.transcendental + - match: '(?i)\b(fld(1|z|pi|l2[et]|l[ng]2))\b' + scope: keyword.operator.word.mnemonic.fpu.load-constants + - match: '(?i)\b(f((inc|dec)stp|free|n?(init|clex|st[cs]w|stenv|save)|ld(cw|env)|rstor|nop)|f?wait)\b' + scope: keyword.operator.word.mnemonic.fpu.control-management + - match: '(?i)\b(fx(save|rstor)(64)?)\b' + scope: keyword.operator.word.mnemonic.fpu.state-management + mnemonics-mmx: + - match: '(?i)\b(mov[dq])\b' + scope: keyword.operator.word.mnemonic.mmx.data-transfer + - match: '(?i)\b(pack(ssdw|[su]swb)|punpck[hl](bw|dq|wd))\b' + scope: keyword.operator.word.mnemonic.mmx.conversion + - match: '(?i)\b(p(((add|sub)(d|(u?s)?[bw]))|maddwd|mul[lh]w))\b' + scope: keyword.operator.word.mnemonic.mmx.packed-arithmetic + - match: '(?i)\b(pcmp((eq|gt)[bdw]))\b' + scope: keyword.operator.word.mnemonic.mmx.comparison + - match: '(?i)\b(pandn?|px?or)\b' + scope: keyword.operator.word.mnemonic.mmx.logical + - match: '(?i)\b(ps([rl]l[dwq]|raw|rad))\b' + scope: keyword.operator.word.mnemonic.mmx.shift-and-rotate + - match: '(?i)\b(emms)\b' + scope: keyword.operator.word.mnemonic.mmx.state-management + mnemonics-sse: + - match: '(?i)\b(mov(([ahlu]|hl|lh|msk)ps|ss))\b' + scope: keyword.operator.word.mnemonic.sse.data-transfer + - match: '(?i)\b((add|div|max|min|mul|rcp|r?sqrt|sub)[ps]s)\b' + scope: keyword.operator.word.mnemonic.sse.packed-arithmetic + - match: '(?i)\b(cmp[ps]s|u?comiss)\b' + scope: keyword.operator.word.mnemonic.sse.comparison + - match: '(?i)\b((andn?|x?or)ps)\b' + scope: keyword.operator.word.mnemonic.sse.logical + - match: '(?i)\b((shuf|unpck[hl])ps)\b' + scope: keyword.operator.word.mnemonic.sse.shuffle-and-unpack + - match: '(?i)\b(cvt(pi2ps|si2ss|ps2pi|tps2pi|ss2si|tss2si))\b' + scope: keyword.operator.word.mnemonic.sse.conversion + - match: '(?i)\b((ld|st)mxcsr)\b' + scope: keyword.operator.word.mnemonic.sse.state-management + - match: '(?i)\b(p(avg[bw]|extrw|insrw|(max|min)(sw|ub)|sadbw|shufw|mulhuw|movmskb))\b' + scope: keyword.operator.word.mnemonic.sse.simd-integer + - match: '(?i)\b(maskmovq|movntps|sfence)\b' + scope: keyword.operator.word.mnemonic.sse.cacheability-control + - match: '(?i)\b(prefetch(nta|t[0-2]|w(t1)?))\b' + scope: keyword.operator.word.mnemonic.sse.prefetch + mnemonics-sse2: + - match: '(?i)\b(mov([auhl]|msk)pd)\b' + scope: keyword.operator.word.mnemonic.sse2.data-transfer + - match: '(?i)\b((add|div|max|min|mul|sub|sqrt)[ps]d)\b' + scope: keyword.operator.word.mnemonic.sse2.packed-arithmetic + - match: '(?i)\b((andn?|x?or)pd)\b' + scope: keyword.operator.word.mnemonic.sse2.logical + - match: '(?i)\b((cmpp|u?comis)d)\b' + scope: keyword.operator.word.mnemonic.sse2.compare + - match: '(?i)\b((shuf|unpck[hl])pd)\b' + scope: keyword.operator.word.mnemonic.sse2.shuffle-and-unpack + - match: '(?i)\b(cvt(dq2pd|pi2pd|ps2pd|pd2ps|si2sd|sd2ss|ss2sd|t?(pd2dq|pd2pi|sd2si)))\b' + scope: keyword.operator.word.mnemonic.sse2.conversion + - match: '(?i)\b(cvt(dq2ps|ps2dq|tps2dq))\b' + scope: keyword.operator.word.mnemonic.sse2.packed-floating-point + - match: '(?i)\b(mov(dq[au]|q2dq|dq2q))\b' + scope: keyword.operator.word.mnemonic.sse2.simd-integer.mov + - match: '(?i)\b(p((add|sub|(s[lr]l|mulu|unpck[hl]q)d)q|shuf(d|[hl]w)))\b' + scope: keyword.operator.word.mnemonic.sse2.simd-integer.other + - match: '(?i)\b(clflush|[lm]fence|pause|maskmovdqu|movnt(dq|i|pd))\b' + scope: keyword.operator.word.mnemonic.sse2.cacheability-control + mnemonics-sse3: + - match: '(?i)\b(fisttp|lddqu|(addsub|h(add|sub))p[sd]|mov(sh|sl|d)dup|monitor|mwait)\b' + scope: keyword.operator.word.mnemonic.sse3 + - match: '(?i)\b(ph(add|sub)(s?w|d))\b' + scope: keyword.operator.word.mnemonic.sse3.supplimental.horizontal-packed-arithmetic + - match: '(?i)\b(p((abs|sign)[bdw]|maddubsw|mulhrsw|shufb|alignr))\b' + scope: keyword.operator.word.mnemonic.sse3.supplimental.other + mnemonics-sse4: + - match: '(?i)\b(pmul(ld|dq)|dpp[ds])\b' + scope: keyword.operator.word.mnemonic.sse4.1.arithmetic + - match: '(?i)\b(movntdqa)\b' + scope: keyword.operator.word.mnemonic.sse4.1.load-hint + - match: '(?i)\b(blendv?p[ds]|pblend(vb|w))\b' + scope: keyword.operator.word.mnemonic.sse4.1.packed-blending + - match: '(?i)\b(p(min|max)(u[dw]|s[bd]))\b' + scope: keyword.operator.word.mnemonic.sse4.1.packed-integer + - match: '(?i)\b(round[ps][sd])\b' + scope: keyword.operator.word.mnemonic.sse4.1.packed-floating-point + - match: '(?i)\b((extract|insert)ps|p((ins|ext)(r[bdq])))\b' + scope: keyword.operator.word.mnemonic.sse4.1.insertion-and-extraction + - match: '(?i)\b(pmov([sz]x(b[dqw]|dq|wd|wq)))\b' + scope: keyword.operator.word.mnemonic.sse4.1.conversion + - match: '(?i)\b(mpsadbw|phminposuw|ptest|pcmpeqq|packusdw)\b' + scope: keyword.operator.word.mnemonic.sse4.1.other + - match: '(?i)\b(pcmp([ei]str[im]|gtq))\b' + scope: keyword.operator.word.mnemonic.sse4.2 + mnemonics-aesni: + - match: '(?i)\b(aes((dec|enc)(last)?|imc|keygenassist)|pclmulqdq)\b' + scope: keyword.operator.word.mnemonic.aesni + mnemonics-avx: + - match: '(?i)\b(v((test|permil|maskmov)p[ds]|zero(all|upper)|(perm2|insert|extract|broadcast)f128|broadcasts[ds]))\b' + scope: keyword.operator.word.mnemonic.avx + - match: '(?i)\b(vaes((dec|enc)(last)?|imc|keygenassist)|vpclmulqdq)\b' + scope: keyword.operator.word.mnemonic.avx.promoted.aes + - match: '(?i)\b(v((cmp[ps]|u?comis)[ds]|pcmp([ei]str[im]|(eq|gt)[bdqw])))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.comparison + - match: '(?i)\b(v(cvt(dq2pd|dq2ps|pd2ps|ps2pd|sd2ss|si2sd|si2ss|ss2sd|t?(pd2dq|ps2dq|sd2si|ss2si))))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.conversion + - match: '(?i)\b(vh((add|sub)p[ds])|vph((add|sub)([dw]|sw)|minposuw))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.horizontal-packed-arithmetic + - match: '(?i)\b(v((andn?|x?or)p[ds]))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.logical + - match: '(?i)\b(v(mov(([ahl]|msk|nt|u)p[ds]|(hl|lh)ps|s([ds]|[hl]dup)|q)))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.mov + - match: '(?i)\b(v((add|div|mul|sub|max|min|round|sqrt)[ps][ds]|(addsub|dp)p[ds]|(rcp|rsqrt)[ps]s))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.packed-arithmetic + - match: '(?i)\b(v(pack[su]s(dw|wb)|punpck[hl](bw|dq|wd|qdq)|unpck[hl]p[ds]))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.packed-conversion + - match: '(?i)\b(vp(shuf([bd]|[hl]w))|vshufp[ds])\b' + scope: keyword.operator.word.mnemonic.avx.promoted.packed-shuffle + - match: '(?i)\b(vp((abs|sign|(max|min)[su])[bdw]|(add|sub)([bdqw]|u?s[bw])|avg[bw]|extr[bdqw]|madd(wd|ubsw)|mul(hu?w|hrsw|l[dw]|u?dq)|sadbw))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.supplemental.arithmetic + - match: '(?i)\b(vp(andn?|x?or))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.supplemental.logical + - match: '(?i)\b(vpblend(vb|w))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.supplemental.blending + - match: '(?i)\b(vpmov(mskb|[sz]x(b[dqw]|w[dq]|dq)))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.supplemental.mov + - match: '(?i)\b(vp(insr[bdqw]|sll(dq|[dqw])|srl(dq)))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.simd-integer + - match: '(?i)\b(vp(sra[dwq]|srl[dqw]))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.shift-and-rotate + - match: '(?i)\b(vblendv?p[ds])\b' + scope: keyword.operator.word.mnemonic.avx.promoted.packed-blending + - match: '(?i)\b(vp(test|alignr))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.packed-other + - match: '(?i)\b(vmov(d(dup|qa|qu)?))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.simd-integer.mov + - match: '(?i)\b(v((extract|insert)ps|lddqu|(ld|st)mxcsr|mpsadbw))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.other + - match: '(?i)\b(v(maskmovdqu|movntdqa?))\b' + scope: keyword.operator.word.mnemonic.avx.promoted.cacheability-control + - match: '(?i)\b(vcvt(ph2ps|ps2ph))\b' + scope: keyword.operator.word.mnemonic.16-bit-floating-point-conversion + - match: '(?i)\b(vfn?m((add|sub)(132|213|231)[ps][ds])|vfm((addsub|subadd)(132|213|231)p[ds]))\b' + scope: keyword.operator.word.mnemonic.fma + mnemonics-avx2: + - match: '(?i)\b(v((broadcast|extract|insert|perm2)i128|pmaskmov[dq]|perm([dsq]|p[sd])))\b' + scope: keyword.operator.word.mnemonic.avx2.promoted.simd + - match: '(?i)\b(vpbroadcast[bdqw])\b' + scope: keyword.operator.word.mnemonic.avx2.promoted.packed + - match: '(?i)\b(vp(blendd|s[lr]lv[dq]|sravd))\b' + scope: keyword.operator.word.mnemonic.avx2.blend + - match: '(?i)\b(vp?gather[dq][dq]|vgather([dq]|dq)p[ds])\b' + scope: keyword.operator.word.mnemonic.avx2.gather + mnemonics-tsx: + - match: '(?i)\b(x(abort|acquire|release|begin|end|test))\b' + scope: keyword.operator.word.mnemonic.tsx + mnemonics-system: + - match: '(?i)\b((cl|st)ac|[ls]([gli]dt|tr|msw)|clts|arpl|lar|lsl|ver[rw]|inv(d|lpg|pcid)|wbinvd)\b' + scope: keyword.operator.word.mnemonic.system + - match: '(?i)\b(lock|hlt|rsm|(rd|wr)(msr|pkru|[fg]sbase)|rd(pmc|tscp?)|sys(enter|exit))\b' + scope: keyword.operator.word.mnemonic.system + - match: '(?i)\b(x((save(c|opt|s)?|rstors?)(64)?|[gs]etbv))\b' + scope: keyword.operator.word.mnemonic.system + mnemonics-64bit: + - match: '(?i)\b(cdqe|cqo|(cmp|lod|mov|sto)sq|cmpxchg16b|mov(ntq|sxd)|scasq|swapgs|sys(call|ret))\b' + scope: keyword.operator.word.mnemonic.64-bit-mode + mnemonics-vmx: + - match: '(?i)\b(vm(ptr(ld|st)|clear|read|write|launch|resume|xo(ff|n)|call|func)|inv(ept|vpid))\b' + scope: keyword.operator.word.mnemonic.vmx + mnemonics-smx: + - match: '(?i)\b(getsec)\b' + scope: keyword.operator.word.mnemonic.smx.getsec + - match: '(?i)\b(capabilities|enteraccs|exitac|senter|sexit|parameters|smctrl|wakeup)\b' + scope: support.constant + mnemonics-intel-isa-sgx: + - match: '(?i)\be(add|block|create|dbg(rd|wr)|extend|init|ld[bu]|pa|remove|track|wb)\b' + scope: keyword.operator.word.mnemonic.sgx1.supervisor + - match: '(?i)\be(enter|exit|getkey|report|resume)\b' + scope: keyword.operator.word.mnemonic.sgx1.user + - match: '(?i)\be(aug|mod(pr|t))\b' + scope: keyword.operator.word.mnemonic.sgx2.supervisor + - match: '(?i)\be(accept(copy)?|modpe)\b' + scope: keyword.operator.word.mnemonic.sgx2.user + mnemonics-intel-isa-mpx: + - match: '(?i)\b(bnd(mk|c[lnu]|mov|ldx|stx))\b' + scope: keyword.operator.word.mnemonic.mpx + mnemonics-intel-isa-sha: + - match: '(?i)\b(sha(1rnds4|256rnds2|1nexte|(1|256)msg[12]))\b' + scope: keyword.operator.word.mnemonic.sha + mnemonics-supplemental-amd: + - match: '(?i)\b(bl([cs](fill|ic?|msk)|cs)|t1mskc|tzmsk)\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.general-purpose + - match: '(?i)\b(clgi|int3|invlpga|iretw|skinit|stgi|vm(load|mcall|run|save)|monitorx|mwaitx)\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.system + - match: '(?i)\b([ls]lwpcb|lwp(ins|val))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.profiling + - match: '(?i)\b(movnts[ds])\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.memory-management + - match: '(?i)\b(prefetch|clzero)\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.cache-management + - match: '(?i)\b((extr|insert)q)\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.sse4.a + - match: '(?i)\b(vfn?m((add|sub)[ps][ds])|vfm((addsub|subadd)p[ds]))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.fma4 + - match: '(?i)\b(vp(cmov|(comu?|rot|sh[al])[bdqw]|mac(s?s(d(d|q[hl])|w[dw]))|madcss?wd|perm))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.xop.simd + - match: '(?i)\b(vph(addu?(b[dqw]|w[dq]|dq)|sub(bw|dq|wd)))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.xop.simd-horizontal + - match: '(?i)\b(vfrcz[ps][ds]|vpermil2p[ds])\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.xop.other + - match: '(?i)\b(femms)\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.3dnow + - match: '(?i)\b(p(avgusb|(f2i|i2f)[dw]|mulhrw|swapd)|pf((p?n)?acc|add|max|min|mul|rcp(it[12])?|rsqit1|rsqrt|subr?))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.3dnow.simd + - match: '(?i)\b(pfcmp(eq|ge|gt))\b' + scope: keyword.operator.word.mnemonic.supplemental.amd.3dnow.comparison + mnemonics-supplemental-cyrix: + - match: '(?i)\b((sv|rs)dc|(wr|rd)shr|paddsiw)\b' + scope: keyword.operator.word.mnemonic.supplemental.cyrix + mnemonics-supplemental-via: + - match: '(?i)\b(montmul)\b' + scope: keyword.operator.word.mnemonic.supplemental.via + - match: '(?i)\b(x(store(rng)?|crypt(ecb|cbc|ctr|cfb|ofb)|sha(1|256)))\b' + scope: keyword.operator.word.mnemonic.supplemental.via.padlock + mnemonics-undocumented: + - match: '(?i)\b(ret[nf]|icebp|int1|int03|smi|ud1)\b' + scope: keyword.operator.word.mnemonic.undocumented + mnemonics-future-intel: + - include: mnemonics-future-intel-avx512 + - include: mnemonics-future-intel-opmask + - include: mnemonics-future-intel-cet + - include: mnemonics-future-intel-other + mnemonics-future-intel-avx512: + - match: '(?i)\b(vblendm(pd|ps)|vpblendm[bdqw])\b' + scope: keyword.operator.word.mnemonic.avx512.blend + - match: '(?i)\b(vbroadcast[fi](32x[248]|64x[24])|v(extract|insert)[fi](32x[48]|64x[24])|vshuf[fi](32x4|64x2)|vpbroadcastm(b2q|w2d))\b' + scope: keyword.operator.word.mnemonic.avx512.bits-mov + - match: '(?i)\b(v(compress|expand)p[ds]|vp(compress|expand|conflict)[dq])\b' + scope: keyword.operator.word.mnemonic.avx512.compress + - match: '(?i)\b(vcvt(t?p[sd]2(udq|u?qq)|(udq|u?qq)2p[ds]|t?s[ds]2usi|usi2s[ds]))\b' + scope: keyword.operator.word.mnemonic.avx512.conversion + - match: '(?i)\b(v(fixupimm|fpclass|get(exp|mant)|range|(rcp|rsqrt)(14|28)|reduce|rndscale|scalef)([ps][ds]))\b' + scope: keyword.operator.word.mnemonic.avx512.math + - match: '(?i)\b(v(exp2p[ds]|(scatter|(gather|scatter)pf[01])[dq]p[ds]))\b' + scope: keyword.operator.word.mnemonic.avx512.math + - match: '(?i)\b(vmovdq(a(32|64)|u(8|16|32|64)))\b' + scope: keyword.operator.word.mnemonic.avx512.simd-integer + - match: '(?i)\b(vp(andn?|x?or)[dq])\b' + scope: keyword.operator.word.mnemonic.avx512.logical + - match: '(?i)\b(vpcmpu?[dqw])\b' + scope: keyword.operator.word.mnemonic.avx512.packed-comparison + - match: '(?i)\b(vp(absq|(lzcnt|ternlog)[dq]|madd52[lh]uq|(max|min)[su]q|mullq))\b' + scope: keyword.operator.word.mnemonic.avx512.packed-math + - match: '(?i)\b(vpmov(m2[bdqw]|[bdqw]2m|(u?s)?([qd][bw]|qd|wb)))\b' + scope: keyword.operator.word.mnemonic.avx512.packed-mov + - match: '(?i)\b(vp(ro[rl]v?[dq]|scatter[dq][dq]))\b' + scope: keyword.operator.word.mnemonic.avx512.packed-shift + - match: '(?i)\b(vptestn?m[bdqw])\b' + scope: keyword.operator.word.mnemonic.avx512.packed-test + - match: '(?i)\b(vperm([bdw]|[it]2([bdwq]|p[ds])))\b' + scope: keyword.operator.word.mnemonic.avx512.permutations + - match: '(?i)\b(valign[dq]|vdbpsadbw|vpmultishiftqb|vpsrav[dqw])\b' + scope: keyword.operator.word.mnemonic.avx512.other + mnemonics-future-intel-opmask: + - match: '(?i)\b(k(add|andn?|(xn?)?or|mov|not|(or)?test|shift[lr])[bdqw]|kunpck(bw|wd|dq))\b' + scope: keyword.operator.word.mnemonic.opmask + mnemonics-future-intel-cet: + - match: '(?i)\b((inc|save|rstor)ssp|wru?ss|(set|clr)ssbsy|endbranch|endbr(32|64))\b' + scope: keyword.operator.word.mnemonic.cet + mnemonics-future-intel-other: + - match: '(?i)\b(clflushopt|clwb|pcommit)\b' + scope: keyword.operator.word.mnemonic.other + mnemonics-pseudo-ops: + - match: '(?i)\b(cmp(n?(eq|lt|le)|(un)?ord)[ps][ds])\b' + scope: keyword.pseudo-mnemonic.sse2.compare + - match: '(?i)\b(v?pclmul([hl]q[hl]q|[hl]qh)dq)\b' + scope: keyword.pseudo-mnemonic.avx.promoted.aes + - match: '(?i)\b(vcmp(eq(_(os|uq|us))?|neq(_(oq|os|us))?|[gl][et](_oq)?|n[gl][et](_uq)?|(un)?ord(_s)?|false(_os)?|true(_us)?)[ps][ds])\b' + scope: keyword.pseudo-mnemonic.avx.promoted.comparison + - match: '(?i)\b(vpcom(n?eq|[gl][et]|false|true)(b|uw))\b' + scope: keyword.pseudo-mnemonic.supplemental.amd.xop.simd + mnemonics-invalid: + - include: mnemonics-invalid-amd-sse5 + mnemonics-invalid-amd-sse5: + - match: '(?i)\b(com[ps][ds]|pcomu?[bdqw])\b' + scope: invalid.keyword.operator.word.mnemonic.sse5.comparison + - match: '(?i)\b(cvtp(h2ps|s2ph)|frcz[ps][ds])\b' + scope: invalid.keyword.operator.word.mnemonic.sse5.conversion + - match: '(?i)\b(fn?m((add|sub)[ps][ds])|ph(addu?(b[dqw]|w[dq]|dq)|sub(bw|dq|wd))|pma(css?(d(d|q[hl])|w[dw])|dcss?wd))\b' + scope: invalid.keyword.operator.word.mnemonic.sse5.packed-arithmetic + - match: '(?i)\b(pcmov|permp[ds]|pperm|prot[bdqw]|psh[al][bdqw])\b' + scope: invalid.keyword.operator.word.mnemonic.sse5.simd-integer +... \ No newline at end of file diff --git a/assets/graphql.sublime-syntax b/assets/graphql.sublime-syntax new file mode 100644 index 0000000..00a082b --- /dev/null +++ b/assets/graphql.sublime-syntax @@ -0,0 +1,595 @@ +%YAML 1.2 +--- +# See http://www.sublimetext.com/docs/3/syntax.html +name: GraphQL +file_extensions: + - graphql + - graphqls + - gql +scope: source.graphql +variables: + name_begin: (?:[_A-Za-z]) + name_continue: (?:[_0-9A-Za-z]) + name_break: (?!{{name_continue}}) + name: (?:{{name_begin}}{{name_continue}}*{{name_break}}) + + integer_part: (?:-?(?:0|[1-9]\d*)) + fractional_part: (?:\.\d*) + exponent_part: (?:[Ee][-+]?\d*) +contexts: + else-pop: + - match: (?=\S) + pop: true + + immediately-pop: + - match: '' + pop: true + + prototype: + - match: '#' + scope: punctuation.definition.comment.graphql + push: + - meta_scope: comment.line.graphql + - match: $ + pop: true + - match: ',' + scope: punctuation.separator.sequence.graphql + + main: + - match: (?=") + push: description + + - include: executable-declaration + - include: type-declarations + + - match: directive{{name_break}} + scope: keyword.declaration.directive.graphql + push: + - - match: on{{name_break}} + scope: keyword.declaration.directive.graphql + set: + - - match: '\|' + scope: keyword.operator.graphql + push: directive-location + - include: else-pop + - directive-location + - include: else-pop + - arguments-definition + - directive-definition-name + + executable-declaration: + - match: query{{name_break}} + scope: keyword.declaration.query.graphql + push: + - selection-set + - directives + - variable-definitions + - query-name + + - match: (?=\{) + push: selection-set + + - match: mutation{{name_break}} + scope: keyword.declaration.mutation.graphql + push: + - selection-set + - directives + - variable-definitions + - mutation-name + + - match: subscription{{name_break}} + scope: keyword.declaration.subscription.graphql + push: + - selection-set + - directives + - variable-definitions + - subscription-name + + - match: fragment{{name_break}} + scope: keyword.declaration.fragment.graphql + push: + - selection-set + - directives + - type-condition + - fragment-name + + type-declarations: + - match: schema{{name_break}} + scope: keyword.declaration.schema.graphql + push: + - schema-definition + - directives + + - match: scalar{{name_break}} + scope: keyword.declaration.scalar.graphql + push: + - directives + - scalar-name + + - match: type{{name_break}} + scope: keyword.declaration.type.graphql + push: + - type-definition + - directives + - implements + - type-name + + - match: interface{{name_break}} + scope: keyword.declaration.type.interface.graphql + push: + - type-definition + - directives + - implements + - interface-name + + - match: union{{name_break}} + scope: keyword.declaration.type.interface.graphql + push: + - - match: '=' + scope: punctuation.separator.key-value.graphql + set: + - - match: '\|' + scope: keyword.operator.graphql + push: type-named + - include: else-pop + - - include: type-named + - include: else-pop + - include: else-pop + - directives + - union-name + + - match: enum{{name_break}} + scope: keyword.declaration.type.enum.graphql + push: + - enum-definition + - directives + - enum-name + + - match: input{{name_break}} + scope: keyword.declaration.type.input.graphql + push: + - input-definition + - directives + - input-name + + description: + - match: '"""' + scope: string.quoted.multiline.begin.graphql + set: + - meta_include_prototype: false + - meta_scope: string.quoted.multiline.graphql + - match: '\\"""' + scope: constant.character.escape.graphql + - match: '"""' + scope: string.quoted.multiline.end.graphql + pop: true + + - match: '"' + scope: string.quoted.double.begin.graphql + set: + - meta_include_prototype: false + - meta_scope: string.quoted.double.graphql + - match: '"' + scope: string.quoted.double.end.graphql + pop: true + + - match: '\\u\h{4}' + scope: constant.character.escape.hex.graphql + - match: '\\u\h{,3}' + scope: invalid.illegal.escape.hex.graphql + + - match: '\\["\\/bfnrt]' + scope: constant.character.escape.graphql + - match: '\\.' + scope: invalid.illegal.escape.graphql + + query-name: + - match: '{{name}}' + scope: entity.name.query.graphql + pop: true + - include: else-pop + + mutation-name: + - match: '{{name}}' + scope: entity.name.mutation.graphql + pop: true + - include: else-pop + + subscription-name: + - match: '{{name}}' + scope: entity.name.subscription.graphql + pop: true + - include: else-pop + + fragment-name: + - match: (?=on{{name_break}}) + pop: true + - match: '{{name}}' + scope: entity.name.fragment.graphql + pop: true + - include: else-pop + + scalar-name: + - match: '{{name}}' + scope: entity.name.type.scalar.graphql + pop: true + - include: else-pop + + type-name: + - match: '{{name}}' + scope: entity.name.type.object.graphql + pop: true + - include: else-pop + + interface-name: + - match: '{{name}}' + scope: entity.name.type.interface.graphql + pop: true + - include: else-pop + + union-name: + - match: '{{name}}' + scope: entity.name.type.union.graphql + pop: true + - include: else-pop + + enum-name: + - match: '{{name}}' + scope: entity.name.type.enum.graphql + pop: true + - include: else-pop + + input-name: + - match: '{{name}}' + scope: entity.name.type.input.graphql + pop: true + - include: else-pop + + directive-definition-name: + - match: '(@)({{name}})' + captures: + 1: punctuation.definition.annotation.graphql + 2: entity.name.definition.graphql + pop: true + - include: else-pop + + type-condition: + - match: on{{name_break}} + scope: keyword.other.graphql + set: type-named + - include: else-pop + + default-value: + - match: '=' + scope: punctuation.separator.key-value.graphql + set: value + - include: else-pop + + variable-definitions: + - match: \( + scope: punctuation.section.group.begin.graphql + set: + - match: \) + scope: punctuation.section.group.end.graphql + pop: true + - match: '(\$)({{name}})' + captures: + 1: punctuation.definition.variable.graphql + 2: variable.parameter.graphql + push: + - - include: default-value + - - match: ':' + scope: punctuation.separator.type.graphql + set: type + - include: else-pop + - include: else-pop + + directives: + - match: '@' + scope: punctuation.definition.annotation.graphql + push: + - arguments + - directive-name + + - include: else-pop + + directive-name: + - match: (?:skip|include|deprecated){{name_break}} + scope: variable.function.annotation.graphql support.function.graphql + pop: true + - match: '{{name}}' + scope: variable.function.annotation.graphql + pop: true + - include: else-pop + + selection-set: + - match: \{ + scope: punctuation.section.block.begin.graphql + set: + - meta_scope: meta.block.graphql + - match: \} + scope: punctuation.section.block.end.graphql + pop: true + - match: '{{name}}' + scope: entity.name.field.graphql + push: + - selection-set + - directives + - field-arguments + - aliased-field-name + - include: else-pop + + aliased-field-name: + - match: ':' + scope: punctuation.separator.key-value.graphql + set: + - match: '{{name}}' + scope: variable.parameter.graphql + pop: true + - include: else-pop + - include: else-pop + + field-arguments: + - match: \( + scope: punctuation.section.group.begin.graphql + set: + - match: \) + scope: punctuation.section.group.end.graphql + pop: true + - match: '{{name}}' + scope: variable.parameter.graphql + push: + - - match: ':' + scope: punctuation.separator.type.graphql + set: value + - include: else-pop + - include: else-pop + + schema-definition: + - match: \{ + scope: punctuation.section.block.begin.graphql + set: + - meta_scope: meta.block.graphql + - match: \} + scope: punctuation.section.block.end.graphql + pop: true + - match: '(?:query|mutation|subscription)' + scope: keyword.other.graphql + push: + - match: ':' + scope: punctuation.separator.key-value.graphql + set: type-named + - include: else-pop + - include: else-pop + + implements: + - match: implements{{name_break}} + scope: keyword.declaration.implements.graphql + set: + - - match: '&' + scope: keyword.operator.graphql + push: type-named + - include: else-pop + - - include: type-named + - include: else-pop + - include: else-pop + + type-definition: + - match: \{ + scope: punctuation.section.block.begin.graphql + set: + - meta_scope: meta.block.graphql + - match: \} + scope: punctuation.section.block.end.graphql + pop: true + - match: (?=") + push: description + - match: '{{name}}' + scope: entity.name.field.graphql + push: + - - match: ':' + scope: punctuation.separator.key-value.graphql + set: + - directives + - type + - include: else-pop + - arguments-definition + - include: else-pop + + enum-definition: + - match: \{ + scope: punctuation.section.block.begin.graphql + set: + - meta_scope: meta.block.graphql + - match: \} + scope: punctuation.section.block.end.graphql + pop: true + - match: (?=") + push: description + - match: '{{name}}' + scope: entity.name.constant.graphql + push: directives + - include: else-pop + + input-definition: + - match: \{ + scope: punctuation.section.block.begin.graphql + set: + - meta_scope: meta.block.graphql + - match: \} + scope: punctuation.section.block.end.graphql + pop: true + - include: input-value-definition + - include: else-pop + + arguments-definition: + - match: \( + scope: punctuation.section.group.begin.graphql + set: + - match: \) + scope: punctuation.section.group.end.graphql + pop: true + - include: input-value-definition + - include: else-pop + + input-value-definition: + - match: (?=") + push: description + - match: '{{name}}' + scope: variable.parameter.graphql + push: + - match: ':' + scope: punctuation.separator.key-value + set: + - directives + - default-value + - type + - include: else-pop + + type: + - meta_include_prototype: false + - match: '' + set: + - type-non-null + - type-value + + type-value: + - include: type-named + - match: \[ + scope: storage.modifier.list.graphql + set: + - - match: \] + scope: storage.modifier.list.graphql + pop: true + - include: else-pop + - type + - include: else-pop + + type-named: + - match: (?:Int|Float|String|Boolean|ID){{name_break}} + scope: variable.type.graphql support.type.graphql + pop: true + - match: '{{name}}' + scope: variable.type.graphql + pop: true + + type-non-null: + - match: '!' + scope: storage.modifier.required.graphql + pop: true + - include: else-pop + + directive-location: + - match: | + (?x)(?: + QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT + |SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION + ){{name_break}} + scope: constant.language.graphql + pop: true + - include: else-pop + + arguments: + - match: \( + scope: punctuation.section.group.begin.graphql + set: + - match: \) + scope: punctuation.section.group.end.graphql + pop: true + - match: '{{name}}' + scope: variable.parameter.graphql + push: + - match: ':' + scope: punctuation.separator.key-value.graphql + set: value + - include: else-pop + - include: else-pop + - include: else-pop + + value: + - match: \$ + scope: punctuation.definition.variable.graphql + set: + - match: '{{name}}' + scope: variable.other.graphql + pop: true + - include: '' + pop: true + + - match: '{{integer_part}}(?:{{fractional_part}}{{exponent_part}}?|{{exponent_part}}){{name_break}}' + scope: constant.numeric.float.graphql + pop: true + - match: '{{integer_part}}{{name_break}}' + scope: constant.numeric.integer.graphql + pop: true + + - match: null{{name_break}} + scope: constant.language.null.graphql + pop: true + - match: true{{name_break}} + scope: constant.language.boolean.true.graphql + pop: true + - match: false{{name_break}} + scope: constant.language.boolean.false.graphql + pop: true + + - match: '{{name}}' + scope: constant.other.graphql + pop: true + + - match: '"""' + scope: punctuation.definition.string.begin.graphql + set: + - meta_include_prototype: false + - meta_scope: string.quoted.triple.graphql + - match: '\\"""' + scope: constant.character.escape.graphql + - match: '"""' + scope: punctuation.definition.string.end.graphql + pop: true + + - match: '"' + scope: punctuation.definition.string.begin.graphql + set: + - meta_include_prototype: false + - meta_scope: string.quoted.double.graphql + - match: '"' + scope: punctuation.definition.string.end.graphql + pop: true + + - match: '\\u\h{4}' + scope: constant.character.escape.hex.graphql + - match: '\\u\h{,3}' + scope: invalid.illegal.escape.hex.graphql + + - match: '\\["\\/bfnrt]' + scope: constant.character.escape.graphql + - match: '\\.' + scope: invalid.illegal.escape.graphql + + - match: \[ + scope: punctuation.section.sequence.begin.graphql + set: + - meta_scope: meta.sequence.graphql + - match: \] + scope: punctuation.section.sequence.end.graphql + pop: true + - match: (?=\S) + push: value + + - match: \{ + scope: punctuation.section.mapping.begin.graphql + set: + - meta_scope: meta.mapping.graphql + - match: \} + scope: punctuation.section.mapping.end.graphql + pop: true + - match: '{{name}}' + scope: meta.mapping.key.graphql + push: + - match: ':' + scope: punctuation.separator.key-value.graphql + set: value + - include: else-pop + + - include: else-pop \ No newline at end of file diff --git a/assets/js-babel.sublime-syntax b/assets/js-babel.sublime-syntax new file mode 100644 index 0000000..338ed85 --- /dev/null +++ b/assets/js-babel.sublime-syntax @@ -0,0 +1,1290 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: JavaScript (Babel) +file_extensions: + - js + - mjs + - jsx + - babel + - es6 + - cjs +first_line_match: ^#!\s*/.*\b(node|js)$\n? +scope: source.js +contexts: + main: + - include: core + brackets: + - include: round-brackets + - include: square-brackets + - include: curly-brackets + class-method-definition: + - match: '(@@[_$a-zA-Z][$\w]*|static|return)(?=\s*[<(])|(?=\s*<)' + captures: + 1: keyword.operator.flowtype.js + push: + - meta_scope: meta.short-method.flowtype.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: '(?<=[]"''])\s*(?=[<(])' + push: + - meta_scope: meta.class-method.computed.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: |- + (?x) + ((?>get|set)\s+) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + )(?=\s*[<(]) + captures: + 1: storage.type.js + 2: string.quoted.js + 3: punctuation.definition.string.begin.js + 4: entity.name.function.js + 5: punctuation.definition.string.end.js + 6: string.quoted.js + 7: punctuation.definition.string.begin.js + 8: entity.name.function.js + 9: punctuation.definition.string.end.js + 10: string.unquoted.js + 11: entity.name.function.js + push: + - meta_scope: meta.class-accessor.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + )(?=\s*[<(]) + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + push: + - meta_scope: meta.class-method.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + class-method-storage: + - match: (?static|declare)\b + scope: storage.modifier.js + - match: (?) + scope: comment.block.html.js + captures: + 0: punctuation.definition.comment.js + - match: (//).*$\n? + scope: comment.line.double-slash.js + captures: + 1: punctuation.definition.comment.js + - match: ^(#!).*$\n? + scope: comment.line.shebang.js + captures: + 1: punctuation.definition.comment.js + core: + - include: literal-function-labels + - include: literal-arrow-function-labels + - include: literal-labels + - include: literal-for + - include: literal-switch + - include: styled-components + - include: graphql + - include: expression + - include: literal-punctuation + curly-brackets: + - match: "{" + captures: + 0: meta.brace.curly.begin.js + push: + - meta_scope: meta.group.braces.curly.js + - match: "}" + captures: + 0: meta.brace.curly.end.js + pop: true + - include: main + es7-decorators: + - match: |- + (?x) + (@)([_$a-zA-Z][$\w]*)\b + scope: tag.decorator.js + captures: + 1: punctuation.definition.tag.js + 2: entity.name.tag.js + expression: + - include: merge-conflits + - include: literal-regexp + - include: literal-jsx + - include: es7-decorators + - include: support-class + - include: support-other + - include: literal-function + - include: literal-arrow-function + - include: literal-prototype + - include: literal-keywords + - include: literal-method + - include: literal-module + - include: literal-class + - include: flowtype-declaration + - include: literal-number + - include: literal-template-string + - include: literal-string + - include: literal-language-constant + - include: literal-language-variable + - include: literal-constructor + - include: literal-method-call + - include: literal-function-call + - include: comments + - include: brackets + - include: literal-operators + - include: literal-variable + flowtype-annotation: + - match: (?:(\?)\s*)?(:) + captures: + 1: keyword.operator.flowtype.optional.js + 2: keyword.operator.flowtype.annotation.js + push: + - meta_scope: meta.flowtype.annotation.js + - include: flowtype-tokens + - match: (?=\S) + pop: true + flowtype-brackets: + - match: "{" + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: "}" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + flowtype-declaration: + - match: (?" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + flowtype-tokens: + - match: '(?<=[:?|&=])(?=\s*{)' + push: + - match: "(?<=})" + pop: true + - include: flowtype-brackets + - match: '\s*([|&])\s*' + scope: meta.flowtype.set.js + captures: + 1: keyword.operator.flowtype.other.js + - match: '[*:?&|.]|\.\.\.|\b(typeof)\b' + scope: keyword.operator.flowtype.other.js + - match: < + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: ">" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: '\[' + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: '\]' + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: \( + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: \) + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: "=>" + captures: + 0: keyword.operator.flowtype.js + push: + - meta_scope: meta.flowtype.function.js + - match: "(?<=}|[_$a-zA-Z])" + pop: true + - include: flowtype-brackets + - include: flowtype-identifier + - include: comments + - include: flowtype-identifier + - include: literal-string + - include: comments + function-declaration-parameters: + - match: \( + captures: + 0: punctuation.definition.parameters.begin.js + push: + - match: \) + captures: + 0: punctuation.definition.parameters.end.js + pop: true + - include: comments + - include: flowtype-annotation + - match: (?" + captures: + 0: meta.tag.jsx punctuation.definition.tag.end.jsx + push: + - match: (?=)|(/>) + captures: + 1: meta.tag.jsx punctuation.definition.tag.begin.jsx + 2: meta.tag.jsx entity.name.tag.jsx + 3: meta.tag.jsx punctuation.definition.tag.end.jsx + 4: meta.tag.jsx punctuation.definition.tag.end.jsx + pop: true + - include: jsx-tag-end + - include: jsx-attributes + - match: < + scope: invalid.illegal.tag.incomplete.jsx + literal-arrow-function: + - match: |- + (?x) + (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? + (?:\b(async)\s+)? + (?=(\((?>(?>[^()]+))*\))\s*(=>)) + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + push: + - meta_scope: meta.function.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? + (?:(async)\s+)? + \b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.arrow.js + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + 4: variable.parameter.function.js + 5: storage.type.function.arrow.js + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*(?=(\((?>(?>[^()]+))*\))\s*(=>)) + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + push: + - meta_scope: meta.prototype.function.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.prototype.function.arrow.js + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + 8: variable.parameter.function.js + 9: storage.type.function.arrow.js + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*(?=(\((?>(?>[^()]+))*\))\s*(=>)) + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + push: + - meta_scope: meta.function.static.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.static.arrow.js + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + 6: variable.parameter.function.js + 7: storage.type.function.arrow.js + literal-arrow-function-labels: + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*(?=(\((?>(?>[^()]+))*\))\s*(=>)) + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + push: + - meta_scope: meta.function.json.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.json.arrow.js + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + 13: variable.parameter.function.js + 14: storage.type.function.arrow.js + literal-class: + - match: (?\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)? + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + 4: storage.type.function.js + 5: keyword.generator.asterisk.js + 6: entity.name.function.js + push: + - meta_scope: meta.function.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(?:(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)?\s* + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + 8: storage.type.function.js + 9: keyword.generator.asterisk.js + 10: entity.name.function.js + push: + - meta_scope: meta.function.prototype.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(?:(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)?\s* + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + 6: storage.type.function.js + 7: keyword.generator.asterisk.js + 8: entity.name.function.js + push: + - meta_scope: meta.function.static.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + literal-function-call: + - match: '([_$a-zA-Z][$\w]*)\s*(\(\s*\))' + scope: meta.function-call.without-arguments.js + captures: + 1: variable.function.js + 2: meta.group.braces.round.function.arguments.js + - match: '([_$a-zA-Z][$\w]*)\s*(?=\()' + scope: meta.function-call.with-arguments.js + captures: + 1: variable.function.js + - match: '([_$a-zA-Z][$\w]*)\s*(?=`)' + scope: meta.function-call.tagged-template.js + captures: + 1: variable.function.js + literal-function-labels: + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)? + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + 13: storage.type.function.js + 14: keyword.generator.asterisk.js + 15: entity.name.function.js + push: + - meta_scope: meta.function.json.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + literal-jsx: + - match: '(?<=\(|\{|\[|,|&&|\|\||\?|:|=|=>|\Wreturn|^return|\Wdefault|^)(?=\s*<[_$a-zA-Z])' + push: + - meta_content_scope: meta.jsx.js + - match: (?<=/>|>) + pop: true + - include: jsx-tag-start + literal-keyword-storage: + - match: (?const|let|var)\b + scope: storage.type.js + literal-keywords: + - include: literal-keyword-storage + - match: (?await|yield))\b(?:\s*(\*))? + captures: + 1: keyword.control.flow.js + 2: keyword.generator.asterisk.js + - match: (?if|else)\b + scope: keyword.control.conditional.js + - match: (?catch|finally|throw|try)\b + scope: keyword.control.trycatch.js + - match: (?break|continue|do|goto|while|case|default)\b + scope: keyword.control.loop.js + - match: (?enum|module|public|package|private|interface|protected)\b + scope: keyword.other.reserved.js + - match: (? + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + )\s*:) + push: + - match: ":" + captures: + 0: punctuation.separator.key-value.js + pop: true + - include: literal-string + - match: '(? + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + (?=\s*(\((?>(?>[^()]+))*\))(?>\s|/\*.*\*/)*\{) + captures: + 1: storage.type.js + 2: storage.type.js + 3: keyword.generator.asterisk.js + 4: string.quoted.js + 5: punctuation.definition.string.begin.js + 6: entity.name.function.js + 7: punctuation.definition.string.end.js + 8: string.quoted.js + 9: punctuation.definition.string.begin.js + 10: entity.name.function.js + 11: punctuation.definition.string.end.js + 12: string.unquoted.js + 13: entity.name.function.js + push: + - meta_scope: meta.method.js + - match: (?<=\)) + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + \b(?:(static)\s+)? + (get|set)\s+ + ([_$a-zA-Z][$\w]*|\d+)\s* + (?=(\((?>(?>[^()]+))*\))(?>\s|/\*.*\*/)*\{) + captures: + 1: storage.type.js + 2: storage.type.accessor.js + 3: entity.name.accessor.js + push: + - meta_scope: meta.accessor.js + - match: (?<=\)) + pop: true + - include: function-declaration-parameters + literal-method-call: + - match: |- + (?x) + (?:(?<=\.)|\b) + ([A-Z][$\w]*)\s*(\.) + ([_$a-zA-Z][$\w]*)\s* + (\(\s*\)) + scope: meta.function-call.static.without-arguments.js + captures: + 1: variable.other.class.js + 2: keyword.operator.accessor.js + 3: variable.function.js + 4: meta.group.braces.round.function.arguments.js + - match: |- + (?x) + (?:(?<=\.)|\b) + ([A-Z][$\w]*)\s*(\.) + ([_$a-zA-Z][$\w]*)\s* + (?=\() + scope: meta.function-call.static.with-arguments.js + captures: + 1: variable.other.class.js + 2: keyword.operator.accessor.js + 3: variable.function.js + - match: |- + (?x) + (?<=\.) + ([_$a-zA-Z][$\w]*)\s* + (\(\s*\)) + scope: meta.function-call.method.without-arguments.js + captures: + 1: variable.function.js + 2: meta.group.braces.round.function.arguments.js + - match: |- + (?x) + (?<=\.) + ([_$a-zA-Z][$\w]*)\s* + (?=\() + scope: meta.function-call.method.with-arguments.js + captures: + 1: variable.function.js + literal-module: + - match: (?import|export|default|from|as)\b + scope: keyword.operator.module.js + literal-number: + - match: '(?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+)' + scope: invalid.illegal.numeric.hex.js + - match: '(?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+)' + scope: invalid.illegal.numeric.octal.js + - match: |- + (?xi) + (?:\B[-+])? + (?: + \b0b[0-1]*| # binary + \b0o[0-7]*| # octal + \b0x[0-9a-f]*| # hex + ( + \B\.[0-9]+| # e.g. .999 + \b[0-9]+(\.[0-9]*)? # e.g. 999.999, 999. or 999 + )(e[-+]?[0-9]+)? # e.g. e+123, E-123 + ) + scope: constant.numeric.js + - match: '(?:\B[-+]|\b)(Infinity)\b' + scope: constant.language.infinity.js + literal-operators: + - match: (?delete|instanceof|in|new|of|typeof|void|with)\b + scope: keyword.operator.js + - match: |- + (?x) + !(?!=)| # logical-not right-to-left right + && | # logical-and left-to-right both + \|\| # logical-or left-to-right both + scope: keyword.operator.logical.js + - match: |- + (?x) + =(?!=) # assignment right-to-left both + scope: keyword.operator.assignment.js + - match: |- + (?x) + %= | # assignment right-to-left both + &= | # assignment right-to-left both + \*= | # assignment right-to-left both + \+= | # assignment right-to-left both + -= | # assignment right-to-left both + /= | # assignment right-to-left both + \^= | # assignment right-to-left both + \|= | # assignment right-to-left both + <<= | # assignment right-to-left both + >>= | # assignment right-to-left both + >>>= # assignment right-to-left both + scope: keyword.operator.assignment.augmented.js + - match: |- + (?x) + ~ | # bitwise-not right-to-left right + << | # bitwise-shift left-to-right both + >>> | # bitwise-shift left-to-right both + >> | # bitwise-shift left-to-right both + & | # bitwise-and left-to-right both + \^ | # bitwise-xor left-to-right both + \| # bitwise-or left-to-right both + scope: keyword.operator.bitwise.js + - match: |- + (?x) + <= | # relational left-to-right both + >= | # relational left-to-right both + < | # relational left-to-right both + > # relational left-to-right both + scope: keyword.operator.relational.js + - match: |- + (?x) + === | # equality left-to-right both + !== | # equality left-to-right both + == | # equality left-to-right both + != # equality left-to-right both + scope: keyword.operator.comparison.js + - match: |- + (?x) + -- | # decrement n/a right-or-left + \+\+ | # increment n/a right-or-left + / | # division left-to-right both + % | # modulus left-to-right both + \* | # multiplication left-to-right both + \+ | # addition left-to-right both + - # subtraction left-to-right both + scope: keyword.operator.arithmetic.js + - match: "[?:]" + scope: keyword.operator.ternary.js + - match: (?|<=|>=|==|!=|===|!==|\+|-|\*|%|\+\+|--|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|/|/=| + \Wnew|\Wdelete|\Wvoid|\Wtypeof|\Winstanceof|\Win|\Wdo|\Wreturn|\Wcase|\Wthrow|\Wyield| + ^new|^delete|^void|^typeof|^instanceof|^in|^do|^return|^case|^throw|^yield|^ + )\s* + (/) + (?!/|\*|$) + captures: + 1: punctuation.definition.string.begin.js + push: + - meta_scope: string.regexp.js + - match: "(/)([gimy]*)" + captures: + 1: punctuation.definition.string.end.js + 2: keyword.other.js + pop: true + - include: scope:source.regexp.js + literal-string: + - match: '(["''])' + captures: + 0: punctuation.definition.string.begin.js + push: + - meta_scope: string.quoted.js + - match: (\1)|(\n) + captures: + 1: punctuation.definition.string.end.js + 2: invalid.illegal.newline.js + pop: true + - include: string-content + literal-switch: + - match: (?]{7})\s(.+)$' + captures: + 1: invalid.illegal.conflict-marker.other-commit.js + 2: invalid.illegal.string.js + round-brackets: + - match: \( + captures: + 0: meta.brace.round.begin.js + push: + - meta_scope: meta.group.braces.round.js + - match: \) + captures: + 0: meta.brace.round.end.js + pop: true + - include: expression + square-brackets: + - match: '\[' + captures: + 0: meta.brace.square.begin.js + push: + - meta_scope: meta.group.braces.square.js + - match: '\]' + captures: + 0: meta.brace.square.end.js + pop: true + - include: expression + string-content: + - match: \\\s*\n + scope: constant.character.escape.newline.js + - match: '\\([1-7][0-7]{0,2}|[0-7]{2,3}|[bfnrtv0''"\\]|x\h{2}|u\{\h+\}|u\h{4})' + scope: constant.character.escape.js + styled-components: + - match: (?(?>[^()]+))*\))\s*`)' + captures: + 1: meta.function-call.with-arguments.js variable.function.js + push: + - meta_scope: meta.styled-components.js + - match: (?<=`) + captures: + 1: meta.function-call.with-arguments.js variable.function.js + pop: true + - match: \( + captures: + 0: punctuation.definition.group.begin.js + push: + - meta_scope: meta.function-call.with-arguments.js meta.group.js + - match: \) + captures: + 0: punctuation.definition.group.end.js + pop: true + - include: expression + - match: "`" + captures: + 0: punctuation.definition.string.template.begin.js + push: + - meta_content_scope: source.css.embedded.js + - match: "`" + captures: + 0: punctuation.definition.string.template.end.js + pop: true + - include: scope:source.js.css + support-class: + - match: (?Eval|Range|Reference|Syntax|Type|URI)?Error)\b + scope: support.class.error.js + - match: \b(?>Buffer)\b + scope: support.class.node.js + support-other: + - match: (?document|window)\b + scope: support.type.object.dom.js + - match: (?global|GLOBAL|root|__dirname|__filename)\b + scope: support.type.object.node.js + - match: (?\=|\>|&&|\|\||-\>|//|\?|\+\+|-|\*|/(?=([^*]|$))|\+)' + scope: keyword.operator.nix + - include: constants + - include: bad-reserved + - include: parameter-name + - include: others + function-body: + - match: '(@\s*([a-zA-Z\_][a-zA-Z0-9\_\''\-]*)\s*)?(\:)' + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression + function-body-from-colon: + - match: (\:) + captures: + 0: punctuation.definition.function.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression + function-contents: + - include: bad-reserved + - include: function-parameter + - include: others + function-definition: + - match: (?=.?) + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: function-body-from-colon + - match: (?=.?) + push: + - match: (?=\:) + pop: true + - match: '(\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*)' + captures: + 0: variable.parameter.function.4.nix + push: + - match: (?=\:) + pop: true + - match: \@ + push: + - match: (?=\:) + pop: true + - include: function-header-until-colon-no-arg + - include: others + - include: others + - match: '(?=\{)' + push: + - match: (?=\:) + pop: true + - include: function-header-until-colon-with-arg + - include: others + function-definition-brace-opened: + - match: (?=.?) + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: function-body-from-colon + - match: (?=.?) + push: + - match: (?=\:) + pop: true + - include: function-header-close-brace-with-arg + - match: (?=.?) + push: + - match: '(?=\})' + pop: true + - include: function-contents + - include: others + function-for-sure: + - match: '(?=(\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*\s*[:@]|\{[^}]*\}\s*:|\{[^#}"''/=]*[,\?]))' + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: function-definition + function-header-close-brace-no-arg: + - match: '\}' + captures: + 0: punctuation.definition.entity.function.nix + push: + - match: (?=\:) + pop: true + - include: others + function-header-close-brace-with-arg: + - match: '\}' + captures: + 0: punctuation.definition.entity.function.nix + push: + - match: (?=\:) + pop: true + - include: function-header-terminal-arg + - include: others + function-header-open-brace: + - match: '\{' + captures: + 0: punctuation.definition.entity.function.2.nix + push: + - match: '(?=\})' + pop: true + - include: function-contents + function-header-terminal-arg: + - match: (?=@) + push: + - match: (?=\:) + pop: true + - match: \@ + push: + - match: (?=\:) + pop: true + - match: '(\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*)' + push: + - meta_scope: variable.parameter.function.3.nix + - match: (?=\:) + pop: true + - include: others + - include: others + function-header-until-colon-no-arg: + - match: '(?=\{)' + push: + - match: (?=\:) + pop: true + - include: function-header-open-brace + - include: function-header-close-brace-no-arg + function-header-until-colon-with-arg: + - match: '(?=\{)' + push: + - match: (?=\:) + pop: true + - include: function-header-open-brace + - include: function-header-close-brace-with-arg + function-parameter: + - match: (\.\.\.) + push: + - meta_scope: keyword.operator.nix + - match: '(,|(?=\}))' + pop: true + - include: others + - match: '\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*' + captures: + 0: variable.parameter.function.1.nix + push: + - match: '(,|(?=\}))' + captures: + 0: keyword.operator.nix + pop: true + - include: whitespace + - include: comment + - include: function-parameter-default + - include: expression + - include: others + function-parameter-default: + - match: \? + captures: + 0: keyword.operator.nix + push: + - match: "(?=[,}])" + pop: true + - include: expression + if: + - match: (?=\bif\b) + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - match: \bif\b + captures: + 0: keyword.other.nix + push: + - match: \bth(?=en\b) + captures: + 0: keyword.other.nix + pop: true + - include: expression + - match: (?<=th)en\b + captures: + 0: keyword.other.nix + push: + - match: \bel(?=se\b) + captures: + 0: keyword.other.nix + pop: true + - include: expression + - match: (?<=el)se\b + captures: + 0: keyword.other.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + captures: + 0: keyword.other.nix + pop: true + - include: expression + illegal: + - match: . + scope: invalid.illegal + interpolation: + - match: '\$\{' + captures: + 0: punctuation.section.embedded.begin.nix + push: + - meta_scope: markup.italic + - match: '\}' + captures: + 0: punctuation.section.embedded.end.nix + pop: true + - include: expression + let: + - match: (?=\blet\b) + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - match: \blet\b + captures: + 0: keyword.other.nix + push: + - match: '(?=([\])};,]|\b(in|else|then)\b))' + pop: true + - match: '(?=\{)' + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - match: '\{' + push: + - match: '\}' + pop: true + - include: attrset-contents + - match: '(^|(?<=\}))' + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression-cont + - include: others + - include: attrset-contents + - include: others + - match: \bin\b + captures: + 0: keyword.other.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression + list: + - match: '\[' + captures: + 0: punctuation.definition.list.nix + push: + - match: '\]' + captures: + 0: punctuation.definition.list.nix + pop: true + - include: expression + list-and-cont: + - match: '(?=\[)' + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: list + - include: expression-cont + operator-unary: + - match: (!|-) + scope: keyword.operator.unary.nix + others: + - include: whitespace + - include: comment + - include: illegal + parameter-name: + - match: '\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*' + captures: + 0: variable.parameter.name.nix + parameter-name-and-cont: + - match: '\b[a-zA-Z\_][a-zA-Z0-9\_\''\-]*' + captures: + 0: variable.parameter.name.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression-cont + parens: + - match: \( + captures: + 0: punctuation.definition.expression.nix + push: + - match: \) + captures: + 0: punctuation.definition.expression.nix + pop: true + - include: expression + parens-and-cont: + - match: (?=\() + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: parens + - include: expression-cont + string: + - match: (?=\'\') + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - match: \'\' + captures: + 0: punctuation.definition.string.other.start.nix + push: + - meta_scope: string.quoted.other.nix + - match: \'\'(?!\$|\'|\\.) + captures: + 0: punctuation.definition.string.other.end.nix + pop: true + - match: \'\'(\$|\'|\\.) + scope: constant.character.escape.nix + - include: interpolation + - include: expression-cont + - match: (?=\") + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: string-quoted + - include: expression-cont + - match: '(~?[a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+)' + captures: + 0: string.unquoted.path.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression-cont + - match: '(\<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>)' + captures: + 0: string.unquoted.spath.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression-cont + - match: '([a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\'']+)' + captures: + 0: string.unquoted.url.nix + push: + - match: '(?=([\])};,]|\b(else|then)\b))' + pop: true + - include: expression-cont + string-quoted: + - match: \" + captures: + 0: punctuation.definition.string.double.start.nix + push: + - meta_scope: string.quoted.double.nix + - match: \" + captures: + 0: punctuation.definition.string.double.end.nix + pop: true + - match: \\. + scope: constant.character.escape.nix + - include: interpolation + whitespace: + - match: \s+ + with-assert: + - match: '(?\= # >= + scope: keyword.operator.terraform + - match: \<\= # <= + scope: keyword.operator.terraform + - match: \=\= # == + scope: keyword.operator.terraform + - match: \!\= # != + scope: keyword.operator.terraform + - match: \+ # + + scope: keyword.operator.arithmetic.terraform + - match: \- # - + scope: keyword.operator.arithmetic.terraform + - match: \* # * + scope: keyword.operator.arithmetic.terraform + - match: \/ # / + scope: keyword.operator.arithmetic.terraform + - match: \% # % + scope: keyword.operator.arithmetic.terraform + - match: \&\& # && + scope: keyword.operator.logical.terraform + - match: \|\| # || + scope: keyword.operator.logical.terraform + - match: \! # ! + scope: keyword.operator.logical.terraform + - match: \> # > + scope: keyword.operator.terraform + - match: \< # < + scope: keyword.operator.terraform + - match: \? # ? + scope: keyword.operator.terraform + - match: \.\.\. # ... + scope: keyword.operator.terraform + - match: "\\:" # : + scope: keyword.operator.terraform + + # Terraform "import" statements + # + # https://www.terraform.io/docs/import/usage.html + imports: + - match: \s*(terraform)\s*(import)\s* + comment: Importing resources + captures: + 1: support.constant.terraform + 2: keyword.control.import.terraform + push: + - match: \" + comment: String literal label + scope: punctuation.definition.string.begin.terraform + push: + - meta_scope: string.quoted.double.terraform + - match: \" + scope: punctuation.definition.string.end.terraform + pop: true + - match: "{{identifer}}" + comment: Identifer label + scope: entity.name.label.terraform + - include: numeric_literals + - include: attribute_access + - match: $\n? + comment: Pop at newline + pop: true + + # Brackets: matches tuples and subscript notation + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#index-operator + brackets: + - match: \[ + scope: punctuation.section.brackets.begin.terraform + push: + - match: \] + scope: punctuation.section.brackets.end.terraform + pop: true + - match: (\*)\] + comment: Full-splat operator + scope: punctuation.section.brackets.end.terraform + captures: + 1: keyword.operator.splat.terraform + pop: true + - include: comma + - include: comments + - include: expressions + - include: tuple_for_expression + + # Objects: collection values + # + # Allows keys as identifiers, strings, and computed values wrapped in parens. + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#collection-values + objects: + - match: \{ + scope: punctuation.section.braces.begin.terraform + push: + - meta_scope: meta.braces.terraform + - match: \} + scope: punctuation.section.braces.end.terraform + pop: true + - include: object_for_expression + - include: comments + - match: '\s*({{identifer}})\s*(\=)\s*' + comment: Literal, named object key + captures: + 1: meta.mapping.key.terraform string.unquoted.terraform + 2: keyword.operator.terraform + push: object_key_values + - match: '((\").*(\"))\s*(\=)\s*' + comment: String object key + captures: + 1: meta.mapping.key.terraform string.quoted.double.terraform + 2: punctuation.definition.string.begin.terraform + 3: punctuation.definition.string.end.terraform + 4: keyword.operator.terraform + push: object_key_values + - match: \( + comment: Computed object key (any expression between parens) + scope: punctuation.section.parens.begin.terraform + push: + - meta_scope: meta.mapping.key.terraform + - match: '(\))\s*(\=)\s*' + captures: + 1: punctuation.section.parens.end.terraform + 2: keyword.operator.terraform + set: object_key_values + - include: expressions + + # Object key values: pop at comma, newline, and closing-bracket + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#collection-values + object_key_values: + - include: comments + - include: expressions + - match: \, + comment: Pop scope on comma. + scope: punctuation.separator.terraform + pop: true + - match: $\n? + comment: Pop scope on EOL. + pop: true + - match: (?=\}) + comment: Lookahead (don't consume) and pop scope on a bracket. + scope: punctuation.section.braces.end.terraform + pop: true + + # Attribute Access: "." Identifier + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#attribute-access-operator + attribute_access: + - match: \. + scope: keyword.operator.accessor.terraform + push: + - match: "{{identifer}}" + comment: Attribute access + scope: variable.other.member.terraform + pop: true + - match: \d+ + comment: Subscript + scope: constant.numeric.integer.terraform + pop: true + - match: \* + comment: Attribute-only splat + scope: keyword.operator.splat.terraform + pop: true + + # Attribute Definition: Identifier "=" Expression Newline + # + # The "=" operator cannot be immediately followed by "=" + # ">", as those are other operators, not attr definitions. + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#attribute-definitions + attribute_definition: + - match: (\()?({{identifer}})(\))?\s*(\=[^\=|\>])\s* + comment: Identifier "=" with optional parens + scope: variable.declaration.terraform + captures: + 1: punctuation.section.parens.begin.terraform + 2: variable.other.readwrite.terraform + 3: punctuation.section.parens.end.terraform + 4: keyword.operator.assignment.terraform + + # Functions: Terraform builtins and unknown + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#functions-and-function-calls + # https://www.terraform.io/docs/configuration/expressions.html#function-calls + functions: + - match: (({{predeclared_funcs}})|\b({{identifer}})\b)(\() + comment: Built-in function calls + captures: + 2: support.function.builtin.terraform + 3: variable.function.terraform + 4: punctuation.section.parens.begin.terraform + push: + - meta_scope: meta.function-call.terraform + - match: \) + scope: punctuation.section.parens.end.terraform + pop: true + - include: comments + - include: expressions + - include: comma + + # Tuple for-Expression: + # + # "[" "for" Identifier ("," Identifier)? "in" Expression ":" Expression ("if" Expression)? "]"; + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#for-expressions + # https://www.terraform.io/docs/configuration/expressions.html#for-expressions + tuple_for_expression: + - match: \bfor\b + comment: for expression (arrays) + scope: keyword.control.terraform + set: + - include: for_expression_body + - match: \] + scope: punctuation.section.brackets.end.terraform + pop: true + + # Object for-Expression: + # + # "{" "for" Identifier ("," Identifier)? "in" Expression ":" Expression "=>" Expression "..."? ("if" Expression)? "}"; + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#for-expressions + # https://www.terraform.io/docs/configuration/expressions.html#for-expressions + object_for_expression: + - match: \bfor\b + comment: for expression (arrays) + scope: keyword.control.terraform + set: + - match: \=\> + scope: storage.type.function.terraform + - include: for_expression_body + - match: \} + scope: punctuation.section.braces.end.terraform + pop: true + + # Shared body syntax for tuple and object for-expressions. + # They require different `set` blocks because they are + # pop'd with different characters and objects allow `=>`. + for_expression_body: + - match: \bin\b + comment: in keyword + scope: keyword.operator.word.terraform + - match: \bif\b + comment: if keyword + scope: keyword.control.conditional.terraform + - match: '\:' + scope: keyword.operator.terraform + - include: expressions + - include: comments + - include: comma + - match: "{{identifer}}" + comment: Local Identifiers + scope: variable.other.readwrite.terraform + + # Blocks: Identifier (StringLit|Identifier)* "{" Newline Body "}" Newline; + # + # https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md#structural-elements + block: + - match: '(\b({{terraform_known_blocks}})\b|({{identifer}}))(?=[\s\"\-[:word:]]*(\{))' + captures: + 2: storage.type.terraform + 3: entity.name.type.terraform + push: + - meta_scope: meta.type.terraform + - match: \" + comment: String literal label + scope: punctuation.definition.string.begin.terraform + push: + - meta_scope: string.quoted.double.terraform + - match: \" + scope: punctuation.definition.string.end.terraform + pop: true + - match: "{{identifer}}" + comment: Identifer label + scope: entity.name.label.terraform + - match: \{ + scope: punctuation.section.block.begin.terraform + set: + - meta_scope: meta.block.terraform + - include: main + - match: \} + scope: punctuation.section.block.end.terraform + pop: true \ No newline at end of file diff --git a/assets/tsx.sublime-syntax b/assets/tsx.sublime-syntax new file mode 100644 index 0000000..b4d6e86 --- /dev/null +++ b/assets/tsx.sublime-syntax @@ -0,0 +1,3580 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: TypeScriptReact +file_extensions: + - tsx +scope: source.tsx +contexts: + main: + - include: directives + - include: statements + - include: shebang + comment: + - match: /\*\*(?!/) + captures: + 0: punctuation.definition.comment.tsx + push: + - meta_scope: comment.block.documentation.tsx + - match: \*/ + captures: + 0: punctuation.definition.comment.tsx + pop: true + - include: docblock + - match: (/\*)(?:\s*((@)internal)(?=\s|(\*/)))? + captures: + 1: punctuation.definition.comment.tsx + 2: storage.type.internaldeclaration.tsx + 3: punctuation.decorator.internaldeclaration.tsx + push: + - meta_scope: comment.block.tsx + - match: \*/ + captures: + 0: punctuation.definition.comment.tsx + pop: true + - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)' + captures: + 1: punctuation.whitespace.comment.leading.tsx + 2: comment.line.double-slash.tsx + 3: punctuation.definition.comment.tsx + 4: storage.type.internaldeclaration.tsx + 5: punctuation.decorator.internaldeclaration.tsx + push: + - meta_content_scope: comment.line.double-slash.tsx + - match: (?=$) + pop: true + access-modifier: + - match: '(?]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)' + captures: + 1: punctuation.definition.block.tsx + push: + - meta_scope: meta.objectliteral.tsx + - match: '\}' + captures: + 0: punctuation.definition.block.tsx + pop: true + - include: object-member + array-binding-pattern: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: binding-element + - include: punctuation-comma + array-binding-pattern-const: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: binding-element-const + - include: punctuation-comma + array-literal: + - match: '\s*(\[)' + captures: + 1: meta.brace.square.tsx + push: + - meta_scope: meta.array.literal.tsx + - match: '\]' + captures: + 0: meta.brace.square.tsx + pop: true + - include: expression + - include: punctuation-comma + arrow-function: + - match: '(?:(?)' + scope: meta.arrow.tsx + captures: + 1: storage.modifier.async.tsx + 2: variable.parameter.tsx + - match: |- + (?x) (?: + (? is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + ) + ) + captures: + 1: storage.modifier.async.tsx + push: + - meta_scope: meta.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: comment + - include: type-parameters + - include: function-parameters + - include: arrow-return-type + - include: possibly-arrow-return-type + - match: "=>" + captures: + 0: storage.type.function.arrow.tsx + push: + - meta_scope: meta.arrow.tsx + - match: '((?<=\}|\S)(?)|((?!\{)(?=\S)))(?!\/[\/\*])' + pop: true + - include: single-line-comment-consuming-line-ending + - include: decl-block + - include: expression + arrow-return-type: + - match: (?<=\))\s*(:) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.return.type.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: arrow-return-type-body + arrow-return-type-body: + - match: '(?<=[:])(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type + async-modifier: + - match: '(?\s*$)' + captures: + 1: punctuation.definition.comment.tsx + push: + - meta_scope: comment.line.triple-slash.directive.tsx + - match: (?=$) + pop: true + - match: (<)(reference|amd-dependency|amd-module) + captures: + 1: punctuation.definition.tag.directive.tsx + 2: entity.name.tag.directive.tsx + push: + - meta_scope: meta.tag.tsx + - match: /> + captures: + 0: punctuation.definition.tag.directive.tsx + pop: true + - match: path|types|no-default-lib|lib|name + scope: entity.other.attribute-name.directive.tsx + - match: "=" + scope: keyword.operator.assignment.tsx + - include: string + docblock: + - match: |- + (?x) + ((@)(?:access|api)) + \s+ + (private|protected|public) + \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.access-type.jsdoc + - match: |- + (?x) + ((@)author) + \s+ + ( + [^@\s<>*/] + (?:[^@<>*/]|\*[^/])* + ) + (?: + \s* + (<) + ([^>\s]+) + (>) + )? + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: punctuation.definition.bracket.angle.begin.jsdoc + 5: constant.other.email.link.underline.jsdoc + 6: punctuation.definition.bracket.angle.end.jsdoc + - match: |- + (?x) + ((@)borrows) \s+ + ((?:[^@\s*/]|\*[^/])+) # + \s+ (as) \s+ # as + ((?:[^@\s*/]|\*[^/])+) # + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: keyword.operator.control.jsdoc + 5: entity.name.type.instance.jsdoc + - match: ((@)example)\s+ + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - meta_scope: meta.example.jsdoc + - match: (?=@|\*/) + pop: true + - match: ^\s\*\s+ + - match: \G(<)caption(>) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + push: + - meta_content_scope: constant.other.description.jsdoc + - match: ()|(?=\*/) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + pop: true + - match: '[^\s@*](?:[^*]|\*[^/])*' + captures: + 0: source.embedded.tsx + - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.symbol-type.jsdoc + - match: |- + (?x) + ((@)see) + \s+ + (?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ + ) + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.link.underline.jsdoc + 4: entity.name.type.instance.jsdoc + - match: |- + (?x) + ((@)template) + \s+ + # One or more valid identifiers + ( + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: |- + (?x) + ( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) + ) + \s+ + ( + [A-Za-z_$] + [\w$.\[\]]* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '((@)typedef)\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '(?:[^@\s*/]|\*[^/])+' + scope: entity.name.type.instance.jsdoc + - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '([A-Za-z_$][\w$.\[\]]*)' + scope: variable.other.jsdoc + - match: |- + (?x) + (\[)\s* + [\w$]+ + (?: + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ + )* + (?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else + )* + ) + )? + \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + scope: variable.other.jsdoc + captures: + 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc + 2: keyword.operator.assignment.jsdoc + 3: source.embedded.tsx + 4: punctuation.definition.optional-value.end.bracket.square.jsdoc + 5: invalid.illegal.syntax.jsdoc + - match: |- + (?x) + ( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|suppress|this|throws|type + |yields?) + ) + \s+(?={) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: |- + (?x) + ( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) + ) + \s+ + ( + (?: + [^{}@\s*] | \*[^/] + )+ + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + 4: punctuation.definition.string.begin.jsdoc + push: + - meta_content_scope: variable.other.jsdoc + - match: (\3)|(?=$|\*/) + captures: + 0: variable.other.jsdoc + 1: punctuation.definition.string.end.jsdoc + pop: true + - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b' + scope: storage.type.class.jsdoc + captures: + 1: punctuation.definition.block.tag.jsdoc + - include: inline-tags + - match: '((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + enum-declaration: + - match: '(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | + (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: storage.modifier.tsx + 2: keyword.operator.rest.tsx + 3: entity.name.function.tsx variable.language.this.tsx + 4: entity.name.function.tsx + 5: keyword.operator.optional.tsx + - match: '(?x)(?:(?]|\|\||\&\&|\!\=\=|$|((?>=|>>>=|\|= + scope: keyword.operator.assignment.compound.bitwise.tsx + - match: "<<|>>>|>>" + scope: keyword.operator.bitwise.shift.tsx + - match: "===|!==|==|!=" + scope: keyword.operator.comparison.tsx + - match: <=|>=|<>|<|> + scope: keyword.operator.relational.tsx + - match: '(?<=[_$[:alnum:]])(\!)\s*(?:(/=)|(?:(/)(?![/*])))' + captures: + 1: keyword.operator.logical.tsx + 2: keyword.operator.assignment.compound.tsx + 3: keyword.operator.arithmetic.tsx + - match: \!|&&|\|\||\?\? + scope: keyword.operator.logical.tsx + - match: \&|~|\^|\| + scope: keyword.operator.bitwise.tsx + - match: \= + scope: keyword.operator.assignment.tsx + - match: "--" + scope: keyword.operator.decrement.tsx + - match: \+\+ + scope: keyword.operator.increment.tsx + - match: '%|\*|/|-|\+' + scope: keyword.operator.arithmetic.tsx + - match: '(?<=[_$[:alnum:])\]])\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)+(?:(/=)|(?:(/)(?![/*]))))' + push: + - match: '(?:(/=)|(?:(/)(?!\*([^\*]|(\*[^\/]))*\*\/)))' + captures: + 1: keyword.operator.assignment.compound.tsx + 2: keyword.operator.arithmetic.tsx + pop: true + - include: comment + - match: '(?<=[_$[:alnum:])\]])\s*(?:(/=)|(?:(/)(?![/*])))' + captures: + 1: keyword.operator.assignment.compound.tsx + 2: keyword.operator.arithmetic.tsx + expressionPunctuations: + - include: punctuation-comma + - include: punctuation-accessor + expressionWithoutIdentifiers: + - include: jsx + - include: string + - include: regex + - include: comment + - include: function-expression + - include: class-expression + - include: arrow-function + - include: paren-expression-possibly-arrow + - include: cast + - include: ternary-expression + - include: new-expr + - include: instanceof-expr + - include: object-literal + - include: expression-operators + - include: function-call + - include: literal + - include: support-objects + - include: paren-expression + field-declaration: + - match: |- + (?x)(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | + (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.property.tsx entity.name.function.tsx + 2: keyword.operator.optional.tsx + 3: keyword.operator.definiteassignment.tsx + - match: '\#?[_$[:alpha:]][_$[:alnum:]]*' + scope: meta.definition.property.tsx variable.object.property.tsx + - match: \? + scope: keyword.operator.optional.tsx + - match: \! + scope: keyword.operator.definiteassignment.tsx + for-loop: + - match: '(?\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)?\())' + push: + - match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)?\())' + pop: true + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))' + push: + - meta_scope: meta.function-call.tsx + - match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)?\())' + pop: true + - include: function-call-target + - include: comment + - include: function-call-optionals + - include: type-arguments + - include: paren-expression + - match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))' + push: + - match: '(?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))' + pop: true + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))' + push: + - meta_scope: meta.function-call.tsx + - match: '(?=(<\s*[\{\[\(]\s*$))' + pop: true + - include: function-call-target + - include: comment + - include: function-call-optionals + - include: type-arguments + function-call-optionals: + - match: \?\. + scope: meta.function-call.tsx punctuation.accessor.optional.tsx + - match: \! + scope: meta.function-call.tsx keyword.operator.definiteassignment.tsx + function-call-target: + - include: support-function-call-identifiers + - match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)' + scope: entity.name.function.tsx + function-declaration: + - match: '(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: entity.name.function.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: variable.other.constant.property.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(\#?[_$[:alpha:]][_$[:alnum:]]*)' + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: variable.other.property.tsx + - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" + scope: variable.other.constant.tsx + - match: "[_$[:alpha:]][_$[:alnum:]]*" + scope: variable.other.readwrite.tsx + if-statement: + - match: '(?]|\|\||\&\&|\!\=\=|$|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?))' + push: + - meta_scope: meta.tag.tsx + - match: '(/>)|(?:())' + captures: + 1: punctuation.definition.tag.end.tsx + 2: punctuation.definition.tag.begin.tsx + 3: entity.name.tag.namespace.tsx + 4: punctuation.separator.namespace.tsx + 5: entity.name.tag.tsx + 6: support.class.component.tsx + 7: punctuation.definition.tag.end.tsx + pop: true + - match: '(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?)' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + push: + - match: "(?=[/]?>)" + pop: true + - include: comment + - include: type-arguments + - include: jsx-tag-attributes + - match: (>) + captures: + 1: punctuation.definition.tag.end.tsx + push: + - meta_content_scope: meta.jsx.children.tsx + - match: (?=|/\*|//) + captures: + 1: entity.other.attribute-name.namespace.tsx + 2: punctuation.separator.namespace.tsx + 3: entity.other.attribute-name.tsx + jsx-tag-attributes: + - match: \s+ + push: + - meta_scope: meta.tag.attributes.tsx + - match: "(?=[/]?>)" + pop: true + - include: comment + - include: jsx-tag-attribute-name + - include: jsx-tag-attribute-assignment + - include: jsx-string-double-quoted + - include: jsx-string-single-quoted + - include: jsx-evaluated-code + - include: jsx-tag-attributes-illegal + jsx-tag-attributes-illegal: + - match: \S+ + scope: invalid.illegal.attribute.tsx + jsx-tag-in-expression: + - match: |- + (?x) + (?:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s* + (?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow + (?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?)) + push: + - match: '(?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))' + pop: true + - include: jsx-tag + jsx-tag-without-attributes: + - match: '(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?)' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + 6: punctuation.definition.tag.end.tsx + push: + - meta_scope: meta.tag.without-attributes.tsx + - meta_content_scope: meta.jsx.children.tsx + - match: '()' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + 6: punctuation.definition.tag.end.tsx + pop: true + - include: jsx-children + jsx-tag-without-attributes-in-expression: + - match: '(?:*]|&&|\|\||\?|\*\/|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*(?=(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))' + push: + - match: '(?!(<)\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))' + pop: true + - include: jsx-tag-without-attributes + label: + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{)' + captures: + 1: entity.name.label.tsx + 2: punctuation.separator.label.tsx + push: + - match: '(?<=\})' + pop: true + - include: decl-block + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)' + captures: + 1: entity.name.label.tsx + 2: punctuation.separator.label.tsx + literal: + - include: numeric-literal + - include: boolean-literal + - include: null-literal + - include: undefined-literal + - include: numericConstant-literal + - include: array-literal + - include: this-literal + - include: super-literal + method-declaration: + - match: '(?x)(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(])' + captures: + 1: storage.modifier.tsx + 2: storage.modifier.tsx + 3: storage.modifier.tsx + 4: storage.modifier.async.tsx + 5: keyword.operator.new.tsx + 6: keyword.generator.asterisk.tsx + push: + - meta_scope: meta.method.declaration.tsx + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: method-declaration-name + - include: function-body + - match: |- + (?x)(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + captures: + 1: storage.modifier.tsx + 2: storage.modifier.tsx + 3: storage.modifier.tsx + 4: storage.modifier.async.tsx + 5: storage.type.property.tsx + 6: keyword.generator.asterisk.tsx + push: + - meta_scope: meta.method.declaration.tsx + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: method-declaration-name + - include: function-body + method-declaration-name: + - match: |- + (?x)(?=((\b(?]|\|\||\&\&|\!\=\=|$|((?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + captures: + 1: storage.modifier.async.tsx + 2: storage.type.property.tsx + 3: keyword.generator.asterisk.tsx + push: + - meta_scope: meta.method.declaration.tsx + - match: '(?=\}|;|,)|(?<=\})' + pop: true + - include: method-declaration-name + - include: function-body + - match: |- + (?x)(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?[\(]) + captures: + 1: storage.modifier.async.tsx + 2: storage.type.property.tsx + 3: keyword.generator.asterisk.tsx + push: + - match: (?=\(|\<) + pop: true + - include: method-declaration-name + object-member: + - include: comment + - include: object-literal-method-declaration + - match: '(?=\[)' + push: + - meta_scope: meta.object.member.tsx meta.object-literal.key.tsx + - match: '(?=:)|((?<=[\]])(?=\s*[\(\<]))' + pop: true + - include: comment + - include: array-literal + - match: '(?=[\''\"\`])' + push: + - meta_scope: meta.object.member.tsx meta.object-literal.key.tsx + - match: '(?=:)|((?<=[\''\"\`])(?=((\s*[\(\<,}])|(\s+(as)\s+))))' + pop: true + - include: comment + - include: string + - match: |- + (?x)(?=(\b(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + scope: meta.object.member.tsx + captures: + 0: meta.object-literal.key.tsx + 1: entity.name.function.tsx + - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*:)' + scope: meta.object.member.tsx + captures: + 0: meta.object-literal.key.tsx + - match: \.\.\. + captures: + 0: keyword.operator.spread.tsx + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\})' + pop: true + - include: expression + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*)' + scope: meta.object.member.tsx + captures: + 1: variable.other.readwrite.tsx + - match: '(?]|\|\||\&\&|\!\=\=|$|^|((?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: type-parameters + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + - match: '(?<=:)\s*(async)?\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))' + captures: + 1: storage.modifier.async.tsx + 2: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + - match: (?<=:)\s*(async)?\s*(?=\<\s*$) + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\>) + pop: true + - include: type-parameters + - match: '(?<=\>)\s*(\()(?=\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))' + captures: + 1: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + - include: possibly-arrow-return-type + - include: expression + - include: punctuation-comma + parameter-array-binding-pattern: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: parameter-binding-element + - include: punctuation-comma + parameter-binding-element: + - include: comment + - include: string + - include: numeric-literal + - include: regex + - include: parameter-object-binding-pattern + - include: parameter-array-binding-pattern + - include: destructuring-parameter-rest + - include: variable-initializer + parameter-name: + - match: '(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | + (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: storage.modifier.tsx + 2: keyword.operator.rest.tsx + 3: entity.name.function.tsx variable.language.this.tsx + 4: entity.name.function.tsx + 5: keyword.operator.optional.tsx + - match: '(?x)(?:(?])" + pop: true + - include: type + paren-expression: + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression + paren-expression-possibly-arrow: + - match: '(?<=[(=,])\s*(async)?(?=\s*((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\(\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: paren-expression-possibly-arrow-with-typeparameters + - match: '(?<=[(=,]|=>|^return|[^\._$[:alnum:]]return)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*))?\()|(<))\s*$)' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: paren-expression-possibly-arrow-with-typeparameters + - include: possibly-arrow-return-type + paren-expression-possibly-arrow-with-typeparameters: + - include: type-parameters + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + possibly-arrow-return-type: + - match: '(?<=\)|^)\s*(:)(?=\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*=>)' + captures: + 1: meta.arrow.tsx meta.return.type.arrow.tsx keyword.operator.type.annotation.tsx + push: + - meta_content_scope: meta.arrow.tsx meta.return.type.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: arrow-return-type-body + property-accessor: + - match: '(?|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[\()]|\\.|\[([^\]\\]|\\.)+\]|\(([^\)\\]|\\.)+\))+\/([dgimsuy]+|(?![\/\*])|(?=\/\*))(?!\s*[a-zA-Z0-9_$]))' + captures: + 1: punctuation.definition.string.begin.tsx + push: + - meta_scope: string.regexp.tsx + - match: "(/)([dgimsuy]*)" + captures: + 1: punctuation.definition.string.end.tsx + 2: keyword.other.tsx + pop: true + - include: regexp + - match: '((?' + captures: + 0: keyword.other.back-reference.regexp + 1: variable.other.regexp + - match: '[?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??' + scope: keyword.operator.quantifier.regexp + - match: \| + scope: keyword.operator.or.regexp + - match: (\()((\?=)|(\?!)|(\?<=)|(\?))?' + captures: + 0: punctuation.definition.group.regexp + 1: punctuation.definition.group.no-capture.regexp + 2: variable.other.regexp + push: + - meta_scope: meta.group.regexp + - match: \) + captures: + 0: punctuation.definition.group.regexp + pop: true + - include: regexp + - match: '(\[)(\^)?' + captures: + 1: punctuation.definition.character-class.regexp + 2: keyword.operator.negation.regexp + push: + - meta_scope: constant.other.character-class.set.regexp + - match: '(\])' + captures: + 1: punctuation.definition.character-class.regexp + pop: true + - match: '(?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))' + scope: constant.other.character-class.range.regexp + captures: + 1: constant.character.numeric.regexp + 2: constant.character.control.regexp + 3: constant.character.escape.backslash.regexp + 4: constant.character.numeric.regexp + 5: constant.character.control.regexp + 6: constant.character.escape.backslash.regexp + - include: regex-character-class + - include: regex-character-class + return-type: + - match: (?<=\))\s*(:)(?=\s*\S) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.return.type.tsx + - match: "(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\()) + | + (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$))) + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: support.variable.property.tsx + 4: support.constant.tsx + - match: |- + (?x) (?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)?\() + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: support.constant.dom.tsx + 4: support.variable.property.dom.tsx + - match: |- + (?x)(?\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)?`)' + push: + - meta_scope: string.template.tsx + - match: (?=`) + pop: true + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))' + push: + - match: '(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)?`)' + pop: true + - include: support-function-call-identifiers + - match: "([_$[:alpha:]][_$[:alnum:]]*)" + scope: entity.name.function.tagged-template.tsx + - include: type-arguments + - match: '([_$[:alpha:]][_$[:alnum:]]*)?\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(?<==)\>)*(?))*(?)*(?\s*)`)' + captures: + 1: entity.name.function.tagged-template.tsx + push: + - meta_scope: string.template.tsx + - match: (?=`) + pop: true + - include: type-arguments + template-substitution-element: + - match: '\$\{' + captures: + 0: punctuation.definition.template-expression.begin.tsx + push: + - meta_scope: meta.template.expression.tsx + - meta_content_scope: meta.embedded.line.tsx + - match: '\}' + captures: + 0: punctuation.definition.template-expression.end.tsx + pop: true + - include: expression + template-type: + - include: template-call + - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)" + captures: + 1: entity.name.function.tagged-template.tsx + 2: punctuation.definition.string.template.begin.tsx + push: + - meta_scope: string.template.tsx + - match: "`" + captures: + 0: punctuation.definition.string.template.end.tsx + pop: true + - include: template-type-substitution-element + - include: string-character-escape + template-type-substitution-element: + - match: '\$\{' + captures: + 0: punctuation.definition.template-expression.begin.tsx + push: + - meta_scope: meta.template.expression.tsx + - meta_content_scope: meta.embedded.line.tsx + - match: '\}' + captures: + 0: punctuation.definition.template-expression.end.tsx + pop: true + - include: type + ternary-expression: + - match: '(?!\?\.\s*[^[:digit:]])(\?)(?!\?)' + captures: + 1: keyword.operator.ternary.tsx + push: + - match: \s*(:) + captures: + 1: keyword.operator.ternary.tsx + pop: true + - include: expression + this-literal: + - match: '(?])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + - match: (:) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.type.annotation.tsx + - match: '(?])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + type-arguments: + - match: \< + captures: + 0: punctuation.definition.typeparameters.begin.tsx + push: + - meta_scope: meta.type.parameters.tsx + - match: \> + captures: + 0: punctuation.definition.typeparameters.end.tsx + pop: true + - include: type-arguments-body + type-arguments-body: + - match: '(?) + pop: true + - include: comment + - include: type-parameters + - match: '(?) + )) + ) + ) + ) + push: + - meta_scope: meta.type.function.tsx + - match: (?<=\)) + pop: true + - include: function-parameters + type-function-return-type: + - match: (=>)(?=\s*\S) + captures: + 1: storage.type.function.arrow.tsx + push: + - meta_scope: meta.type.function.return.tsx + - match: '(?)(?:\?]|//|$)' + pop: true + - include: type-function-return-type-core + - match: "=>" + captures: + 0: storage.type.function.arrow.tsx + push: + - meta_scope: meta.type.function.return.tsx + - match: '(?)(?]|//|^\s*$)|((?<=\S)(?=\s*$)))' + pop: true + - include: type-function-return-type-core + type-function-return-type-core: + - include: comment + - match: '(?<==>)(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type + type-name: + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*(<)' + captures: + 1: entity.name.type.module.tsx + 2: punctuation.accessor.tsx + 3: punctuation.accessor.optional.tsx + 4: meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx + push: + - meta_content_scope: meta.type.parameters.tsx + - match: (>) + captures: + 1: meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx + pop: true + - include: type-arguments-body + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(<)' + captures: + 1: entity.name.type.tsx + 2: meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx + push: + - meta_content_scope: meta.type.parameters.tsx + - match: (>) + captures: + 1: meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx + pop: true + - include: type-arguments-body + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))' + captures: + 1: entity.name.type.module.tsx + 2: punctuation.accessor.tsx + 3: punctuation.accessor.optional.tsx + - match: "[_$[:alpha:]][_$[:alnum:]]*" + scope: entity.name.type.tsx + type-object: + - match: '\{' + captures: + 0: punctuation.definition.block.tsx + push: + - meta_scope: meta.object.type.tsx + - match: '\}' + captures: + 0: punctuation.definition.block.tsx + pop: true + - include: comment + - include: method-declaration + - include: indexer-declaration + - include: indexer-mapped-type-declaration + - include: field-declaration + - include: type-annotation + - match: \.\.\. + captures: + 0: keyword.operator.spread.tsx + push: + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: type + - include: punctuation-comma + - include: punctuation-semicolon + - include: type + type-operators: + - include: typeof-operator + - match: '([&|])(?=\s*\{)' + captures: + 0: keyword.operator.type.tsx + push: + - match: '(?<=\})' + pop: true + - include: type-object + - match: "[&|]" + captures: + 0: keyword.operator.type.tsx + push: + - match: (?=\S) + pop: true + - match: '(?) + captures: + 1: punctuation.definition.typeparameters.end.tsx + pop: true + - include: comment + - match: '(?) + scope: keyword.operator.assignment.tsx + type-paren-or-function-parameters: + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - meta_scope: meta.type.paren.cover.tsx + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - match: |- + (?x)(?:(?) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))))) + captures: + 1: storage.modifier.tsx + 2: keyword.operator.rest.tsx + 3: entity.name.function.tsx variable.language.this.tsx + 4: entity.name.function.tsx + 5: keyword.operator.optional.tsx + - match: '(?x)(?:(?:&|{\?]|$|;|^\s*$|(?:^\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\b))' + pop: true + - include: expression + undefined-literal: + - match: '(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | + (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.variable.tsx variable.other.constant.tsx entity.name.function.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|((?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*(?\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*))))))) | + (:\s*(=>|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*((([\{\[]\s*)?$)|((\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})\s*((:\s*\{?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))|((\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])\s*((:\s*\[?$)|((\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+\s*)?=\s*)))))) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? + [(]\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters + \(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{([^\{\}]|\{[^\{\}]*\})*\}))*\})|(\[([^\[\]]|(\[([^\[\]]|\[[^\[\]]*\])*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\(([^\(\)]|\([^\(\)]*\))*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters + (\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<([^<>]|\<[^<>]+\>)+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.variable.tsx entity.name.function.tsx + 2: keyword.operator.definiteassignment.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|((?\s*$) + captures: + 1: keyword.operator.assignment.tsx + push: + - match: '(?=$|^|[,);}\]]|((?