Warning, /frameworks/syntax-highlighting/data/syntax/typescript.xml is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?> 0002 <!DOCTYPE language 0003 [ 0004 <!ENTITY identifier "[a-zA-Z_$[:^ascii:]][\w$[:^ascii:]]*+"> 0005 <!ENTITY numSuffix "(?=n?(?:[^\w]|$))"> 0006 <!ENTITY objectOp "[\?!]?"> 0007 <!ENTITY objectPoint "\s*&objectOp;\."> 0008 <!ENTITY endLine "\s*(?:$|//|(?:/\*.*\*/\s*)+(?:$|//))"> 0009 <!ENTITY parameter "&identifier;(?=\s*&objectOp;:)"> 0010 0011 <!ENTITY utilityTypes "\b(?:Partial|Readonly|Record|Pick|Omit|Exclude|Extract|NonNullable|ReturnType|InstanceType|Required|ThisType)(?=\s*<)"> 0012 <!-- function<...>( or function( --> 0013 <!ENTITY functionSuffix "(?=\s*(?:<(?:\{(?:[^\{\}]|\{[^\{\}]*\})*\}|\((?:[^\(\)]|\([^\(\)]*\))*\)|\[(?:[^\[\]]|\[[^\[\]]*\])*\]|'(?:\\.|[^'])*'|"(?:\\.|[^"])*"|`(?:\\.|[^`])*`|[^<>]|<.*>)*>)?\()"> 0014 0015 <!ENTITY codeContent ""(?:[^"]|\\.)*"|'(?:[^']|\\.)*'|`(?:[^`]|\\.)`|/\*.*\*/|/(?:[^/\\\[]|\\.|\[(?:[^\]\\]|\\.)+\])+/"> 0016 0017 <!-- https://tc39.es/ecma262/#sec-literals-numeric-literals --> 0018 <!ENTITY DecimalIntegerLiteral "(0|[1-9][0-9]*+(_[0-9]++)*+)"> 0019 <!ENTITY DecimalDigits "([0-9]++(_[0-9]++)*+)"> 0020 <!ENTITY ExponentPart "([eE][+-]?&DecimalDigits;)"> 0021 <!ENTITY float "\b&DecimalIntegerLiteral;(\.&DecimalDigits;?&ExponentPart;?|&ExponentPart;)|\.&DecimalDigits;&ExponentPart;?"> 0022 ]> 0023 0024 <!-- 0025 ==================================================================== 0026 0027 This file is part of the KDE's KSyntaxHighlighting framework. 0028 0029 Copyright 2018-2020 Nibaldo González S. (nibgonz@gmail.com) 0030 0031 This Source Code Form is subject to the terms of the MIT License. 0032 If a copy of the license was not distributed with this file, 0033 You can obtain one at: https://opensource.org/licenses/MIT 0034 0035 ==================================================================== 0036 0037 This file is an extension of the JavaScript highlighter 0038 (javascript.xml, Version 14 and higher). 0039 Based on the TypeScript grammar files, 0040 available at: https://github.com/Microsoft/TypeScript-TmLanguage 0041 0042 NOTE: TypeScript directives are highlighted by "doxygen.xml", 0043 included in the JavaScript highlighter. 0044 Ex: 0045 /// <reference no-default-lib="true"/> 0046 0047 Tags: reference, amd-dependency, amd-module 0048 Attributes: path, types, no-default-lib, name 0049 0050 Change log: 0051 * v11 [2020-06-03]: Improve tagged template literals. 0052 * v10 [2020-04-13]: Add the 'awaited' type operator. 0053 * v9 [2020-02-23]: Add private-named instance fields and type-only imports/exports. 0054 Improve conditional expressions. 0055 * v8 [2019-12-12]: Add "bigint" primitive type. 0056 * v7 [2019-11-20]: Move keywords of built-in object to "javascript.xml" and adapt. 0057 * v6 [2019-10-01]: Add "asserts" keyword in type predicates. 0058 Highlight types after the "as" keyword. 0059 * v5 [2019-08-30]: Avoid that ?: be used as conditional expressions. 0060 * v4 [2019-07-16]: Fixed highlighting of keywords before ":" in conditional expressions. 0061 * v3 [2019-02-18]: Add support to bigint and the "is" keyword. 0062 Fixes keyword delimiters. Don't highlight regex 0063 after "]" and ")". Multiple fixes and improvements. 0064 * v2 [2018-12-29]: Don't highlight built-in classes as functions, 0065 fix float-points, improve types detection and other fixes. 0066 * v1 [2018-11-18]: Initial version 0067 --> 0068 0069 <language name="TypeScript" 0070 version="17" 0071 kateversion="5.53" 0072 section="Scripts" 0073 extensions="*.ts;*.mts;*.cts" 0074 priority="9" 0075 mimetype="text/typescript;application/typescript;text/x-typescript;application/x-typescript" 0076 indenter="cstyle" 0077 author="Nibaldo González (nibgonz@gmail.com)" 0078 license="MIT"> 0079 0080 <highlighting> 0081 0082 <!-- Include all JavaScript keywords! --> 0083 <list name="controlflow"> 0084 <include>controlflow##JavaScript</include> 0085 <item>goto</item> 0086 </list> 0087 <list name="keywords"> 0088 <include>keywords##JavaScript</include> 0089 </list> 0090 <list name="reserved"> 0091 <include>reserved##JavaScript</include> 0092 <item>type</item> 0093 <item>arguments</item> 0094 <!-- Class --> 0095 <item>declare</item> <!-- storage modifier --> 0096 <item>readonly</item> 0097 <item>abstract</item> 0098 <item>constructor</item> 0099 <item>get</item> 0100 <item>set</item> 0101 <!-- Also: 0102 public, protected, private, async, super, new, static --> 0103 </list> 0104 <list name="module"> 0105 <include>module##JavaScript</include> 0106 </list> 0107 <list name="primitives"> 0108 <include>primitives##JavaScript</include> 0109 <!-- Types Built-in --> 0110 <item>object</item> 0111 <!-- Also: 0112 this, true, false, undefined, null --> 0113 </list> 0114 0115 <list name="control_export_types"> 0116 <!-- storage.type.namespace.ts --> 0117 <item>namespace</item> 0118 <item>module</item> 0119 </list> 0120 <list name="types_operator_expression"> 0121 <item>keyof</item> 0122 <item>infer</item> 0123 <item>awaited</item> 0124 <!-- Also: typeof, readonly --> 0125 </list> 0126 <!-- Datatypes & Primitive Types --> 0127 <list name="types"> 0128 <item>string</item> 0129 <item>number</item> 0130 <item>bigint</item> 0131 <item>boolean</item> 0132 <item>symbol</item> 0133 <item>any</item> 0134 <item>void</item> 0135 <item>never</item> 0136 <item>unknown</item> 0137 0138 <item>undefined</item> 0139 <item>null</item> 0140 <item>object</item> 0141 </list> 0142 0143 <!-- Built-in Classes, Functions & Constants --> 0144 0145 <list name="class_builtin"> 0146 <include>class_builtin##JavaScript</include> 0147 </list> 0148 <!-- DOM Classes --> 0149 <list name="class_dom"> 0150 <include>class_dom##JavaScript</include> 0151 </list> 0152 <!-- Node.js Classes --> 0153 <list name="class_node"> 0154 <include>class_node##JavaScript</include> 0155 </list> 0156 0157 <!-- General Properties of Classes --> 0158 <list name="variable_property"> 0159 <include>variable_property##JavaScript</include> 0160 </list> 0161 <!-- General Built-in Functions --> 0162 <list name="functions"> 0163 <include>functions##JavaScript</include> 0164 </list> 0165 0166 <!-- Functions of "console" --> 0167 <list name="console_functions"> 0168 <include>console_functions##JavaScript</include> 0169 </list> 0170 <!-- Properties of "process" --> 0171 <list name="process_property"> 0172 <include>process_property##JavaScript</include> 0173 </list> 0174 <!-- Functions of "process" --> 0175 <list name="process_functions"> 0176 <include>process_functions##JavaScript</include> 0177 </list> 0178 0179 <!-- Constants of Number Class --> 0180 <list name="number_constant"> 0181 <include>number_constant##JavaScript</include> 0182 </list> 0183 <!-- Constants of Math Class--> 0184 <list name="math_constant"> 0185 <include>math_constant##JavaScript</include> 0186 </list> 0187 <!-- Methods of Math Class --> 0188 <list name="math_functions"> 0189 <include>math_functions##JavaScript</include> 0190 </list> 0191 <!-- Methods of JSON Class --> 0192 <list name="json_functions"> 0193 <include>json_functions##JavaScript</include> 0194 </list> 0195 <!-- Methods of Promise Class --> 0196 <list name="promise_functions"> 0197 <include>promise_functions##JavaScript</include> 0198 </list> 0199 0200 <!-- Node.js Variables --> 0201 <list name="node_variable"> 0202 <include>node_variable##JavaScript</include> 0203 </list> 0204 <!-- DOM Variables --> 0205 <list name="dom_variable"> 0206 <include>dom_variable##JavaScript</include> 0207 </list> 0208 <!-- DOM Constants --> 0209 <list name="dom_constant"> 0210 <include>dom_constant##JavaScript</include> 0211 </list> 0212 0213 <!-- For Autocomplete Keywords --> 0214 <!-- Properties of DOM Classes --> 0215 <list name="dom_property"> 0216 <include>dom_property##JavaScript</include> 0217 </list> 0218 <!-- Methods of DOM Classes --> 0219 <list name="dom_functions"> 0220 <include>dom_functions##JavaScript</include> 0221 </list> 0222 <!-- Event Handler --> 0223 <list name="eventhandler_property"> 0224 <include>eventhandler_property##JavaScript</include> 0225 </list> 0226 <!-- Others Methods of Classes --> 0227 <list name="function_common"> 0228 <include>function_common##JavaScript</include> 0229 </list> 0230 0231 <contexts> 0232 0233 <context name="Shebang" attribute="Normal Text" lineEndContext="Normal" lineEmptyContext="Normal" fallthrough="true" fallthroughContext="Normal"> 0234 <Detect2Chars context="ShebangLine" attribute="Comment" char="#" char1="!" column="0" /> 0235 </context> 0236 <context name="ShebangLine" attribute="Comment" lineEndContext="#pop!Normal" /> 0237 0238 <context name="Normal" attribute="Normal Text" lineEndContext="#stay"> 0239 <IncludeRules context="Normal Pt1" /> 0240 0241 <!-- NOTE & TODO: The identifiers before ":" are highlighted as "dsNormal". 0242 These identifiers should be highlighted in a different way depending on the 0243 context, for example, in the declaration of classes or interfaces, in sets, the 0244 parameters of a function, or after the keywords: "const", "var", "let" & "enum". --> 0245 <RegExpr context="#stay" attribute="Parameter" String="¶meter;" /> 0246 0247 <IncludeRules context="Normal Pt2" /> 0248 </context> 0249 0250 <context name="Normal Pt1" attribute="Normal Text" lineEndContext="#stay"> 0251 <IncludeRules context="JSBaseSomeSymboles##JavaScript" /> 0252 <DetectChar context="Types" attribute="Symbol" char=":" /> 0253 0254 <!-- Symbols & Operators --> 0255 <!-- NOTE: - The brackets {}()[] are highlighted as Normal Text. 0256 - Bracket highlighting rules must be explicitly included here 0257 for the "Animate Bracket Highlighting" feature to work properly. --> 0258 <DetectChar context="Object" attribute="Normal Text" char="{" beginRegion="Brace" /> 0259 <DetectChar context="#stay" attribute="Normal Text" char="[" beginRegion="List" /> 0260 <DetectChar context="NoRegExp" attribute="Normal Text" char="]" endRegion="List" /> 0261 <DetectChar context="#stay" attribute="Normal Text" char="(" /> 0262 <DetectChar context="NoRegExp" attribute="Normal Text" char=")" /> 0263 0264 <StringDetect context="#stay" attribute="Symbol" String="..." /> 0265 <IncludeRules context="FindNumbers" /> 0266 <DetectChar context="MemberObject" attribute="Symbol" char="." /> 0267 <IncludeRules context="FindStrings" /> 0268 0269 <IncludeRules context="FindPrivateOperator##JavaScript" /> 0270 0271 <!-- Abstract --> 0272 <RegExpr context="#stay" attribute="Reserved" String="\babstract(?=\s+(?:class|interface)\b)" /> 0273 <!-- New --> 0274 <RegExpr context="NewTarget" attribute="Keyword" String="\bnew(?=&objectPoint;\s*target\b)" /> 0275 <RegExpr context="MemberObject" attribute="Objects" String="\bnew(?=&objectOp;\.)" /> 0276 <WordDetect context="#stay" attribute="Keyword" String="new" /> 0277 0278 <!-- Keywords: control flow --> 0279 <keyword context="#stay" attribute="ControlFlow" String="controlflow" /> 0280 <RegExpr context="#stay" attribute="ControlFlow" String="\bdefault(?=\s*&objectOp;:)" /> 0281 </context> 0282 <context name="Normal Pt2" attribute="Normal Text" lineEndContext="#stay"> 0283 <!-- Keywords --> 0284 <WordDetect context="TypeDeclaration" attribute="Reserved" String="type" /> 0285 <WordDetect context="FunctionDeclaration" attribute="Keyword" String="function" /> 0286 <keyword context="#stay" attribute="Keyword" String="keywords" /> <!-- NoRegExp? --> 0287 <keyword context="#stay" attribute="Reserved" String="reserved" /> 0288 0289 <!-- Utility Types --> 0290 <RegExpr context="#stay" attribute="Built-in Objects" String="&utilityTypes;" /> 0291 <!-- Built-in Classes --> 0292 <IncludeRules context="BuiltInClasses" /> 0293 <IncludeRules context="BuiltInConstants" /> 0294 <!-- Objects --> 0295 <RegExpr context="MemberObject" attribute="Objects" String="&identifier;(?=&objectPoint;)" /> 0296 0297 <RegExpr context="Types" attribute="Module" String="\bas(?=\s)" /> 0298 <!-- Import --> 0299 <WordDetect context="Import" attribute="Module" String="import" /> 0300 <RegExpr context="#stay" attribute="Module" String="\bexport\s+type\b" /> 0301 <!-- Export types --> 0302 <keyword context="ControlExport" attribute="Module" String="control_export_types" /> 0303 <!-- Keywords --> 0304 <keyword context="#stay" attribute="Module" String="module" /> 0305 <keyword context="NoRegExp" attribute="Keyword" String="primitives" /> 0306 <keyword context="#stay" attribute="Keyword" String="types_operator_expression" /> 0307 0308 <!-- Functions: function(...) and function<...>(...) --> 0309 <RegExpr context="Function" attribute="Function Name" String="(&identifier;)&functionSuffix;" lookAhead="true" /> 0310 <!-- Tagged Template Literals --> 0311 <RegExpr context="#stay" attribute="Function Name" String="&identifier;(?=\s*`)" /> 0312 0313 <Detect2Chars context="#stay" attribute="Symbol" char="?" char1="?" /> <!-- Null operator --> 0314 <!-- Conditional Expressions: 0315 CASE 1: '?' ... <identifier> ':' 0316 CASE 2: '?' ... ( '||' | '&&' ) <end-line> 0317 CASE 3: '?' (<identifier>)? <end-line> 0318 --> 0319 <RegExpr context="ConditionalExpression" attribute="Symbol" String="\?(?=\s*(?:(?:[^/"'`\s\?:\.;,\=\}\]\)]|&codeContent;)(?:[^/"'`]|&codeContent;)*)?&identifier;\s*(?:/\*.*\*/\s*)*:|(?:&&|\|\||\s*(?:/\*.*\*/\s*)*&identifier;)?&endLine;)" minimal="true" /> 0320 0321 <!-- Type Parameter: Highlight types after ":" and between "<" and ">" --> 0322 <RegExpr context="TypesAngleBracket" attribute="Symbol" String="<(?=(?:&identifier;|[\[\{\(<]).*>)" /> 0323 0324 <IncludeRules context="JSBase##JavaScript" /> 0325 </context> 0326 0327 <!-- Conditional Expressions: a ? b : c --> 0328 <!-- Highlight keywords before ":" in conditional expressions. --> 0329 <context name="ConditionalExpression" attribute="Normal Text" lineEndContext="#stay"> 0330 <!-- NOTE: Don't start the "Types" context. See the context "Default Types". --> 0331 <DetectChar context="#pop" attribute="Symbol" char=":" /> 0332 <IncludeRules context="ConditionalExpressionEnd" /> 0333 <DetectChar context="#stay" attribute="Symbol" char="?" /> 0334 0335 <IncludeRules context="FindConditionalExpressionBrackets" /> 0336 <IncludeRules context="Normal-ParametersOverridden" /> 0337 </context> 0338 <context name="Normal-ParametersOverridden" attribute="Normal Text" lineEndContext="#stay"> 0339 <IncludeRules context="Normal Pt1" /> 0340 <IncludeRules context="Normal Pt2" /> 0341 <!-- unrecheable by Regex=&identifier; in "JSBase##JavaScript" included by "Normal Pt2" 0342 <RegExpr context="#stay" attribute="Parameter" String="¶meter;" />--> 0343 </context> 0344 <context name="ConditionalExpressionEnd" attribute="Normal Text" lineEndContext="#stay"> 0345 <AnyChar context="#pop" String=";,}])" lookAhead="true" /> 0346 <RegExpr context="#pop" String="\=(?!>)" lookAhead="true" /> 0347 <!-- For TypeScript code embedded in HTML and Markdown --> 0348 <StringDetect context="#pop" String="```" lookAhead="true" firstNonSpace="true" /> 0349 <StringDetect context="#pop" String="~~~" lookAhead="true" firstNonSpace="true" /> 0350 <RegExpr context="#pop" String="</script\s*(?:>|$)" insensitive="true" lookAhead="true" /> 0351 </context> 0352 <context name="FindConditionalExpressionBrackets" attribute="Normal Text" lineEndContext="#stay"> 0353 <DetectChar context="ConditionalExpressionRoundBracket" attribute="Normal Text" char="(" /> 0354 <DetectChar context="ConditionalExpressionSquareBracket" attribute="Symbol" char="[" beginRegion="List" /> 0355 </context> 0356 <context name="ConditionalExpressionRoundBracket" attribute="Normal Text" lineEndContext="#stay"> 0357 <DetectChar context="#pop!NoRegExp" attribute="Normal Text" char=")" /> 0358 <IncludeRules context="FindConditionalExpressionBrackets" /> 0359 <IncludeRules context="Normal" /> 0360 </context> 0361 <context name="ConditionalExpressionSquareBracket" attribute="Normal Text" lineEndContext="#stay"> 0362 <DetectChar context="#pop!NoRegExp" attribute="Symbol" char="]" endRegion="List" /> 0363 <IncludeRules context="FindConditionalExpressionBrackets" /> 0364 <IncludeRules context="Normal" /> 0365 </context> 0366 0367 <!-- Object, within { ... } --> 0368 <context name="Object" attribute="Normal Text" lineEndContext="#stay"> 0369 <DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" /> 0370 <keyword context="NoRegExp" attribute="Keyword" String="keywords" /> 0371 <!-- Highlight types in the following line. 0372 NOTE: Using the "NoRegExp" context can cause this to apply to multiple lines. --> 0373 <RegExpr context="TypesNewLine" attribute="Symbol" String=":(?=&endLine;)" minimal="true" /> 0374 <IncludeRules context="Normal" /> 0375 </context> 0376 0377 <!-- Avoid highlighting regular expressions. --> 0378 <context name="NoRegExp" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> 0379 <IncludeRules context="NoRegExp##JavaScript" /> 0380 </context> 0381 <!-- Avoid highlighting regular expressions on a single line. --> 0382 <context name="NoRegExpSameLine" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0383 <IncludeRules context="NoRegExp##JavaScript" /> 0384 </context> 0385 0386 <!-- Numbers --> 0387 <context name="FindNumbers" attribute="Normal Text" lineEndContext="#stay"> 0388 <RegExpr attribute="Float" context="NoRegExp" String="&float;" /> 0389 <AnyChar context="Integer" String="0123456789" lookAhead="1"/> 0390 </context> 0391 <!-- same as JS, but with Hexadecimal instead of Hex --> 0392 <context name="Integer" attribute="Normal Text" lineEndContext="#stay"> 0393 <RegExpr attribute="Hexadecimal" context="#pop!NumericSufix" String="\b0[xX][0-9a-fA-F]++(_[0-9a-fA-F]++)*+"/> 0394 <!-- 07 is octal, 08 is decimal --> 0395 <RegExpr attribute="Octal" context="#pop!NumericSufix" String="\b0([oO][0-7]++(_[0-7]++)*+|0*+[1-7][0-7]*+(_[0-7]++)*+(?!_?[89]))" /> 0396 <RegExpr attribute="Binary" context="#pop!NumericSufix" String="\b0[bB][01]++(_[01]++)*+" /> 0397 <!-- 0000_8 is invalid --> 0398 <RegExpr attribute="Decimal" context="#pop!NumericSufix" String="\b0*+([1-9][0-9]*+(_[0-9]++)*+)?"/> 0399 </context> 0400 <context attribute="Normal Text" lineEndContext="#pop" name="NumericSufix" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0401 <DetectChar attribute="Normal Text" context="#pop!NoRegExp" char="n" /> 0402 <IncludeRules context="NumericSufixError##JavaScript" /> 0403 </context> 0404 0405 <!-- Function Name --> 0406 <context name="Function" attribute="Normal Text" lineEndContext="#pop"> 0407 <keyword context="#pop" attribute="Function (Built-in)" String="functions" /> 0408 <StringDetect context="#pop" attribute="Function Name" String="%1" dynamic="true" /> 0409 <AnyChar context="#pop" String="(<>" lookAhead="true" /> 0410 </context> 0411 <context name="FunctionDeclaration" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> 0412 <DetectSpaces /> 0413 <RegExpr context="#pop" attribute="Function Declaration" String="&identifier;&functionSuffix;" /> <!-- NoRegExp --> 0414 <IncludeRules context="FindComments##JavaScript" /> 0415 </context> 0416 0417 <!-- Strings --> 0418 <context name="FindStrings" attribute="Normal Text" lineEndContext="#stay"> 0419 <DetectChar context="Template" attribute="Template" char="`" beginRegion="Template" /> 0420 <IncludeRules context="FindStrings##JavaScript" /> 0421 </context> 0422 <context name="Template" attribute="Template" lineEndContext="#stay"> 0423 <IncludeRules context="Escape##JavaScript" /> 0424 <Detect2Chars context="Substitution" attribute="Substitution" char="$" char1="{" /> 0425 <DetectChar context="RegExpAfterString##JavaScript" attribute="Template" char="`" endRegion="Template" /> 0426 </context> 0427 <context name="Substitution" attribute="Normal Text" lineEndContext="#stay"> 0428 <DetectChar context="#pop" attribute="Substitution" char="}" /> 0429 <IncludeRules context="Normal" /> 0430 </context> 0431 0432 <!-- Type Declaration: Highlight types after the "type" keyword --> 0433 0434 <context name="TypeDeclaration" attribute="Normal Text" lineEndContext="#stay"> 0435 <DetectSpaces /> 0436 <AnyChar context="#pop" String=";,{})]" lookAhead="true" /> 0437 <IncludeRules context="TypesFindBrackets" /> 0438 <IncludeRules context="DefaultTypes" /> 0439 <IncludeRules context="Normal" /> 0440 </context> 0441 0442 <!-- Type Parameter: Highlight types after ":" --> 0443 0444 <context name="Types" attribute="Normal Text" lineEndContext="#pop"> 0445 <IncludeRules context="FixPopLineEndContext" /> 0446 <IncludeRules context="TypesCommon" /> 0447 </context> 0448 <context name="TypesCommon" attribute="Normal Text" lineEndContext="#pop"> 0449 <DetectSpaces /> 0450 <IncludeRules context="TypesEnd" /> 0451 <!-- New line after "|" or "&". 0452 IMPORTANT: If you modify this rule, do so in "typescript-react.xml"! --> 0453 <RegExpr context="#pop!TypesNewLine" attribute="Symbol" String="[\|&](?=&endLine;)" minimal="true" /> 0454 0455 <IncludeRules context="TypesFindBrackets" /> 0456 <IncludeRules context="DefaultTypes" /> 0457 <IncludeRules context="Normal-ParametersOverridden" /> 0458 </context> 0459 <!-- NOTE: Context used by "typescript-react.xml" --> 0460 <context name="TypesEnd" attribute="Normal Text" lineEndContext="#stay"> 0461 <AnyChar context="#pop" String=";,}])" lookAhead="true" /> 0462 <RegExpr context="#pop" String="\=(?!>)" lookAhead="true" /> 0463 <Detect2Chars context="#pop" char="/" char1="/" lookAhead="true" /> 0464 </context> 0465 <context name="TypesNewLine" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!TypesCommon"> 0466 <DetectSpaces /> 0467 <IncludeRules context="FindComments##JavaScript" /> 0468 </context> 0469 0470 <!-- NOTE: The "NoRegExp" context invalidates lineEndContext="#pop", 0471 therefore the following rule is necessary --> 0472 <context name="FixPopLineEndContext" attribute="Normal Text" lineEndContext="#stay"> 0473 <RegExpr context="#pop" String="\S" firstNonSpace="true" lookAhead="true" /> 0474 </context> 0475 0476 <!-- Default: Type Parameter, Type Declaration, Angle Brackets --> 0477 0478 <context name="DefaultTypes" attribute="Normal Text" lineEndContext="#stay"> 0479 <!-- Types Keywords --> 0480 <keyword context="NoRegExpSameLine" attribute="Types" String="types" /> 0481 <!-- Assertions --> 0482 <WordDetect context="NoRegExpSameLine" attribute="Keyword" String="asserts" /> 0483 <!-- Type Guards --> 0484 <WordDetect context="NoRegExpSameLine" attribute="Keyword" String="is" /> 0485 0486 <!-- FIXME: For a strange reason, the keywords before "}" are not highlighted. 0487 This rule fixes it provisionally. --> 0488 <RegExpr context="#stay" attribute="Types" String="\b(?:string|number|bigint|boolean|symbol|any|void|never|unknown|undefined|null|object)(?=\})" /> 0489 0490 <!-- Don't start this context again and don't start the "ConditionalExpression" context --> 0491 <AnyChar context="#stay" attribute="Symbol" String=":?" /> 0492 <WordDetect context="#stay" attribute="Module" String="as" /> 0493 </context> 0494 <context name="TypesFindBrackets" attribute="Normal Text" lineEndContext="#stay"> 0495 <DetectChar context="TypesSquareBracket" attribute="Normal Text" char="[" beginRegion="List" /> 0496 <DetectChar context="TypesCurlyBracket" attribute="Normal Text" char="{" beginRegion="Brace" /> 0497 <DetectChar context="TypesRoundBracket" attribute="Normal Text" char="(" /> 0498 </context> 0499 0500 <context name="TypesSquareBracket" attribute="Normal Text" lineEndContext="#stay"> 0501 <DetectChar context="#pop!NoRegExp" attribute="Normal Text" char="]" endRegion="List" /> 0502 <IncludeRules context="TypesFindBrackets" /> 0503 <IncludeRules context="DefaultTypes" /> 0504 <IncludeRules context="Normal" /> 0505 </context> 0506 <context name="TypesCurlyBracket" attribute="Normal Text" lineEndContext="#pop!Object"> 0507 <DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" /> 0508 <RegExpr context="#pop!Object" String="\S" firstNonSpace="true" lookAhead="true" /> <!-- FixPopLineEndContext --> 0509 <IncludeRules context="TypesFindBrackets" /> 0510 <IncludeRules context="DefaultTypes" /> 0511 <IncludeRules context="Object" /> 0512 </context> 0513 <context name="TypesRoundBracket" attribute="Normal Text" lineEndContext="#pop"> 0514 <DetectChar context="#pop!NoRegExp" attribute="Normal Text" char=")" /> 0515 <IncludeRules context="FixPopLineEndContext" /> 0516 <IncludeRules context="TypesFindBrackets" /> 0517 <IncludeRules context="DefaultTypes" /> 0518 <IncludeRules context="Normal" /> 0519 </context> 0520 0521 <context name="TypesAngleBracket" attribute="Normal Text" lineEndContext="#pop"> 0522 <DetectChar context="#pop" attribute="Symbol" char=">" /> 0523 <IncludeRules context="TypesAngleBracketEnd" /> 0524 <IncludeRules context="FixPopLineEndContext" /> 0525 <IncludeRules context="TypesFindBrackets" /> 0526 <IncludeRules context="DefaultTypes" /> 0527 <IncludeRules context="Normal" /> 0528 </context> 0529 <!-- NOTE: Context used by "typescript-react.xml" --> 0530 <context name="TypesAngleBracketEnd" attribute="Normal Text" lineEndContext="#stay"> 0531 <AnyChar context="#pop" String="})];" lookAhead="true" /> 0532 </context> 0533 0534 <!-- new.target --> 0535 <context name="NewTarget" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0536 <DetectSpaces /> 0537 <AnyChar context="#stay" attribute="Symbol" String=".?!" /> 0538 <WordDetect context="#pop!NoRegExp" attribute="Keyword" String="target" /> 0539 </context> 0540 0541 <!-- After keyword list "control_export_types" --> 0542 <context name="ControlExport" attribute="Normal Text" lineEndContext="#pop"> 0543 <AnyChar context="#pop" attribute="Normal Text" String="{;" lookAhead="true" /> 0544 <IncludeRules context="FindStrings" /> 0545 <RegExpr context="#stay" attribute="Types" String="&identifier;" /> 0546 <IncludeRules context="FindComments##JavaScript" /> 0547 </context> 0548 0549 <!-- "import" keyword --> 0550 <context name="Import" attribute="Normal Text" lineEndContext="#pop"> 0551 <DetectChar context="#pop!ImportRequireKey" attribute="Symbol" char="=" /> 0552 <!-- import type ... --> 0553 <WordDetect context="#stay" attribute="Module" String="type" /> 0554 <!-- importmeta_property --> 0555 <WordDetect context="#pop!NoRegExp" attribute="Keyword" String="meta" /> 0556 <!-- Fix context NoRegExp (#pop in new line) --> 0557 <RegExpr context="#pop" String="." lookAhead="true" firstNonSpace="true" /> 0558 <AnyChar context="#pop" String="{}()[];," lookAhead="true" /> 0559 <IncludeRules context="Normal" /> 0560 </context> 0561 <context name="ImportRequireKey" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0562 <RegExpr context="#stay" attribute="Keyword" String="\s*require\s*(?=\()" /> 0563 <DetectChar context="ImportRequire" attribute="Normal Text" char="(" beginRegion="import" /> 0564 </context> 0565 <context name="ImportRequire" attribute="Normal Text" lineEndContext="#stay"> 0566 <DetectChar context="#pop#pop" attribute="Normal Text" char=")" endRegion="import" /> 0567 <IncludeRules context="FindStrings" /> 0568 <IncludeRules context="FindNumbers" /> 0569 <IncludeRules context="FindComments##JavaScript" /> 0570 </context> 0571 0572 <!-- Member Objects --> 0573 0574 <context name="MemberObject" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0575 <IncludeRules context="DefaultMemberObject" /> 0576 <!-- Common functions and properties, only for autocomplete keywords --> 0577 <keyword context="#pop!NoRegExp" attribute="Object Member" String="dom_property" /> 0578 <keyword context="#pop!NoRegExp" attribute="Function Name" String="dom_functions" /> 0579 <keyword context="#pop!NoRegExp" attribute="Object Member" String="eventhandler_property" /> 0580 <keyword context="#pop!NoRegExp" attribute="Function Name" String="function_common" /> 0581 </context> 0582 0583 <context name="DefaultMemberObject" attribute="Normal Text" lineEndContext="#pop"> 0584 <IncludeRules context="FixPointMemberObject" /> 0585 <DetectChar context="#stay" attribute="Symbol" char="." /> 0586 <Detect2Chars context="#stay" attribute="Symbol" char="?" char1="." /> 0587 <Detect2Chars context="#stay" attribute="Symbol" char="!" char1="." /> 0588 0589 <!-- The order of these rules is important: 1) Functions. 2) Constants & Properties. 3) Obj. Members. --> 0590 <!-- function(...) and function<...>(...) --> 0591 <RegExpr context="#pop" attribute="Function Name" String="&identifier;&functionSuffix;" /> 0592 <!-- Tagged Template Literals --> 0593 <RegExpr context="#pop" String="&identifier;\s*`" lookAhead="true" /> 0594 <!-- Generic constants and properties --> 0595 <keyword context="#pop!NoRegExp" attribute="Object Property (Built-in)" String="variable_property" /> 0596 <keyword context="#pop!NoRegExp" attribute="Constant" String="dom_constant" /> 0597 0598 <IncludeRules context="FindPrivateOperator##JavaScript" /> 0599 <RegExpr context="#stay" attribute="Object Member" String="&identifier;(?=&objectPoint;)" /> 0600 <RegExpr context="#pop!NoRegExp" attribute="Object Member" String="&identifier;" /> 0601 <IncludeRules context="NoRegExp" /> 0602 0603 <!-- Generic functions --> 0604 <keyword context="#pop!NoRegExp" attribute="Function Name" String="functions" /> 0605 </context> 0606 <context name="FixPointMemberObject" attribute="Normal Text" lineEndContext="#pop"> 0607 <StringDetect context="#pop" attribute="Symbol" String="?..." /> 0608 <StringDetect context="#pop" attribute="Symbol" String="!..." /> 0609 <StringDetect context="#pop" attribute="Symbol" String="..." /> 0610 </context> 0611 0612 0613 <!-- Built-in Classes --> 0614 <!-- Keep in sync with javascript.xml --> 0615 0616 <context name="BuiltInClasses" attribute="Normal Text" lineEndContext="#stay"> 0617 <WordDetect context="FindMemberObjectMath" attribute="Built-in Objects" String="Math" /> 0618 <WordDetect context="FindMemberObjectNumber" attribute="Built-in Objects" String="Number" /> 0619 <WordDetect context="FindMemberObjectPromise" attribute="Built-in Objects" String="Promise" /> 0620 <WordDetect context="FindMemberObjectJSON" attribute="Built-in Objects" String="JSON" /> 0621 <WordDetect context="FindMemberObjectConsole" attribute="Built-in Objects" String="console" /> 0622 <WordDetect context="FindMemberObjectProcess" attribute="Built-in Objects" String="process" /> 0623 0624 <keyword context="NoRegExp" attribute="Built-in Objects" String="class_builtin" /> 0625 <keyword context="NoRegExp" attribute="Built-in Objects" String="class_dom" /> 0626 <keyword context="FindMemberObjectDOM" attribute="Built-in Objects" String="dom_variable" /> 0627 <keyword context="NoRegExp" attribute="Built-in Objects" String="class_node" /> 0628 <keyword context="NoRegExp" attribute="Built-in Objects" String="node_variable" /> 0629 </context> 0630 <!-- These constants are highlighted in "Normal" --> 0631 <context name="BuiltInConstants" attribute="Normal Text" lineEndContext="#stay"> 0632 <keyword context="NoRegExp" attribute="Constant" String="math_constant" /> 0633 <keyword context="NoRegExp" attribute="Constant" String="number_constant" /> 0634 <keyword context="NoRegExp" attribute="Constant" String="dom_constant" /> 0635 </context> 0636 0637 <!-- DOM Variable --> 0638 <context name="FindMemberObjectDOM" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0639 <DetectSpaces /> 0640 <IncludeRules context="FixPointMemberObject" /> 0641 <DetectChar context="#pop!MemberObjectDOM" attribute="Symbol" char="." /> 0642 <Detect2Chars context="#pop!MemberObjectDOM" attribute="Symbol" char="?" char1="." /> 0643 <Detect2Chars context="#pop!MemberObjectDOM" attribute="Symbol" char="!" char1="." /> 0644 </context> 0645 <context name="MemberObjectDOM" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0646 <keyword context="#pop!FindMemberObjectDOM" attribute="Object Property (Built-in)" String="dom_property" /> 0647 <keyword context="#pop!FindMemberObjectDOM" attribute="Object Method (Built-in)" String="dom_functions" /> 0648 <IncludeRules context="DefaultMemberObject" /> 0649 <!-- Only for autocomplete --> 0650 <keyword context="#pop!NoRegExp" attribute="Object Member" String="eventhandler_property" /> 0651 <keyword context="#pop!NoRegExp" attribute="Function Name" String="function_common" /> 0652 </context> 0653 <!-- Math Class --> 0654 <context name="FindMemberObjectMath" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0655 <DetectSpaces /> 0656 <IncludeRules context="FixPointMemberObject" /> 0657 <DetectChar context="#pop!MemberObjectMath" attribute="Symbol" char="." /> 0658 <Detect2Chars context="#pop!MemberObjectMath" attribute="Symbol" char="?" char1="." /> 0659 <Detect2Chars context="#pop!MemberObjectMath" attribute="Symbol" char="!" char1="." /> 0660 </context> 0661 <context name="MemberObjectMath" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0662 <keyword context="#pop!NoRegExp" attribute="Constant" String="math_constant" /> 0663 <keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="math_functions" /> 0664 <IncludeRules context="DefaultMemberObject" /> 0665 </context> 0666 <!-- Number Class --> 0667 <context name="FindMemberObjectNumber" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0668 <DetectSpaces /> 0669 <IncludeRules context="FixPointMemberObject" /> 0670 <DetectChar context="#pop!MemberObjectNumber" attribute="Symbol" char="." /> 0671 <Detect2Chars context="#pop!MemberObjectNumber" attribute="Symbol" char="?" char1="." /> 0672 <Detect2Chars context="#pop!MemberObjectNumber" attribute="Symbol" char="!" char1="." /> 0673 </context> 0674 <context name="MemberObjectNumber" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0675 <keyword context="#pop!NoRegExp" attribute="Constant" String="number_constant" /> 0676 <IncludeRules context="DefaultMemberObject" /> 0677 </context> 0678 <!-- Promise Class --> 0679 <context name="FindMemberObjectPromise" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0680 <DetectSpaces /> 0681 <IncludeRules context="FixPointMemberObject" /> 0682 <DetectChar context="#pop!MemberObjectPromise" attribute="Symbol" char="." /> 0683 <Detect2Chars context="#pop!MemberObjectPromise" attribute="Symbol" char="?" char1="." /> 0684 <Detect2Chars context="#pop!MemberObjectPromise" attribute="Symbol" char="!" char1="." /> 0685 </context> 0686 <context name="MemberObjectPromise" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0687 <keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="promise_functions" /> 0688 <IncludeRules context="DefaultMemberObject" /> 0689 </context> 0690 <!-- JSON Class --> 0691 <context name="FindMemberObjectJSON" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0692 <DetectSpaces /> 0693 <IncludeRules context="FixPointMemberObject" /> 0694 <DetectChar context="#pop!MemberObjectJSON" attribute="Symbol" char="." /> 0695 <Detect2Chars context="#pop!MemberObjectJSON" attribute="Symbol" char="?" char1="." /> 0696 <Detect2Chars context="#pop!MemberObjectJSON" attribute="Symbol" char="!" char1="." /> 0697 </context> 0698 <context name="MemberObjectJSON" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0699 <keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="json_functions" /> 0700 <IncludeRules context="DefaultMemberObject" /> 0701 </context> 0702 <!-- Console Object --> 0703 <context name="FindMemberObjectConsole" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0704 <DetectSpaces /> 0705 <IncludeRules context="FixPointMemberObject" /> 0706 <DetectChar context="#pop!MemberObjectConsole" attribute="Symbol" char="." /> 0707 <Detect2Chars context="#pop!MemberObjectConsole" attribute="Symbol" char="?" char1="." /> 0708 <Detect2Chars context="#pop!MemberObjectConsole" attribute="Symbol" char="!" char1="." /> 0709 </context> 0710 <context name="MemberObjectConsole" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0711 <keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="console_functions" /> 0712 <IncludeRules context="DefaultMemberObject" /> 0713 </context> 0714 <!-- Process Object --> 0715 <context name="FindMemberObjectProcess" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp"> 0716 <DetectSpaces /> 0717 <IncludeRules context="FixPointMemberObject" /> 0718 <DetectChar context="#pop!MemberObjectProcess" attribute="Symbol" char="." /> 0719 <Detect2Chars context="#pop!MemberObjectProcess" attribute="Symbol" char="?" char1="." /> 0720 <Detect2Chars context="#pop!MemberObjectProcess" attribute="Symbol" char="!" char1="." /> 0721 </context> 0722 <context name="MemberObjectProcess" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> 0723 <keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="process_functions" /> 0724 <keyword context="#pop!NoRegExp" attribute="Object Property (Built-in)" String="process_property" /> 0725 <IncludeRules context="DefaultMemberObject" /> 0726 </context> 0727 0728 </contexts> 0729 0730 <itemDatas> 0731 <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" /> 0732 <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false" /> 0733 <itemData name="ControlFlow" defStyleNum="dsControlFlow" spellChecking="false" /> 0734 <itemData name="Reserved" defStyleNum="dsKeyword" italic="true" spellChecking="false" /> 0735 <itemData name="Module" defStyleNum="dsImport" spellChecking="false" /> 0736 <itemData name="Objects" defStyleNum="dsNormal" spellChecking="false" /> 0737 <itemData name="Object Member" defStyleNum="dsAttribute" spellChecking="false" /> 0738 <itemData name="Function Name" defStyleNum="dsFunction" spellChecking="false" /> 0739 <itemData name="Function Declaration" defStyleNum="dsFunction" spellChecking="false" /> 0740 <itemData name="Built-in Objects" defStyleNum="dsBuiltIn" spellChecking="false" /> 0741 <itemData name="Object Property (Built-in)" defStyleNum="dsAttribute" italic="1" spellChecking="false" /> 0742 <itemData name="Object Method (Built-in)" defStyleNum="dsFunction" italic="1" spellChecking="false" /> 0743 <itemData name="Function (Built-in)" defStyleNum="dsPreprocessor" spellChecking="false" /> 0744 <itemData name="Constant" defStyleNum="dsConstant" spellChecking="false" /> 0745 <itemData name="Types" defStyleNum="dsDataType" spellChecking="false" /> 0746 <itemData name="Parameter" defStyleNum="dsNormal" spellChecking="false" /> 0747 0748 <itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false" /> 0749 <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false" /> 0750 <itemData name="Hexadecimal" defStyleNum="dsBaseN" spellChecking="false" /> 0751 <itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false" /> 0752 <itemData name="Float" defStyleNum="dsFloat" spellChecking="false" /> 0753 <itemData name="Template" defStyleNum="dsVerbatimString" /> 0754 <itemData name="Substitution" defStyleNum="dsSpecialChar" spellChecking="false" /> 0755 0756 <itemData name="Comment" defStyleNum="dsComment" /> 0757 <itemData name="Symbol" defStyleNum="dsOperator" spellChecking="false" /> 0758 </itemDatas> 0759 0760 </highlighting> 0761 0762 <general> 0763 <comments> 0764 <comment name="singleLine" start="//" position="afterwhitespace" /> 0765 <comment name="multiLine" start="/*" end="*/" /> 0766 </comments> 0767 <keywords casesensitive="1" additionalDeliminator=""'`" weakDeliminator="$" /> 0768 </general> 0769 0770 </language> 0771 <!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; -->