$schema https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json fileTypes carbon foldingStartMarker \{\s*$ foldingStopMarker ^\s*\} name carbon patterns include #comments include #cpp-inline include #strings include #builtin-functions include #choice-definitions include #declarations include #inheritance include #type-annotation include #keywords include #literals include #numbers include #operators include #identifiers include #punctuation repository bindings patterns captures 1 name punctuation.definition.raw-identifier.carbon 2 name variable.parameter.carbon comment Parameter bindings (`name: Type` when not preceded by `let` or `var`), with `variable.parameter` nested inside `variable.other`. match (?<!\.)(?<!->)\b(r#)?([A-Za-z_][A-Za-z0-9_]*)(?=\s*:(?![=!?])) name variable.other.carbon builtin-functions patterns begin \b(fn)\b(?=[^"/;]*=\s*") beginCaptures 1 name storage.type.carbon comment A builtin function declaration (`fn ... = "..."`), scoping the string contents as `support.function.builtin`. end (?=;)|$ patterns captures 1 name keyword.operator.carbon 2 name string.quoted.double.carbon 3 name punctuation.definition.string.begin.carbon 4 name support.function.builtin.carbon 5 name punctuation.definition.string.end.carbon match (=)\s*((")([^"\\\n]*)(")) include #declarations include #comments include #strings include #type-annotation include #keywords include #literals include #numbers include #operators include #identifiers include #punctuation choice-definitions patterns begin \b(choice)\b beginCaptures 1 name storage.type.carbon comment A `choice` declaration, scoping names in its body as enum members and closing immediately if there is no body. end (?<=\})|(?=[^\s({]) patterns begin (?<=\bchoice)\s+(?=(?:r#)?[A-Za-z_]) end ((?:r#)?[A-Za-z_][A-Za-z0-9_]*)\b(?!\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.)|(?=[^\sA-Za-z_])|$ endCaptures 1 name entity.name.type.carbon patterns include #declared-name-qualifier include #comments begin \( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Choice parameters. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #choice-parameters begin \{ beginCaptures 0 name punctuation.section.block.begin.bracket.curly.carbon comment Choice body. end (\})|(?=[;=]) endCaptures 1 name punctuation.section.block.end.bracket.curly.carbon patterns include #comments begin \( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Alternative parameters. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #choice-parameters begin \[ beginCaptures 0 name punctuation.section.brackets.begin.bracket.square.carbon comment Invalid implicit parameter list on an alternative, matched so its contents are not scoped as enum members. end (\])|$ endCaptures 1 name punctuation.section.brackets.end.bracket.square.carbon patterns include #choice-parameters include #keywords include #literals match \b(?:r#)?[A-Za-z_][A-Za-z0-9_]*\b name variable.other.enummember.carbon include #numbers include #operators include #punctuation choice-parameters patterns include #comments include #strings include #inheritance include #type-annotation include #keywords include #literals include #numbers include #operators include #identifiers include #punctuation comments patterns captures 1 name comment.line.double-slash.carbon 2 name punctuation.definition.comment.carbon 3 name keyword.other.directive.carbon comment Toolchain directives. The comment scope sits on a capture rather than on the rule, to leave the leading indentation outside it. match ^\s*((//)(@(?:dump-sem-ir-(?:begin|end)|include-in-dumps)))$ captures 1 name punctuation.definition.comment.carbon match (//).*$ name comment.line.double-slash.carbon cpp-inline patterns begin \b(?:(import)\s+(Cpp)\s+(inline)|(inline)\s+(Cpp))\s*(''')([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name keyword.control.import.carbon 2 name support.class.carbon 3 name storage.type.carbon 4 name storage.type.carbon 5 name support.class.carbon 6 name punctuation.definition.string.begin.carbon 7 name entity.name.tag.language.carbon 8 name comment.line.double-slash.carbon 9 name punctuation.definition.comment.carbon comment Inline C++, block form. contentName meta.embedded.block.cpp end (''')\s*(;)? endCaptures 1 name punctuation.definition.string.end.carbon 2 name punctuation.terminator.statement.carbon patterns include source.cpp begin \b(?:(import)\s+(Cpp)\s+(inline)|(inline)\s+(Cpp))\s*(") beginCaptures 1 name keyword.control.import.carbon 2 name support.class.carbon 3 name storage.type.carbon 4 name storage.type.carbon 5 name support.class.carbon 6 name punctuation.definition.string.begin.carbon comment Inline C++, single-line form. contentName meta.embedded.inline.cpp end (")\s*(;)? endCaptures 1 name punctuation.definition.string.end.carbon 2 name punctuation.terminator.statement.carbon patterns include source.cpp declarations patterns begin (?<=\bfn)\s+(?=(?:r#)?[A-Za-z_]) comment The name a function declaration declares, after any qualifiers, or the `destroy` keyword. end (?:(destroy)|((?:r#)?[A-Za-z_][A-Za-z0-9_]*))\b(?!\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.)|(?=[^\sA-Za-z_])|$ endCaptures 1 name keyword.other.carbon 2 name entity.name.function.definition.carbon patterns include #declared-name-qualifier begin (?<=\bclass)\s+(?=(?:r#)?[A-Za-z_]) comment The name a class declaration declares, given `entity.name.type.class` for themes that color classes apart from other types. end ((?:r#)?[A-Za-z_][A-Za-z0-9_]*)\b(?!\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.)|(?=[^\sA-Za-z_])|$ endCaptures 1 name entity.name.type.class.carbon patterns include #declared-name-qualifier begin (?:(?<=\balias)|(?<=\bconstraint)|(?<=\binterface))\s+(?=(?:r#)?[A-Za-z_]) comment The name the other nominal type declarations declare. end ((?:r#)?[A-Za-z_][A-Za-z0-9_]*)\b(?!\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.)|(?=[^\sA-Za-z_])|$ endCaptures 1 name entity.name.type.carbon patterns include #declared-name-qualifier captures 1 name storage.type.carbon 2 name storage.modifier.carbon 3 name punctuation.definition.raw-identifier.carbon 4 name variable.other.constant.carbon comment `let` and `var` bindings, with optional modifiers before the name. `_` and `self` are left to `#literals`. match \b(let)\s+((?:(?:generic|ref|template|unused|var)\s+)*)(?!_\s*:)(r#)?([A-Za-z_][A-Za-z0-9_]*)(?=\s*:(?![=!?])) captures 1 name storage.type.carbon 2 name storage.modifier.carbon 3 name punctuation.definition.raw-identifier.carbon 4 name variable.other.carbon match \b(var)\s+((?:(?:generic|ref|template|unused)\s+)*)(?!(?:_|self)\s*:)(r#)?([A-Za-z_][A-Za-z0-9_]*)(?=\s*:(?![=!?])) captures 1 name keyword.control.import.carbon 2 name entity.name.namespace.carbon comment Package, namespace, and import names, excluding keywords (`library`, `inline`) and `Core` and `Cpp`. match \b(import)\s+(?!(?:library|inline|Core|Cpp)\b)((?:r#)?[A-Za-z_][A-Za-z0-9_]*) captures 1 name storage.type.carbon 2 name entity.name.namespace.carbon match \b(package|namespace)\s+(?!(?:library|Core|Cpp)\b)((?:r#)?[A-Za-z_][A-Za-z0-9_]*) captures 1 name storage.type.carbon 2 name string.quoted.double.carbon 3 name punctuation.definition.string.begin.carbon 4 name entity.name.namespace.library.carbon 5 name punctuation.definition.string.end.carbon comment A library name, written as a string, with `entity.name.namespace.library` nested inside the string scope. match \b(library)\s+((")((?:\\.|[^"\\\n])*)(")) declared-name-qualifier patterns begin (((?:r#)?[A-Za-z_][A-Za-z0-9_]*))\b(?=\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.) beginCaptures 1 name entity.name.type.carbon 2 name entity.name.scope-resolution.carbon comment One qualifier on a declared name, such as `N.` or `Base(T: type).`, matched when followed by `.` after any parameter lists. `entity.name.scope-resolution` is nested inside `entity.name.type` so themes without a scope-resolution rule fall back to the type color. end (\.) endCaptures 1 name punctuation.separator.dot-access.carbon patterns include #type-body expression-parens patterns begin \( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Parentheses nested in an expression that sits inside a type, so that only the matching `)` ends the expression. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #expression-parens include $self identifiers patterns include #bindings captures 1 name punctuation.definition.raw-identifier.carbon comment Raw identifiers. match \b(r#)([A-Za-z_][A-Za-z0-9_]*) name variable.other.carbon comment Member function call. match (?:(?<=\.)|(?<=\->))[A-Za-z_][A-Za-z0-9_]*(?=\s*\() name entity.name.function.member.carbon comment Member access via `.` or `->`. match (?:(?<=\.)|(?<=\->))[A-Za-z_][A-Za-z0-9_]*\b name variable.other.property.carbon comment Function call. match \b[A-Za-z_][A-Za-z0-9_]*(?=\s*\() name entity.name.function.call.carbon match \b[A-Za-z_][A-Za-z0-9_]*\b name variable.other.carbon impls-clause patterns begin \b(impls)\b beginCaptures 1 name keyword.operator.expression.impls.carbon end (?=[,;={}\)\]]|[-+/%!<>|^~?@\\]|//|\b(?:in|and|or|not|as|impls)\b|$) name meta.inheritance-clause.carbon patterns include #inheritance-body inheritance patterns begin \b(impl)\b(?!\s*(?:adapt|alias|base|choice|class|constraint|export|fn|impl|import|interface|let|library|match_first|namespace|observe|package|require|var)\b) beginCaptures 1 name storage.type.carbon comment An `impl` declaration (when `impl` does not precede another declaration keyword), scoping the type before `as` with `#type-body` and the interface after `as` with `#inheritance-body`. end (?=[;{]|$) name meta.type.annotation.carbon patterns begin \b(as)\b beginCaptures 1 name keyword.operator.expression.as.carbon end (?=[,;={}\)\]]|[-+/%!<>|^~?@\\]|//|\b(?:in|and|or|not|as|impls)\b|$) name meta.inheritance-clause.carbon patterns include #inheritance-body include #type-body begin (?<!\.)\b(base)\s*(:)(?![=!?]) beginCaptures 1 name storage.type.carbon 2 name keyword.operator.type.annotation.carbon comment A `base:` declaration, excluding `.base` member access and `base class`. end (?=[,;={}\)\]]|[-+/%!<>|^~?@\\]|//|\b(?:in|and|or|not|as|impls)\b|$) name meta.inheritance-clause.carbon patterns include #inheritance-body include #impls-clause inheritance-body patterns begin (?<=[A-Za-z0-9_\]])\( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Only the interface itself is scoped as `entity.other.inherited-class`; its argument list switches to expression scoping. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #expression-parens include $self begin \( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Grouping parentheses around an interface name stay in `#inheritance-body`. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #inheritance-body begin \b(where)\b beginCaptures 1 name keyword.other.where.carbon comment A `where` clause switches to expression scoping and ends at a `)` or `]` it did not open. end (?=[;{}\)\]]|$) patterns include #expression-parens include $self include #keywords include #literals comment The final identifier of the interface or base class name; any preceding qualifiers fall through to `#type-body`. match \b(?:r#)?[A-Za-z_][A-Za-z0-9_]*\b(?!\s*\.) name entity.other.inherited-class.carbon include #type-body keywords patterns comment `.base` member access, matched before `base` as an introducer. match (?<=\.)\b(base)\b name keyword.other.base.carbon match \b(import)\b name keyword.control.import.carbon match \b(adapt|alias|choice|class|constraint|fn|inline|interface|let|library|match_first|namespace|observe|require|var)\b name storage.type.carbon comment `base` as an introducer (not `base class`). match \b(base)\b(?!\s*class\b) name storage.type.carbon match \b(export)\b(?!\s*import\b) name storage.type.carbon match \b(impl)\b(?!\s*(adapt|alias|base|choice|class|constraint|export|fn|impl|import|interface|let|library|match_first|namespace|observe|package|require|var)\b) name storage.type.carbon comment `package` as an introducer (not `package.`). match \b(package)\b(?!\.) name storage.type.carbon match \b(abstract|const|eval|extend|extern|final|generic|musteval|override|partial|private|protected|ref|runtime|static|template|unsafe|unused|val|virtual)\b name storage.modifier.carbon comment `default` as a modifier (not `default =>`). match \b(default)\b(?!\s*=>) name storage.modifier.carbon match \b(base)\b(?=\s*class\b) name storage.modifier.carbon match \b(export)\b(?=\s*import\b) name storage.modifier.carbon match \b(impl)\b(?=\s*(adapt|alias|base|choice|class|constraint|export|fn|impl|import|interface|let|library|match_first|namespace|observe|package|require|var)\b) name storage.modifier.carbon match \b(break|case|continue|else|for|if|match|return|returned|then|while)\b name keyword.control.carbon comment `default` in a `match` clause. match \b(default)\b(?=\s*=>) name keyword.control.carbon match \b(and|or)\b name keyword.control.carbon match \b(not)\b name keyword.operator.expression.not.carbon comment Fallback when not matched by `#type-annotation` or `#inheritance`. match \b(as)\b name keyword.operator.expression.as.carbon match \b(impls)\b name keyword.operator.expression.impls.carbon match \b(in)\b name keyword.operator.expression.in.carbon match \b(like)\b name keyword.operator.expression.like.carbon match \b(typeof)\b name keyword.operator.expression.typeof.carbon match \b(where)\b name keyword.other.where.carbon match \b(destroy|each|expand|forall|form|friend)\b name keyword.other.carbon literals patterns match \b(self|Self)\b name variable.language.carbon comment The wildcard pattern. match \b(_)\b name variable.language.carbon comment Built-in package names. match \b(Core|Cpp)\b name support.class.carbon comment `package` as a qualifier. match \b(package)\b(?=\.) name variable.language.carbon match \b(true|false)\b name constant.language.carbon match \b(array|auto|type)\b name support.type.builtin.carbon match \b(bool|char|str)\b name support.type.primitive.carbon comment Integer and floating-point type literals. match \b[iuf][1-9][0-9]*\b name support.type.primitive.carbon numbers patterns captures 1 name keyword.other.unit.hexadecimal.carbon comment Each numeric rule matches a full alphanumeric word starting with a digit so a malformed suffix is not split into an identifier. Real literals exclude a leading `.` or `->` so tuple access like `t.0.1` is not matched as a real. match (?<!\.)(?<!->)\b(0x)[_0-9A-Za-z]*\.[0-9A-Za-z][_0-9A-Za-z]*(?:(?<=[a-z])[-+][0-9A-Za-z][_0-9A-Za-z]*)? name constant.numeric.hex.carbon captures 1 name keyword.other.unit.hexadecimal.carbon match \b(0x)[_0-9A-Za-z]* name constant.numeric.hex.carbon captures 1 name keyword.other.unit.octal.carbon match \b(0o)[_0-9A-Za-z]* name constant.numeric.octal.carbon captures 1 name keyword.other.unit.binary.carbon match \b(0b)[_0-9A-Za-z]* name constant.numeric.binary.carbon match (?<!\.)(?<!->)\b[0-9][_0-9A-Za-z]*\.[0-9A-Za-z][_0-9A-Za-z]*(?:(?<=[a-z])[-+][0-9A-Za-z][_0-9A-Za-z]*)? name constant.numeric.decimal.carbon match \b[0-9][_0-9A-Za-z]* name constant.numeric.decimal.carbon comment Positional parameter, as used in lambdas. match \$[0-9]+ name variable.parameter.carbon operators patterns match :! name keyword.operator.type.annotation.symbolic.carbon match :\? name keyword.operator.type.annotation.form.carbon match :(?![=!?]) name keyword.operator.type.annotation.carbon comment `->` directly after an operand is pointer member access rather than a return type arrow. match (?<=[A-Za-z0-9_)\]}])\->(?!\?) name punctuation.separator.pointer-access.carbon match \->\? name keyword.operator.function-result.form.carbon match \->(?!\?) name keyword.operator.function-result.carbon match => name keyword.operator.arrow.fat.carbon match <=>|<<=|>>=|==|!=|<=|>=|<<|>>|\+\+|--|\+=|-=|\*=|/=|%=|&=|\|=|\^=|~=|:=|<-|<>|[-+*/%&|^~!<>=@?\\] name keyword.operator.carbon punctuation patterns match \( name punctuation.section.parens.begin.bracket.round.carbon match \) name punctuation.section.parens.end.bracket.round.carbon match \{ name punctuation.section.block.begin.bracket.curly.carbon match \} name punctuation.section.block.end.bracket.curly.carbon match \[ name punctuation.section.brackets.begin.bracket.square.carbon match \] name punctuation.section.brackets.end.bracket.square.carbon match \. name punctuation.separator.dot-access.carbon match , name punctuation.separator.comma.carbon match ; name punctuation.terminator.statement.carbon string-escapes patterns match \\(?:[tnr0'\"\\]|x[0-9A-F]{2}|u\{[0-9A-F]+\}) name constant.character.escape.carbon string-escapes-1 patterns match \\#(?:[tnr0'\"\\]|x[0-9A-F]{2}|u\{[0-9A-F]+\}) name constant.character.escape.carbon string-escapes-2 patterns match \\##(?:[tnr0'\"\\]|x[0-9A-F]{2}|u\{[0-9A-F]+\}) name constant.character.escape.carbon string-escapes-raw patterns match \\#{3,}(?:[tnr0'\"\\]|x[0-9A-F]{2}|u\{[0-9A-F]+\}) name constant.character.escape.carbon strings patterns begin (#{3,})(''')([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon 3 name entity.name.tag.language.carbon 4 name comment.line.double-slash.carbon 5 name punctuation.definition.comment.carbon comment Block string literal, with an optional file type indicator, raw at `###` level. end (''')\1 endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.triple.carbon patterns include #string-escapes-raw begin (##)(''')([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon 3 name entity.name.tag.language.carbon 4 name comment.line.double-slash.carbon 5 name punctuation.definition.comment.carbon comment Block string literal, with an optional file type indicator, raw at `##` level. end ('''##) endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.triple.carbon patterns include #string-escapes-2 begin (#)(''')([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon 3 name entity.name.tag.language.carbon 4 name comment.line.double-slash.carbon 5 name punctuation.definition.comment.carbon comment Block string literal, with an optional file type indicator, raw at `#` level. end ('''#) endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.triple.carbon patterns include #string-escapes-1 begin (''')([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name entity.name.tag.language.carbon 3 name comment.line.double-slash.carbon 4 name punctuation.definition.comment.carbon comment Block string literal, with an optional file type indicator. end (''') endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.triple.carbon patterns include #string-escapes begin (""")([^\s'\"#]*)(?:[ \t]*((//)(?:[ \t][^\n]*)?)$)? beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name entity.name.tag.language.carbon 3 name comment.line.double-slash.carbon 4 name punctuation.definition.comment.carbon comment A `"""` block is always an error, but highlighting it as a block string keeps the rest of the file readable. end (""") endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.triple.carbon patterns include #string-escapes begin (#{3,})(") beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon comment Single-line string literal, raw at `###` level. end (")\1|$ endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.double.carbon patterns include #string-escapes-raw begin (##)(") beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon comment Single-line string literal, raw at `##` level. end ("##)|$ endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.double.carbon patterns include #string-escapes-2 begin (#)(") beginCaptures 1 name punctuation.definition.string.begin.carbon 2 name punctuation.definition.string.begin.carbon comment Single-line string literal, raw at `#` level. end ("#)|$ endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.double.carbon patterns include #string-escapes-1 begin (") beginCaptures 1 name punctuation.definition.string.begin.carbon comment Single-line string literal. end (")|$ endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.double.carbon patterns include #string-escapes begin (') beginCaptures 1 name punctuation.definition.string.begin.carbon comment Character literal. end (')|$ endCaptures 1 name punctuation.definition.string.end.carbon name string.quoted.single.carbon patterns include #string-escapes type-annotation patterns begin (:!)|(:\?)|(:(?![=!?]))|((?<![A-Za-z0-9_)\]}])\->\?)|((?<![A-Za-z0-9_)\]}])\->(?!\?))|\b(as)\b|\b(adapt)\b|\b(require)\b beginCaptures 1 name keyword.operator.type.annotation.symbolic.carbon 2 name keyword.operator.type.annotation.form.carbon 3 name keyword.operator.type.annotation.carbon 4 name keyword.operator.function-result.form.carbon 5 name keyword.operator.function-result.carbon 6 name keyword.operator.expression.as.carbon 7 name storage.type.carbon 8 name storage.type.carbon comment A type expression, from the token that introduces it to the first token that cannot continue one. end (?=[,;={}\)\]]|[-+/%!<>|^~?@\\]|//|\b(?:in|and|or|not|as|impls)\b|$) name meta.type.annotation.carbon patterns include #type-body type-body patterns begin \( beginCaptures 0 name punctuation.section.parens.begin.bracket.round.carbon comment Argument and grouping parentheses, which nest rather than ending the type. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #type-body begin \[ beginCaptures 0 name punctuation.section.brackets.begin.bracket.square.carbon end (\])|$ endCaptures 1 name punctuation.section.brackets.end.bracket.square.carbon patterns include #type-body begin \bwhere\b beginCaptures 0 name keyword.other.where.carbon comment A `where` clause switches to expression scoping so `=` does not end the enclosing type as an initializer, and ends at a `)` or `]` it did not open. end (?=[;{}\)\]]|$) patterns include #expression-parens include $self include #impls-clause include #comments include #strings begin \b(typeof)\s*(\() beginCaptures 1 name keyword.operator.expression.typeof.carbon 2 name punctuation.section.parens.begin.bracket.round.carbon comment `typeof` takes an expression operand, switching out of `#type-body`. end (\))|$ endCaptures 1 name punctuation.section.parens.end.bracket.round.carbon patterns include #expression-parens include $self include #keywords include #literals include #numbers comment Pointer `*`, written directly after the pointee type. match (?<=[A-Za-z0-9_)\]*])\*(?!=) name keyword.operator.type.pointer.carbon include #operators include #bindings captures 1 name entity.name.scope-resolution.carbon comment A qualifier in a type, which `#declared-name-qualifier` scopes the same way on a declared name. match (?:(?<=[A-Za-z0-9_)\]]\.)|(?<!\.))\b((?:r#)?[A-Za-z_][A-Za-z0-9_]*)\b(?=\s*(?:\[[^\[\]]*\]\s*)?(?:\([^()]*(?:\([^()]*(?:\([^()]*\)[^()]*)*\)[^()]*)*\)\s*)?\.) name entity.name.type.carbon captures 1 name punctuation.definition.raw-identifier.carbon comment Unqualified names and qualified member names in a type context. A `.` with no preceding qualifier (such as a struct field `.x`) is left to `#identifiers`. match (?:(?<=[A-Za-z0-9_)\]]\.)|(?<!\.))\b(r#)?[A-Za-z_][A-Za-z0-9_]*\b name entity.name.type.carbon include #identifiers include #punctuation scopeName source.carbon uuid 4568a54d-9a79-41ac-a36b-05916252763b