<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!ENTITY identifier     "[a-zA-Z_$[:^ascii:]][\w$[:^ascii:]]*">
	<!ENTITY numSuffix      "(?=n?(?:[^\w]|$))">
	<!ENTITY objectOp       "[\?!]?">
	<!ENTITY objectPoint    "\s*&objectOp;\.">
	<!ENTITY endLine        "\s*(?:$|//|(?:/\*.*\*/\s*)+(?:$|//))">
	<!ENTITY parameter      "&identifier;(?=\s*&objectOp;:)">

	<!ENTITY utilityTypes   "\b(?:Partial|Readonly|Record|Pick|Omit|Exclude|Extract|NonNullable|ReturnType|InstanceType|Required|ThisType)(?=\s*&lt;)">
	<!-- function<...>( or function( -->
	<!ENTITY functionSuffix "(?=\s*(?:&lt;(?:\{(?:[^\{\}]|\{[^\{\}]*\})*\}|\((?:[^\(\)]|\([^\(\)]*\))*\)|\[(?:[^\[\]]|\[[^\[\]]*\])*\]|'(?:\\.|[^'])*'|&quot;(?:\\.|[^&quot;])*&quot;|`(?:\\.|[^`])*`|[^&lt;&gt;]|&lt;.*&gt;)*&gt;)?\()">

	<!ENTITY codeContent    "&quot;(?:[^&quot;]|\\.)*&quot;|'(?:[^']|\\.)*'|`(?:[^`]|\\.)`|/\*.*\*/|/(?:[^/\\\[]|\\.|\[(?:[^\]\\]|\\.)+\])+/">
]>

<!--
    ====================================================================

      This file is part of the KDE's KSyntaxHighlighting framework.

      Copyright 2018-2020 Nibaldo González S. (nibgonz@gmail.com)

      This Source Code Form is subject to the terms of the MIT License.
      If a copy of the license was not distributed with this file,
      You can obtain one at: https://opensource.org/licenses/MIT

    ====================================================================

    This file is an extension of the JavaScript highlighter
    (javascript.xml, Version 14 and higher).
    Based on the TypeScript grammar files,
    available at: https://github.com/Microsoft/TypeScript-TmLanguage

    NOTE: TypeScript directives are highlighted by "doxygen.xml",
    included in the JavaScript highlighter.
    Ex:
      /// <reference no-default-lib="true"/>

      Tags: reference, amd-dependency, amd-module
      Attributes: path, types, no-default-lib, name

    Change log:
     * v11 [2020-06-03]: Improve tagged template literals.
     * v10 [2020-04-13]: Add the 'awaited' type operator.
     * v9 [2020-02-23]: Add private-named instance fields and type-only imports/exports.
                        Improve conditional expressions.
     * v8 [2019-12-12]: Add "bigint" primitive type.
     * v7 [2019-11-20]: Move keywords of built-in object to "javascript.xml" and adapt.
     * v6 [2019-10-01]: Add "asserts" keyword in type predicates.
                        Highlight types after the "as" keyword.
     * v5 [2019-08-30]: Avoid that ?: be used as conditional expressions.
     * v4 [2019-07-16]: Fixed highlighting of keywords before ":" in conditional expressions.
     * v3 [2019-02-18]: Add support to bigint and the "is" keyword.
                        Fixes keyword delimiters. Don't highlight regex
                        after "]" and ")". Multiple fixes and improvements.
     * v2 [2018-12-29]: Don't highlight built-in classes as functions,
                        fix float-points, improve types detection and other fixes.
     * v1 [2018-11-18]: Initial version
-->

<language name="TypeScript"
          version="11"
          kateversion="5.53"
          section="Scripts"
          extensions="*.ts"
          priority="9"
          mimetype="text/typescript;application/typescript;text/x-typescript;application/x-typescript"
          indenter="cstyle"
          author="Nibaldo González (nibgonz@gmail.com)"
          license="MIT">

<highlighting>

	<!-- Include all JavaScript keywords! -->
	<list name="controlflow">
		<include>controlflow##JavaScript</include>
		<item>goto</item>
	</list>
	<list name="keywords">
		<include>keywords##JavaScript</include>
	</list>
	<list name="reserved">
		<include>reserved##JavaScript</include>
		<item>type</item>
		<item>arguments</item>
		<!-- Class -->
		<item>declare</item> <!-- storage modifier -->
		<item>readonly</item>
		<item>abstract</item>
		<item>constructor</item>
		<item>get</item>
		<item>set</item>
		<!-- Also:
		     public, protected, private, async, super, new, static -->
	</list>
	<list name="module">
		<include>module##JavaScript</include>
	</list>
	<list name="primitives">
		<include>primitives##JavaScript</include>
		<!-- Types Built-in -->
		<item>object</item>
		<!-- Also:
		     this, true, false, undefined, null -->
	</list>

	<list name="control_export_types">
		<!-- storage.type.namespace.ts -->
		<item>namespace</item>
		<item>module</item>
	</list>
	<list name="types_operator_expression">
		<item>keyof</item>
		<item>infer</item>
		<item>awaited</item>
		<!-- Also: typeof, readonly -->
	</list>
	<!-- Datatypes & Primitive Types -->
	<list name="types">
		<item>string</item>
		<item>number</item>
		<item>bigint</item>
		<item>boolean</item>
		<item>symbol</item>
		<item>any</item>
		<item>void</item>
		<item>never</item>
		<item>unknown</item>

		<item>undefined</item>
		<item>null</item>
		<item>object</item>
	</list>

	<!-- Built-in Classes, Functions & Constants -->

	<list name="class_builtin">
		<include>class_builtin##JavaScript</include>
	</list>
	<!-- DOM Classes -->
	<list name="class_dom">
		<include>class_dom##JavaScript</include>
	</list>
	<!-- Node.js Classes -->
	<list name="class_node">
		<include>class_node##JavaScript</include>
	</list>

	<!-- General Properties of Classes -->
	<list name="variable_property">
		<include>variable_property##JavaScript</include>
	</list>
	<!-- General Built-in Functions -->
	<list name="functions">
		<include>functions##JavaScript</include>
	</list>

	<!-- Functions of "console" -->
	<list name="console_functions">
		<include>console_functions##JavaScript</include>
	</list>
	<!-- Properties of "process" -->
	<list name="process_property">
		<include>process_property##JavaScript</include>
	</list>
	<!-- Functions of "process" -->
	<list name="process_functions">
		<include>process_functions##JavaScript</include>
	</list>

	<!-- Constants of Number Class -->
	<list name="number_constant">
		<include>number_constant##JavaScript</include>
	</list>
	<!-- Constants of Math Class-->
	<list name="math_constant">
		<include>math_constant##JavaScript</include>
	</list>
	<!-- Methods of Math Class -->
	<list name="math_functions">
		<include>math_functions##JavaScript</include>
	</list>
	<!-- Methods of JSON Class -->
	<list name="json_functions">
		<include>json_functions##JavaScript</include>
	</list>
	<!-- Methods of Promise Class -->
	<list name="promise_functions">
		<include>promise_functions##JavaScript</include>
	</list>

	<!-- Node.js Variables -->
	<list name="node_variable">
		<include>node_variable##JavaScript</include>
	</list>
	<!-- DOM Variables -->
	<list name="dom_variable">
		<include>dom_variable##JavaScript</include>
	</list>
	<!-- DOM Constants -->
	<list name="dom_constant">
		<include>dom_constant##JavaScript</include>
	</list>

	<!-- For Autocomplete Keywords -->
	<!-- Properties of DOM Classes -->
	<list name="dom_property">
		<include>dom_property##JavaScript</include>
	</list>
	<!-- Methods of DOM Classes -->
	<list name="dom_functions">
		<include>dom_functions##JavaScript</include>
	</list>
	<!-- Event Handler -->
	<list name="eventhandler_property">
		<include>eventhandler_property##JavaScript</include>
	</list>
	<!-- Others Methods of Classes -->
	<list name="function_common">
		<include>function_common##JavaScript</include>
	</list>

	<contexts>

		<context name="Shebang" attribute="Normal Text" lineEndContext="Normal" lineEmptyContext="Normal" fallthrough="true" fallthroughContext="Normal">
			<Detect2Chars context="ShebangLine" attribute="Comment" char="#" char1="!" column="0" />
		</context>
		<context name="ShebangLine" attribute="Comment" lineEndContext="#pop!Normal" />

		<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
			<IncludeRules context="Normal Pt1" />

			<!-- NOTE & TODO: The identifiers before ":" are highlighted as "dsNormal".
			     These identifiers should be highlighted in a different way depending on the
			     context, for example, in the declaration of classes or interfaces, in sets, the
			     parameters of a function, or after the keywords: "const", "var", "let" & "enum". -->
			<RegExpr context="#stay" attribute="Parameter" String="&parameter;" />

			<IncludeRules context="Normal Pt2" />
		</context>

		<context name="Normal Pt1" attribute="Normal Text" lineEndContext="#stay">
			<StringDetect context="#stay" attribute="Symbol" String="..." />
			<IncludeRules context="FindNumbers" />
			<IncludeRules context="FindStrings" />

			<!-- Abstract -->
			<RegExpr context="#stay" attribute="Reserved" String="\babstract(?=\s+(?:class|interface)\b)" />
			<!-- New -->
			<RegExpr context="NewTarget" attribute="Keyword" String="\bnew(?=&objectPoint;\s*target\b)" />
			<RegExpr context="MemberObject" attribute="Objects" String="\bnew(?=&objectOp;\.)" />
			<WordDetect context="#stay" attribute="Keyword" String="new" />

			<!-- Keywords: control flow -->
			<keyword context="#stay" attribute="ControlFlow" String="controlflow" />
			<RegExpr context="#stay" attribute="ControlFlow" String="\bdefault(?=\s*&objectOp;:)" />
		</context>
		<context name="Normal Pt2" attribute="Normal Text" lineEndContext="#stay">
			<!-- Keywords -->
			<WordDetect context="TypeDeclaration" attribute="Reserved" String="type" />
			<WordDetect context="FunctionDeclaration" attribute="Keyword" String="function" />
			<keyword context="#stay" attribute="Keyword" String="keywords" /> <!-- NoRegExp? -->
			<keyword context="#stay" attribute="Reserved" String="reserved" />

			<!-- Utility Types -->
			<RegExpr context="#stay" attribute="Built-in Objects" String="&utilityTypes;" />
			<!-- Built-in Classes -->
			<IncludeRules context="BuiltInClasses" />
			<IncludeRules context="BuiltInConstants" />
			<!-- Objects -->
			<RegExpr context="MemberObject" attribute="Objects" String="&identifier;(?=&objectPoint;)" />
			<DetectChar context="MemberObject" attribute="Symbol" char="." />

			<RegExpr context="Types" attribute="Module" String="\bas(?=\s)" />
			<!-- Import -->
			<WordDetect context="Import" attribute="Module" String="import" />
			<RegExpr context="#stay" attribute="Module" String="\bexport\s+type\b" />
			<!-- Export types -->
			<keyword context="ControlExport" attribute="Module" String="control_export_types" />
			<!-- Keywords -->
			<keyword context="#stay" attribute="Module" String="module" />
			<keyword context="NoRegExp" attribute="Keyword" String="primitives" />
			<keyword context="#stay" attribute="Keyword" String="types_operator_expression" />

			<!-- Functions: function(...) and function<...>(...) -->
			<RegExpr context="Function" attribute="Function Name" String="(&identifier;)&functionSuffix;" lookAhead="true" />
			<!-- Tagged Template Literals -->
			<RegExpr context="#stay" attribute="Function Name" String="&identifier;(?=\s*`)" />

			<!-- Symbols & Operators -->
			<!-- NOTE: - The brackets {}()[] are highlighted as Normal Text.
			           - Bracket highlighting rules must be explicitly included here
			             for the "Animate Bracket Highlighting" feature to work properly. -->
			<DetectChar context="Object" attribute="Normal Text" char="{" beginRegion="Brace" />
			<DetectChar context="#stay" attribute="Normal Text" char="[" beginRegion="List" />
			<DetectChar context="NoRegExp" attribute="Normal Text" char="]" endRegion="List" />
			<DetectChar context="#stay" attribute="Normal Text" char="(" />
			<DetectChar context="NoRegExp" attribute="Normal Text" char=")" />

			<Detect2Chars context="#stay" attribute="Symbol" char="?" char1="?" /> <!-- Null operator -->
			<!-- Conditional Expressions:
			       CASE 1:  '?' ... <identifier> ':'
			       CASE 2:  '?' ... ( '||' | '&&' ) <end-line>
			       CASE 3:  '?' (<identifier>)? <end-line>
			-->
			<RegExpr context="ConditionalExpression" attribute="Symbol" String="\?(?=\s*(?:(?:[^/&quot;'`\s\?:\.;,\=\}\]\)]|&codeContent;)(?:[^/&quot;'`]|&codeContent;)*)?&identifier;\s*(?:/\*.*\*/\s*)*:|(?:&amp;&amp;|\|\||\s*(?:/\*.*\*/\s*)*&identifier;)?&endLine;)" minimal="true" />

			<!-- Type Parameter: Highlight types after ":" and between "<" and ">" -->
			<DetectChar context="Types" attribute="Symbol" char=":" />
			<RegExpr context="TypesAngleBracket" attribute="Symbol" String="&lt;(?=(?:&identifier;|[\[\{\(&lt;]).*&gt;)" />

			<IncludeRules context="JSBase##JavaScript" />
		</context>

		<!-- Conditional Expressions: a ? b : c -->
		<!-- Highlight keywords before ":" in conditional expressions. -->
		<context name="ConditionalExpression" attribute="Normal Text" lineEndContext="#stay">
			<!-- NOTE: Don't start the "Types" context. See the context "Default Types". -->
			<DetectChar context="#pop" attribute="Symbol" char=":" />
			<IncludeRules context="ConditionalExpressionEnd" />
			<DetectChar context="#stay" attribute="Symbol" char="?" />

			<IncludeRules context="FindConditionalExpressionBrackets" />
			<IncludeRules context="Normal-ParametersOverridden" />
		</context>
		<context name="Normal-ParametersOverridden" attribute="Normal Text" lineEndContext="#stay">
			<IncludeRules context="Normal Pt1" />
			<IncludeRules context="Normal Pt2" />
			<RegExpr context="#stay" attribute="Parameter" String="&parameter;" />
		</context>
		<context name="ConditionalExpressionEnd" attribute="Normal Text" lineEndContext="#stay">
			<AnyChar context="#pop" String=";,}])" lookAhead="true" />
			<RegExpr context="#pop" String="\=(?!&gt;)" lookAhead="true" />
			<!-- For TypeScript code embedded in HTML and Markdown -->
			<StringDetect context="#pop" String="```" lookAhead="true" firstNonSpace="true" />
			<StringDetect context="#pop" String="~~~" lookAhead="true" firstNonSpace="true" />
			<RegExpr context="#pop" String="&lt;/script\s*(?:&gt;|$)" insensitive="true" lookAhead="true" />
		</context>
		<context name="FindConditionalExpressionBrackets" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="ConditionalExpressionRoundBracket" attribute="Normal Text" char="(" />
			<DetectChar context="ConditionalExpressionSquareBracket" attribute="Symbol" char="[" beginRegion="List" />
		</context>
		<context name="ConditionalExpressionRoundBracket" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop!NoRegExp" attribute="Normal Text" char=")" />
			<IncludeRules context="FindConditionalExpressionBrackets" />
			<IncludeRules context="Normal" />
		</context>
		<context name="ConditionalExpressionSquareBracket" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop!NoRegExp" attribute="Symbol" char="]" endRegion="List" />
			<IncludeRules context="FindConditionalExpressionBrackets" />
			<IncludeRules context="Normal" />
		</context>

		<!-- Object, within { ... } -->
		<context name="Object" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" />
			<keyword context="NoRegExp" attribute="Keyword" String="keywords" />
			<!-- Highlight types in the following line.
			     NOTE: Using the "NoRegExp" context can cause this to apply to multiple lines. -->
			<RegExpr context="TypesNewLine" attribute="Symbol" String=":(?=&endLine;)" minimal="true" />
			<IncludeRules context="Normal" />
		</context>

		<!-- Avoid highlighting regular expressions. -->
		<context name="NoRegExp" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
			<IncludeRules context="NoRegExp##JavaScript" />
		</context>
		<!-- Avoid highlighting regular expressions on a single line. -->
		<context name="NoRegExpSameLine" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<IncludeRules context="NoRegExp##JavaScript" />
		</context>

		<!-- Numbers -->
		<context name="FindNumbers" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="NoRegExp" attribute="Hexadecimal" String="\b0[xX][\da-fA-F][\da-fA-F_]*&numSuffix;" />
			<RegExpr context="NoRegExp" attribute="Binary" String="\b0[bB][01][01_]*&numSuffix;" />
			<RegExpr context="NoRegExp" attribute="Float" String="(?:\b\d[\d_]*\.?|(?:\b\d[\d_]*)?\.\d[\d_]*)[eE][\+\-]?\d[\d_]*&numSuffix;" />
			<RegExpr context="NoRegExp" attribute="Float" String="(?:\.\d[\d_]*|\b\d[\d_]*\.(?:\d[\d_]*)?)&numSuffix;" />
			<RegExpr context="NoRegExp" attribute="Octal" String="\b0[oO]?[0-7][0-7_]*&numSuffix;" />
			<RegExpr context="NoRegExp" attribute="Decimal" String="\b\d[\d_]*&numSuffix;" />
		</context>

		<!-- Function Name -->
		<context name="Function" attribute="Normal Text" lineEndContext="#pop">
			<keyword context="#pop" attribute="Function (Built-in)" String="functions" />
			<StringDetect context="#pop" attribute="Function Name" String="%1" dynamic="true" />
			<AnyChar context="#pop" String="(&lt;&gt;" lookAhead="true" />
		</context>
		<context name="FunctionDeclaration" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
			<DetectSpaces />
			<RegExpr context="#pop" attribute="Function Declaration" String="&identifier;&functionSuffix;" /> <!-- NoRegExp -->
			<IncludeRules context="FindComments##JavaScript" />
		</context>

		<!-- Strings -->
		<context name="FindStrings" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="Template" attribute="Template" char="`" beginRegion="Template" />
			<IncludeRules context="FindStrings##JavaScript" />
		</context>
		<context name="Template" attribute="Template" lineEndContext="#stay">
			<IncludeRules context="Escape##JavaScript" />
			<Detect2Chars context="Substitution" attribute="Substitution" char="$" char1="{" />
			<DetectChar context="RegExpAfterString##JavaScript" attribute="Template" char="`" endRegion="Template" />
		</context>
		<context name="Substitution" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop" attribute="Substitution" char="}" />
			<IncludeRules context="Normal" />
		</context>

		<!-- Type Declaration: Highlight types after the "type" keyword -->

		<context name="TypeDeclaration" attribute="Normal Text" lineEndContext="#stay">
			<DetectSpaces />
			<AnyChar context="#pop" String=";,{})]" lookAhead="true" />
			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Normal" />
		</context>

		<!-- Type Parameter: Highlight types after ":" -->

		<context name="Types" attribute="Normal Text" lineEndContext="#pop">
			<IncludeRules context="FixPopLineEndContext" />
			<IncludeRules context="TypesCommon" />
		</context>
		<context name="TypesCommon" attribute="Normal Text" lineEndContext="#pop">
			<DetectSpaces />
			<IncludeRules context="TypesEnd" />
			<!-- New line after "|" or "&".
			     IMPORTANT: If you modify this rule, do so in "typescript-react.xml"! -->
			<RegExpr context="#pop!TypesNewLine" attribute="Symbol" String="[\|&amp;](?=&endLine;)" minimal="true" />

			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Normal-ParametersOverridden" />
		</context>
		<!-- NOTE: Context used by "typescript-react.xml" -->
		<context name="TypesEnd" attribute="Normal Text" lineEndContext="#stay">
			<AnyChar context="#pop" String=";,}])" lookAhead="true" />
			<RegExpr context="#pop" String="\=(?!&gt;)" lookAhead="true" />
			<Detect2Chars context="#pop" char="/" char1="/" lookAhead="true" />
		</context>
		<context name="TypesNewLine" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!TypesCommon">
			<DetectSpaces />
			<IncludeRules context="FindComments##JavaScript" />
		</context>

		<!-- NOTE: The "NoRegExp" context invalidates lineEndContext="#pop",
		     therefore the following rule is necessary -->
		<context name="FixPopLineEndContext" attribute="Normal Text" lineEndContext="#stay">
			<RegExpr context="#pop" String="\S" firstNonSpace="true" lookAhead="true" />
		</context>

		<!-- Default: Type Parameter, Type Declaration, Angle Brackets -->

		<context name="DefaultTypes" attribute="Normal Text" lineEndContext="#stay">
			<!-- Types Keywords -->
			<keyword context="NoRegExpSameLine" attribute="Types" String="types" />
			<!-- Assertions -->
			<WordDetect context="NoRegExpSameLine" attribute="Keyword" String="asserts" />
			<!-- Type Guards -->
			<WordDetect context="NoRegExpSameLine" attribute="Keyword" String="is" />

			<!-- FIXME: For a strange reason, the keywords before "}" are not highlighted.
			     This rule fixes it provisionally. -->
			<RegExpr context="#stay" attribute="Types" String="\b(?:string|number|bigint|boolean|symbol|any|void|never|unknown|undefined|null|object)(?=\})" />

			<!-- Don't start this context again and don't start the "ConditionalExpression" context -->
			<AnyChar context="#stay" attribute="Symbol" String=":?" />
			<WordDetect context="#stay" attribute="Module" String="as" />
		</context>
		<context name="TypesFindBrackets" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="TypesSquareBracket" attribute="Normal Text" char="[" beginRegion="List" />
			<DetectChar context="TypesCurlyBracket" attribute="Normal Text" char="{" beginRegion="Brace" />
			<DetectChar context="TypesRoundBracket" attribute="Normal Text" char="(" />
		</context>

		<context name="TypesSquareBracket" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop!NoRegExp" attribute="Normal Text" char="]" endRegion="List" />
			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Normal" />
		</context>
		<context name="TypesCurlyBracket" attribute="Normal Text" lineEndContext="#pop!Object">
			<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" />
			<RegExpr context="#pop!Object" String="\S" firstNonSpace="true" lookAhead="true" /> <!-- FixPopLineEndContext -->
			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Object" />
		</context>
		<context name="TypesRoundBracket" attribute="Normal Text" lineEndContext="#pop">
			<DetectChar context="#pop!NoRegExp" attribute="Normal Text" char=")" />
			<IncludeRules context="FixPopLineEndContext" />
			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Normal" />
		</context>

		<context name="TypesAngleBracket" attribute="Normal Text" lineEndContext="#pop">
			<DetectChar context="#pop" attribute="Symbol" char="&gt;" />
			<IncludeRules context="TypesAngleBracketEnd" />
			<IncludeRules context="FixPopLineEndContext" />
			<IncludeRules context="TypesFindBrackets" />
			<IncludeRules context="DefaultTypes" />
			<IncludeRules context="Normal" />
		</context>
		<!-- NOTE: Context used by "typescript-react.xml" -->
		<context name="TypesAngleBracketEnd" attribute="Normal Text" lineEndContext="#stay">
			<AnyChar context="#pop" String="})];" lookAhead="true" />
		</context>

		<!-- new.target -->
		<context name="NewTarget" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<DetectSpaces />
			<AnyChar context="#stay" attribute="Symbol" String=".?!" />
			<WordDetect context="#pop!NoRegExp" attribute="Keyword" String="target" />
		</context>

		<!-- After keyword list "control_export_types" -->
		<context name="ControlExport" attribute="Normal Text" lineEndContext="#pop">
			<AnyChar context="#pop" attribute="Normal Text" String="{;" lookAhead="true" />
			<IncludeRules context="FindStrings" />
			<RegExpr context="#stay" attribute="Types" String="&identifier;" />
			<IncludeRules context="FindComments##JavaScript" />
		</context>

		<!-- "import" keyword -->
		<context name="Import" attribute="Normal Text" lineEndContext="#pop">
			<DetectChar context="#pop!ImportRequireKey" attribute="Symbol" char="=" />
			<!-- import type ... -->
			<WordDetect context="#stay" attribute="Module" String="type" />
			<!-- importmeta_property -->
			<WordDetect context="#pop!NoRegExp" attribute="Keyword" String="meta" />
			<!-- Fix context NoRegExp (#pop in new line) -->
			<RegExpr context="#pop" String="." lookAhead="true" firstNonSpace="true" />
			<AnyChar context="#pop" String="{}()[];," lookAhead="true" />
			<IncludeRules context="Normal" />
		</context>
		<context name="ImportRequireKey" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<RegExpr context="#stay" attribute="Keyword" String="\s*require\s*(?=\()" />
			<DetectChar context="ImportRequire" attribute="Normal Text" char="(" beginRegion="import" />
		</context>
		<context name="ImportRequire" attribute="Normal Text" lineEndContext="#stay">
			<DetectChar context="#pop#pop" attribute="Normal Text" char=")" endRegion="import" />
			<IncludeRules context="FindStrings" />
			<IncludeRules context="FindNumbers" />
			<IncludeRules context="FindComments##JavaScript" />
		</context>

		<!-- Member Objects -->

		<context name="MemberObject" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<IncludeRules context="DefaultMemberObject" />
			<!-- Common functions and properties, only for autocomplete keywords -->
			<keyword context="#pop!NoRegExp" attribute="Object Member" String="dom_property" />
			<keyword context="#pop!NoRegExp" attribute="Function Name" String="dom_functions" />
			<keyword context="#pop!NoRegExp" attribute="Object Member" String="eventhandler_property" />
			<keyword context="#pop!NoRegExp" attribute="Function Name" String="function_common" />
		</context>

		<context name="DefaultMemberObject" attribute="Normal Text" lineEndContext="#pop">
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#stay" attribute="Symbol" char="." />
			<Detect2Chars context="#stay" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#stay" attribute="Symbol" char="!" char1="." />

			<!-- The order of these rules is important: 1) Functions. 2) Constants & Properties. 3) Obj. Members. -->
			<!-- function(...) and function<...>(...) -->
			<RegExpr context="#pop" attribute="Function Name" String="&identifier;&functionSuffix;" />
			<!-- Tagged Template Literals -->
			<RegExpr context="#pop" String="&identifier;\s*`" lookAhead="true" />
			<!-- Generic constants and properties -->
			<keyword context="#pop!NoRegExp" attribute="Object Property (Built-in)" String="variable_property" />
			<keyword context="#pop!NoRegExp" attribute="Constant" String="dom_constant" />

			<RegExpr context="#stay" attribute="Normal Text" String="#(?=&identifier;)" /> <!-- Private-Named Instance Fields -->
			<RegExpr context="#stay" attribute="Object Member" String="&identifier;(?=&objectPoint;)" />
			<RegExpr context="#pop!NoRegExp" attribute="Object Member" String="&identifier;" />
			<IncludeRules context="NoRegExp" />
			<DetectSpaces />

			<!-- Generic functions -->
			<keyword context="#pop!NoRegExp" attribute="Function Name" String="functions" />
		</context>
		<context name="FixPointMemberObject" attribute="Normal Text" lineEndContext="#pop">
			<StringDetect context="#pop" attribute="Symbol" String="?..." />
			<StringDetect context="#pop" attribute="Symbol" String="!..." />
			<StringDetect context="#pop" attribute="Symbol" String="..." />
		</context>


		<!-- Built-in Classes -->
		<!-- Keep in sync with javascript.xml -->

		<context name="BuiltInClasses" attribute="Normal Text" lineEndContext="#stay">
			<WordDetect context="FindMemberObjectMath" attribute="Built-in Objects" String="Math" />
			<WordDetect context="FindMemberObjectNumber" attribute="Built-in Objects" String="Number" />
			<WordDetect context="FindMemberObjectPromise" attribute="Built-in Objects" String="Promise" />
			<WordDetect context="FindMemberObjectJSON" attribute="Built-in Objects" String="JSON" />
			<WordDetect context="FindMemberObjectConsole" attribute="Built-in Objects" String="console" />
			<WordDetect context="FindMemberObjectProcess" attribute="Built-in Objects" String="process" />

			<keyword context="NoRegExp" attribute="Built-in Objects" String="class_builtin" />
			<keyword context="NoRegExp" attribute="Built-in Objects" String="class_dom" />
			<keyword context="FindMemberObjectDOM" attribute="Built-in Objects" String="dom_variable" />
			<keyword context="NoRegExp" attribute="Built-in Objects" String="class_node" />
			<keyword context="NoRegExp" attribute="Built-in Objects" String="node_variable" />
		</context>
		<!-- These constants are highlighted in "Normal" -->
		<context name="BuiltInConstants" attribute="Normal Text" lineEndContext="#stay">
			<keyword context="NoRegExp" attribute="Constant" String="math_constant" />
			<keyword context="NoRegExp" attribute="Constant" String="number_constant" />
			<keyword context="NoRegExp" attribute="Constant" String="dom_constant" />
		</context>

		<!-- DOM Variable -->
		<context name="FindMemberObjectDOM" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectDOM" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectDOM" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectDOM" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectDOM" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!FindMemberObjectDOM" attribute="Object Property (Built-in)" String="dom_property" />
			<keyword context="#pop!FindMemberObjectDOM" attribute="Object Method (Built-in)" String="dom_functions" />
			<IncludeRules context="DefaultMemberObject" />
			<!-- Only for autocomplete -->
			<keyword context="#pop!NoRegExp" attribute="Object Member" String="eventhandler_property" />
			<keyword context="#pop!NoRegExp" attribute="Function Name" String="function_common" />
		</context>
		<!-- Math Class -->
		<context name="FindMemberObjectMath" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectMath" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectMath" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectMath" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectMath" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Constant" String="math_constant" />
			<keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="math_functions" />
			<IncludeRules context="DefaultMemberObject" />
		</context>
		<!-- Number Class -->
		<context name="FindMemberObjectNumber" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectNumber" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectNumber" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectNumber" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectNumber" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Constant" String="number_constant" />
			<IncludeRules context="DefaultMemberObject" />
		</context>
		<!-- Promise Class -->
		<context name="FindMemberObjectPromise" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectPromise" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectPromise" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectPromise" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectPromise" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="promise_functions" />
			<IncludeRules context="DefaultMemberObject" />
		</context>
		<!-- JSON Class -->
		<context name="FindMemberObjectJSON" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectJSON" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectJSON" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectJSON" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectJSON" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="json_functions" />
			<IncludeRules context="DefaultMemberObject" />
		</context>
		<!-- Console Object -->
		<context name="FindMemberObjectConsole" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectConsole" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectConsole" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectConsole" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectConsole" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="console_functions" />
			<IncludeRules context="DefaultMemberObject" />
		</context>
		<!-- Process Object -->
		<context name="FindMemberObjectProcess" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!NoRegExp">
			<DetectSpaces />
			<IncludeRules context="FixPointMemberObject" />
			<DetectChar context="#pop!MemberObjectProcess" attribute="Symbol" char="." />
			<Detect2Chars context="#pop!MemberObjectProcess" attribute="Symbol" char="?" char1="." />
			<Detect2Chars context="#pop!MemberObjectProcess" attribute="Symbol" char="!" char1="." />
		</context>
		<context name="MemberObjectProcess" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
			<keyword context="#pop!NoRegExp" attribute="Object Method (Built-in)" String="process_functions" />
			<keyword context="#pop!NoRegExp" attribute="Object Property (Built-in)" String="process_property" />
			<IncludeRules context="DefaultMemberObject" />
		</context>

	</contexts>

	<itemDatas>
		<itemData name="Normal Text"      defStyleNum="dsNormal" spellChecking="false" />
		<itemData name="Keyword"          defStyleNum="dsKeyword" spellChecking="false" />
		<itemData name="ControlFlow"      defStyleNum="dsControlFlow" spellChecking="false" />
		<itemData name="Reserved"         defStyleNum="dsKeyword" italic="true" spellChecking="false" />
		<itemData name="Module"           defStyleNum="dsImport" spellChecking="false" />
		<itemData name="Objects"          defStyleNum="dsNormal" spellChecking="false" />
		<itemData name="Object Member"    defStyleNum="dsAttribute" spellChecking="false" />
		<itemData name="Function Name"    defStyleNum="dsFunction" spellChecking="false" />
		<itemData name="Function Declaration" defStyleNum="dsFunction" spellChecking="false" />
		<itemData name="Built-in Objects" defStyleNum="dsBuiltIn" spellChecking="false" />
		<itemData name="Object Property (Built-in)" defStyleNum="dsAttribute" italic="1" spellChecking="false" />
		<itemData name="Object Method (Built-in)" defStyleNum="dsFunction" italic="1" spellChecking="false" />
		<itemData name="Function (Built-in)" defStyleNum="dsPreprocessor" spellChecking="false" />
		<itemData name="Constant"         defStyleNum="dsConstant" spellChecking="false" />
		<itemData name="Types"            defStyleNum="dsDataType" spellChecking="false" />
		<itemData name="Parameter"        defStyleNum="dsNormal" spellChecking="false" />

		<itemData name="Decimal"      defStyleNum="dsDecVal" spellChecking="false" />
		<itemData name="Octal"        defStyleNum="dsBaseN" spellChecking="false" />
		<itemData name="Hexadecimal"  defStyleNum="dsBaseN" spellChecking="false" />
		<itemData name="Binary"       defStyleNum="dsBaseN" spellChecking="false" />
		<itemData name="Float"        defStyleNum="dsFloat" spellChecking="false" />
		<itemData name="Template"     defStyleNum="dsVerbatimString" />
		<itemData name="Substitution" defStyleNum="dsSpecialChar" spellChecking="false" />

		<itemData name="Comment"      defStyleNum="dsComment" />
		<itemData name="Symbol"       defStyleNum="dsOperator" spellChecking="false" />
	</itemDatas>

</highlighting>

<general>
	<comments>
		<comment name="singleLine" start="//" />
		<comment name="multiLine" start="/*" end="*/" />
	</comments>
	<keywords casesensitive="1" additionalDeliminator="&quot;&apos;`" weakDeliminator="$" />
</general>

</language>
<!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; -->
