1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
<!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*<)">
<!-- function<...>( or function( -->
<!ENTITY functionSuffix "(?=\s*(?:<(?:\{(?:[^\{\}]|\{[^\{\}]*\})*\}|\((?:[^\(\)]|\([^\(\)]*\))*\)|\[(?:[^\[\]]|\[[^\[\]]*\])*\]|'(?:\\.|[^'])*'|"(?:\\.|[^"])*"|`(?:\\.|[^`])*`|[^<>]|<.*>)*>)?\()">
<!ENTITY codeContent ""(?:[^"]|\\.)*"|'(?:[^']|\\.)*'|`(?:[^`]|\\.)`|/\*.*\*/|/(?:[^/\\\[]|\\.|\[(?:[^\]\\]|\\.)+\])+/">
<!-- https://tc39.es/ecma262/#sec-literals-numeric-literals -->
<!ENTITY DecimalIntegerLiteral "(0|[1-9][0-9]*+(_[0-9]++)*+)">
<!ENTITY DecimalDigits "([0-9]++(_[0-9]++)*+)">
<!ENTITY ExponentPart "([eE][+-]?&DecimalDigits;)">
<!ENTITY float "\b&DecimalIntegerLiteral;(\.&DecimalDigits;?&ExponentPart;?|&ExponentPart;)|\.&DecimalDigits;&ExponentPart;?">
]>
<!--
====================================================================
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"
alternativeNames="TS"
version="18"
kateversion="5.53"
section="Scripts"
extensions="*.ts;*.mts;*.cts"
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="¶meter;" />
<IncludeRules context="Normal Pt2" />
</context>
<context name="Normal Pt1" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="JSBaseSomeSymboles##JavaScript" />
<DetectChar context="Types" attribute="Symbol" char=":" />
<!-- 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=")" />
<StringDetect context="#stay" attribute="Symbol" String="..." />
<IncludeRules context="FindNumbers" />
<DetectChar context="MemberObject" attribute="Symbol" char="." />
<IncludeRules context="FindStrings" />
<IncludeRules context="FindPrivateOperator##JavaScript" />
<!-- 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;)" />
<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*`)" />
<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*(?:(?:[^/"'`\s\?:\.;,\=\}\]\)]|&codeContent;)(?:[^/"'`]|&codeContent;)*)?&identifier;\s*(?:/\*.*\*/\s*)*:|(?:&&|\|\||\s*(?:/\*.*\*/\s*)*&identifier;)?&endLine;)" minimal="true" />
<!-- Type Parameter: Highlight types after ":" and between "<" and ">" -->
<RegExpr context="TypesAngleBracket" attribute="Symbol" String="<(?=(?:&identifier;|[\[\{\(<]).*>)" />
<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" />
<!-- unrecheable by Regex=&identifier; in "JSBase##JavaScript" included by "Normal Pt2"
<RegExpr context="#stay" attribute="Parameter" String="¶meter;" />-->
</context>
<context name="ConditionalExpressionEnd" attribute="Normal Text" lineEndContext="#stay">
<AnyChar context="#pop" String=";,}])" lookAhead="true" />
<RegExpr context="#pop" String="\=(?!>)" 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="</script\s*(?:>|$)" 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 attribute="Float" context="NoRegExp" String="&float;" />
<AnyChar context="Integer" String="0123456789" lookAhead="1"/>
</context>
<!-- same as JS, but with Hexadecimal instead of Hex -->
<context name="Integer" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Hexadecimal" context="#pop!NumericSufix" String="\b0[xX][0-9a-fA-F]++(_[0-9a-fA-F]++)*+"/>
<!-- 07 is octal, 08 is decimal -->
<RegExpr attribute="Octal" context="#pop!NumericSufix" String="\b0([oO][0-7]++(_[0-7]++)*+|0*+[1-7][0-7]*+(_[0-7]++)*+(?!_?[89]))" />
<RegExpr attribute="Binary" context="#pop!NumericSufix" String="\b0[bB][01]++(_[01]++)*+" />
<!-- 0000_8 is invalid -->
<RegExpr attribute="Decimal" context="#pop!NumericSufix" String="\b0*+([1-9][0-9]*+(_[0-9]++)*+)?"/>
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="NumericSufix" fallthrough="true" fallthroughContext="#pop!NoRegExp">
<DetectChar attribute="Normal Text" context="#pop!NoRegExp" char="n" />
<IncludeRules context="NumericSufixError##JavaScript" />
</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="(<>" 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="[\|&](?=&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="\=(?!>)" 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=">" />
<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" />
<IncludeRules context="FindPrivateOperator##JavaScript" />
<RegExpr context="#stay" attribute="Object Member" String="&identifier;(?=&objectPoint;)" />
<RegExpr context="#pop!NoRegExp" attribute="Object Member" String="&identifier;" />
<IncludeRules context="NoRegExp" />
<!-- 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="//" position="afterwhitespace" />
<comment name="multiLine" start="/*" end="*/" />
</comments>
<keywords casesensitive="1" additionalDeliminator=""'`" weakDeliminator="$" />
</general>
</language>
<!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; -->
|