| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!ENTITY simpleName "(?:[a-z][a-z\d]*:)?[a-z][a-z\d]*"> |
| 5 |
<!ENTITY baseName "[a-zA-Z_\$[:^ascii:]](?:[\w\$\-\.[:^ascii:]]*[\w\$[:^ascii:]])?"> |
| 6 |
<!ENTITY name "(?:&baseName;:)?&baseName;"> |
| 7 |
<!ENTITY baseNameWithBound "(?:\b[a-zA-Z_\$]|[^[:ascii:]])(?:[\w\$\-\.[:^ascii:]]*[\w\$[:^ascii:]])?"> |
| 8 |
<!ENTITY nameWithBound "(?:&baseNameWithBound;:)?&baseNameWithBound;"> <!-- Use this instead of "\b&name;" --> |
| 9 |
|
| 10 |
<!ENTITY simpleTag "<\s*&simpleName;"> <!-- Element tag --> |
| 11 |
<!ENTITY tag "<\s*(?:&name;|>)"> |
| 12 |
<!ENTITY entref "&(?:[a-zA-Z\d]+|#\d+|#x[a-fA-F\d]+);"> |
| 13 |
<!ENTITY mlComment "/\*(?:[^\*]|\*+[^/\*])*\*+/"> |
| 14 |
<!ENTITY endTagName "[\s<>]|/[>/\*]|$"> <!-- Delimiter of end of Tag name --> |
| 15 |
|
| 16 |
<!ENTITY identifier "[a-zA-Z_$[:^ascii:]][\w$[:^ascii:]]*"> |
| 17 |
]> |
| 18 |
|
| 19 |
<!-- |
| 20 |
==================================================================== |
| 21 |
|
| 22 |
This file is part of the KDE's KSyntaxHighlighting framework. |
| 23 |
|
| 24 |
Copyright 2018-2020 Nibaldo González S. ([email protected]) |
| 25 |
|
| 26 |
This Source Code Form is subject to the terms of the MIT License. |
| 27 |
If a copy of the license was not distributed with this file, |
| 28 |
You can obtain one at: https://opensource.org/licenses/MIT |
| 29 |
|
| 30 |
==================================================================== |
| 31 |
|
| 32 |
This file is an extension of the JavaScript highlighter |
| 33 |
(javascript.xml, Version 14 and higher). |
| 34 |
IMPORTANT: Keep sync with "typescript-react.xml". |
| 35 |
|
| 36 |
Based on the XML syntax highlighting (v7), by Wilbert Berendsen |
| 37 |
([email protected]), and the TypeScript React grammar files, |
| 38 |
available at: https://github.com/Microsoft/TypeScript-TmLanguage |
| 39 |
|
| 40 |
Change log: |
| 41 |
* v9 [2020-06-03]: Add folding in templates. |
| 42 |
* v8 [2019-11-21]: Tag detection is more stricter. |
| 43 |
* v7 [2019-11-19]: Rename definition "JavaScript React" to "JavaScript React (JSX)". |
| 44 |
* v5 [2019-02-20]: Don't highlight tags within declarations of |
| 45 |
types, variables, classes and interfaces. |
| 46 |
Fixes tags after substitutions in templates. |
| 47 |
Reorder part of the code. |
| 48 |
* v4 [2018-12-30]: Allow type assertion in the tag name. |
| 49 |
Allow tags after the keywords "await" & "yield". |
| 50 |
Allow empty tags and non-ASCII tag name & attributes. |
| 51 |
* v3 [2018-11-18]: Fix Doxygen comments & shebang. Remove TSX extension. |
| 52 |
* v2 [2018-08-18]: Remove "Conditional Expression" context. |
| 53 |
* v1 [2018-06-20]: Initial version |
| 54 |
--> |
| 55 |
|
| 56 |
<language name="JavaScript React (JSX)" version="10" kateversion="5.53" section="Scripts" indenter="cstyle" |
| 57 |
priority="9" extensions="*.jsx" mimetype="text/jsx;text/x-jsx;application/jsx;application/x-jsx;" |
| 58 |
author="Nibaldo González ([email protected])" license="MIT"> |
| 59 |
|
| 60 |
<highlighting> |
| 61 |
|
| 62 |
<contexts> |
| 63 |
|
| 64 |
<context name="Shebang" attribute="Normal Text" lineEndContext="#pop!Normal" lineEmptyContext="#pop!Normal" fallthrough="true" fallthroughContext="#pop!Normal"> |
| 65 |
<Detect2Chars context="ShebangLine" attribute="Comment" char="#" char1="!" column="0" /> |
| 66 |
</context> |
| 67 |
<context name="ShebangLine" attribute="Comment" lineEndContext="#pop#pop!Normal" /> |
| 68 |
|
| 69 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 70 |
<IncludeRules context="React" /> |
| 71 |
<IncludeRules context="Normal##JavaScript" /> |
| 72 |
</context> |
| 73 |
|
| 74 |
<!-- JavaScript --> |
| 75 |
|
| 76 |
<!-- Overwrite rules of 'javascript.xml'. These rules send to contexts |
| 77 |
that contain: <IncludeRules context="Normal"/> in the JavaScript XML file. --> |
| 78 |
<context name="OverwriteJavaScript" attribute="Normal Text" lineEndContext="#stay"> |
| 79 |
<DetectChar context="Template" attribute="Template" char="`" beginRegion="Template" /> |
| 80 |
<DetectChar attribute="Normal Text" context="#stay" char="[" beginRegion="List" /> |
| 81 |
<DetectChar attribute="Normal Text" context="NoRegExp##JavaScript" char="]" endRegion="List" /> |
| 82 |
<!-- NOTE: The "{" character sends to the "Object" context (see the "React" context) --> |
| 83 |
</context> |
| 84 |
<context name="Object" attribute="Normal Text" lineEndContext="#stay"> |
| 85 |
<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" /> |
| 86 |
<IncludeRules context="React" /> |
| 87 |
<RegExpr context="ConditionalExpression" attribute="Symbol" String="\?(?=[^\{\}]*&identifier;\s*\:)" /> |
| 88 |
<IncludeRules context="Object##JavaScript" /> |
| 89 |
</context> |
| 90 |
<context name="ConditionalExpression" attribute="Normal Text" lineEndContext="#pop"> |
| 91 |
<DetectChar context="#pop" attribute="Symbol" char=":" /> |
| 92 |
<IncludeRules context="React" /> |
| 93 |
<IncludeRules context="ConditionalExpression##JavaScript" /> |
| 94 |
</context> |
| 95 |
<context name="Template" attribute="Template" lineEndContext="#stay"> |
| 96 |
<DetectChar context="RegExpAfterString##JavaScript" attribute="Template" char="`" endRegion="Template" /> |
| 97 |
<!-- Find tags and send to the "Substitution" context --> |
| 98 |
<Detect2Chars context="Substitution-BeforeTag" attribute="Substitution" char="$" char1="{" /> |
| 99 |
<IncludeRules context="Template##JavaScript" /> |
| 100 |
</context> |
| 101 |
<context name="Substitution" attribute="Normal Text" lineEndContext="#stay"> |
| 102 |
<DetectChar context="#pop" attribute="Substitution" char="}" /> |
| 103 |
<IncludeRules context="React" /> |
| 104 |
<IncludeRules context="Substitution##JavaScript" /> |
| 105 |
</context> |
| 106 |
|
| 107 |
<!-- Do not highlight tags in some special contexts --> |
| 108 |
<context name="FindDeclarationsWithNoTags" attribute="Normal Text" lineEndContext="#stay"> |
| 109 |
<WordDetect context="InterfaceDeclaration" attribute="Reserved" String="interface" /> |
| 110 |
<WordDetect context="ClassDeclaration" attribute="Reserved" String="class" /> |
| 111 |
<WordDetect context="VarDeclaration" attribute="Reserved" String="let" /> |
| 112 |
<WordDetect context="VarDeclaration" attribute="Keyword" String="var" /> |
| 113 |
<WordDetect context="VarDeclaration" attribute="Keyword" String="const" /> |
| 114 |
</context> |
| 115 |
<!-- Do not highlight tags after ":" in variable declarations --> |
| 116 |
<context name="VarDeclaration" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> |
| 117 |
<DetectSpaces /> |
| 118 |
<DetectChar context="#pop!NoTag" attribute="Symbol" char=":" /> |
| 119 |
<RegExpr context="#stay" attribute="Normal Text" String="&identifier;(?=\s*(?:[\?!]\s*)?:)" /> |
| 120 |
<AnyChar context="#stay" attribute="Symbol" String="?!" /> |
| 121 |
<IncludeRules context="AllComments" /> |
| 122 |
</context> |
| 123 |
<context name="NoTag" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> |
| 124 |
<DetectSpaces /> |
| 125 |
<IncludeRules context="AllComments" /> |
| 126 |
<DetectChar context="#pop" attribute="Symbol" char="<" /> |
| 127 |
<RegExpr context="#stay" attribute="Normal Text" String="\(\s*(?=<)" /> |
| 128 |
<RegExpr context="#stay" attribute="Normal Text" String="\[\s*(?=<)" beginRegion="List" /> |
| 129 |
<RegExpr context="#pop!Object" attribute="Normal Text" String="\{\s*<(\s*/(?![\*/]))?" beginRegion="Brace" /> |
| 130 |
</context> |
| 131 |
<!-- Do not highlight tags in interface declarations --> |
| 132 |
<context name="InterfaceDeclaration" attribute="Normal Text" lineEndContext="#stay"> |
| 133 |
<DetectChar context="#pop!InterfaceContentDeclaration" attribute="Normal Text" char="{" beginRegion="Brace" /> |
| 134 |
<DetectChar context="#pop" char="}" lookAhead="true" /> |
| 135 |
<IncludeRules context="Normal##JavaScript" /> |
| 136 |
</context> |
| 137 |
<context name="InterfaceContentDeclaration" attribute="Normal Text" lineEndContext="#stay"> |
| 138 |
<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" /> |
| 139 |
<IncludeRules context="Object##JavaScript" /> |
| 140 |
</context> |
| 141 |
<!-- Do not highlight tags in class declarations --> |
| 142 |
<context name="ClassDeclaration" attribute="Normal Text" lineEndContext="#stay"> |
| 143 |
<DetectChar context="#pop!ClassDeclarationContent" attribute="Normal Text" char="{" beginRegion="Brace" /> |
| 144 |
<DetectChar context="#pop" char="}" lookAhead="true" /> |
| 145 |
<IncludeRules context="Normal##JavaScript" /> |
| 146 |
</context> |
| 147 |
<context name="ClassDeclarationContent" attribute="Normal Text" lineEndContext="#stay"> |
| 148 |
<DetectChar context="#pop" attribute="Normal Text" char="}" endRegion="Brace" /> |
| 149 |
<DetectChar context="NoTag" attribute="Symbol" char=":" /> |
| 150 |
<IncludeRules context="Object" /> |
| 151 |
</context> |
| 152 |
|
| 153 |
<!-- ReactJS --> |
| 154 |
|
| 155 |
<!-- Tags highlighting --> |
| 156 |
<context name="React" attribute="Normal Text" lineEndContext="#stay"> |
| 157 |
<!-- Tag in new line --> |
| 158 |
<RegExpr context="ValidTag" attribute="Normal Text" String="&tag;" firstNonSpace="true" lookAhead="true" /> |
| 159 |
<!-- Highlight tags only after some keywords --> |
| 160 |
<RegExpr context="ValidTag" attribute="ControlFlow" String="\b(?:return|await)\s*(?=&tag;|/\*)" /> |
| 161 |
<RegExpr context="ValidTag" attribute="Module" String="\b(?:default)\s*(?=&tag;|/\*)" /> |
| 162 |
<RegExpr context="ValidTag" attribute="Reserved" String="\b(?:yield)\s*(?=&tag;|/\*)" /> |
| 163 |
|
| 164 |
<!-- Characters before a valid tag --> |
| 165 |
<RegExpr context="ValidTag" attribute="Special Operators" String="\=>\s*(?=&tag;|/\*)" /> |
| 166 |
<RegExpr context="ValidTag" attribute="Symbol" String="(?:[,\=>:\*\?]|&&|\|\|)\s*(?=&tag;|/\*)" /> |
| 167 |
<RegExpr context="ValidTag" attribute="Normal Text" String="\[\s*(?=&tag;|/\*)" beginRegion="List" /> |
| 168 |
<RegExpr context="ValidTag" attribute="Normal Text" String="\(\s*(?=&tag;|/\*)" /> |
| 169 |
<!-- The "Object-BeforeTag" context looks for a valid Tag and then sends the "Object" context --> |
| 170 |
<DetectChar context="Object-BeforeTag" attribute="Normal Text" char="{" beginRegion="Brace" /> |
| 171 |
|
| 172 |
<RegExpr context="ValidTag" attribute="Symbol" String="<\s*>\s*(?=&tag;|/\*)" /> |
| 173 |
|
| 174 |
<!-- Tag after a comment on a new line --> |
| 175 |
<Detect2Chars context="ValidTag" attribute="Comment" char="/" char1="*" firstNonSpace="true" lookAhead="true" /> |
| 176 |
|
| 177 |
<!-- Overwrite JavaScript rules to highlight tags within some contexts --> |
| 178 |
<IncludeRules context="FindDeclarationsWithNoTags" /> |
| 179 |
<IncludeRules context="OverwriteJavaScript" /> |
| 180 |
</context> |
| 181 |
|
| 182 |
<!-- Detect tags before starting a context --> |
| 183 |
<context name="Object-BeforeTag" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Object"> |
| 184 |
<IncludeRules context="ValidTag" /> |
| 185 |
</context> |
| 186 |
<context name="Substitution-BeforeTag" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Substitution"> |
| 187 |
<IncludeRules context="ValidTag" /> |
| 188 |
</context> |
| 189 |
<context name="EvaluatedCode-BeforeTag" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!EvaluatedCode"> |
| 190 |
<IncludeRules context="ValidTag" /> |
| 191 |
</context> |
| 192 |
|
| 193 |
<!-- TAGS: |
| 194 |
NOTE & TODO: The following code is common for 'javascript-react.xml' and 'typescript-react.xml' |
| 195 |
and is replicated in both files. Look for some way to avoid having repeated code, for example, |
| 196 |
with a common XML file or with a generator script. The only drawback is that the |
| 197 |
"EvaluatedCode" context includes "Normal". --> |
| 198 |
|
| 199 |
<!-- Highlight nested tags with comments in between. |
| 200 |
NOTE: The highlighting of Tags after a multiline comment does not work with: lineEndContext="#pop" --> |
| 201 |
<context name="ValidTag" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> |
| 202 |
<RegExpr context="#stay" attribute="Normal Text" String="\s+(?=<|/\*)" /> |
| 203 |
<IncludeRules context="FindTags" /> |
| 204 |
<IncludeRules context="AllComments" /> |
| 205 |
</context> |
| 206 |
|
| 207 |
<!-- Start tag. |
| 208 |
There are two contexts to find Tags: |
| 209 |
* FindTags: For Tags within TypeScript code; invalid name tags aren't highlighted. |
| 210 |
* FindTagsInTagContent: For Tag within another tag; highlight any Tag. |
| 211 |
Tags with invalid names are highlighted as "Error". |
| 212 |
--> |
| 213 |
<context name="FindTags" attribute="Normal Text" lineEndContext="#stay"> |
| 214 |
<!-- Invalid Tag, do not highlight tags in these cases: |
| 215 |
* "?" or "," after tag name: |
| 216 |
<Tag ? ... |
| 217 |
<Tag< ? ... |
| 218 |
<Tag /* comment */ ? ... |
| 219 |
* Invalid delimiter after comment (without spaces): |
| 220 |
<Tag/* comment */# |
| 221 |
--> |
| 222 |
<RegExpr context="#pop" attribute="Symbol" String="<(?=\s*&name;(?:(<(?:\s*&mlComment;)*)?(?:\s*&mlComment;)*\s*[\?,]|(?:&mlComment;)+(?!&endTagName;|&baseName;|\{)))" /> |
| 223 |
|
| 224 |
<!-- Empty tag (element) --> |
| 225 |
<RegExpr context="ElementTagContent" attribute="Element Tag" String="<\s*>" beginRegion="Element" /> |
| 226 |
<!-- Detect Tags --> |
| 227 |
<RegExpr context="ElementTagFindType" attribute="Element Tag" String="&simpleTag;(?=&endTagName;)" beginRegion="Element" /> |
| 228 |
<RegExpr context="ComponentTagFindType" attribute="Component Tag" String="&tag;(?=&endTagName;)" beginRegion="ComponentElement" /> |
| 229 |
<!-- If a valid Tag was not detected --> |
| 230 |
<DetectChar context="#pop" attribute="Symbol" char="<" /> |
| 231 |
</context> |
| 232 |
|
| 233 |
<context name="FindTagsInTagContent" attribute="Normal Text" lineEndContext="#stay"> |
| 234 |
<!-- Empty tag (element) --> |
| 235 |
<RegExpr context="ElementTagContent" attribute="Element Tag" String="<\s*>" beginRegion="Element" /> |
| 236 |
<!-- Detect non-ASCII character in the tag name (component). This prevents highlighting as Element, |
| 237 |
tag names that don't start with a non-ASCII character. --> |
| 238 |
<RegExpr context="ComponentTagNonASCII" attribute="Component Tag" String="<\s*(?=(?:[a-z][a-z\d]*:)?(?:[a-z][a-z\d]*)?[^[:ascii:]])" beginRegion="ComponentElement" /> <!-- &simpleName; --> |
| 239 |
<!-- Element & component tags --> |
| 240 |
<RegExpr context="ElementTagFindType" attribute="Element Tag" String="&simpleTag;(?=[^\w\$\-\.:]|$|[\-\.]+(?:[^\w\$\-\.]|$)|:(?:[^a-zA-Z_\$]|$))" beginRegion="Element" /> |
| 241 |
<RegExpr context="ComponentTagFindType" attribute="Component Tag" String="&tag;" beginRegion="ComponentElement" /> |
| 242 |
</context> |
| 243 |
<!-- Highlight tag name with non-ASCII characters --> |
| 244 |
<context name="ComponentTagNonASCII" attribute="Normal Text" lineEndContext="#pop!ComponentTag" fallthrough="true" fallthroughContext="#pop!ComponentTag"> |
| 245 |
<RegExpr context="#pop!ComponentTagFindType" attribute="Component Tag" String="&name;" /> |
| 246 |
</context> |
| 247 |
|
| 248 |
<context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay"> |
| 249 |
<RegExpr context="#stay" attribute="EntityRef" String="&entref;" /> |
| 250 |
</context> |
| 251 |
|
| 252 |
<!-- Type after the tag name. Ex: <C<number> /> --> |
| 253 |
<context name="ComponentTagFindType" attribute="Normal Text" lineEndContext="#pop!ComponentTag" fallthrough="true" fallthroughContext="#pop!ComponentTag"> |
| 254 |
<DetectChar context="#pop!TypeInsideTag" attribute="Symbol" char="<" /> |
| 255 |
</context> |
| 256 |
<context name="ElementTagFindType" attribute="Normal Text" lineEndContext="#pop!ElementTag" fallthrough="true" fallthroughContext="#pop!ElementTag"> |
| 257 |
<DetectChar context="#pop!TypeInsideTag" attribute="Symbol" char="<" /> |
| 258 |
</context> |
| 259 |
|
| 260 |
<!-- Type assertion after the tag name --> |
| 261 |
<context name="TypeInsideTag" attribute="Component Tag" lineEndContext="#stay"> |
| 262 |
<DetectChar context="#pop!ComponentTag" attribute="Symbol" char=">" /> |
| 263 |
<IncludeRules context="DefaultTypeInsideTag" /> |
| 264 |
</context> |
| 265 |
<context name="DefaultTypeInsideTag" attribute="Component Tag" lineEndContext="#stay"> |
| 266 |
<DetectChar context="TypeInsideTag-AngleBracket" attribute="Symbol" char="<" /> |
| 267 |
<DetectChar context="TypeInsideTag-CurlyBracket" attribute="Symbol" char="{" /> |
| 268 |
<DetectChar context="TypeInsideTag-SquareBracket" attribute="Symbol" char="[" /> |
| 269 |
<DetectChar context="TypeInsideTag-RoundBracket" attribute="Symbol" char="(" /> |
| 270 |
<IncludeRules context="AllComments" /> |
| 271 |
</context> |
| 272 |
<context name="TypeInsideTag-AngleBracket" attribute="Component Tag" lineEndContext="#stay"> |
| 273 |
<DetectChar context="#pop" attribute="Symbol" char=">" /> |
| 274 |
<IncludeRules context="DefaultTypeInsideTag" /> |
| 275 |
</context> |
| 276 |
<context name="TypeInsideTag-CurlyBracket" attribute="Component Tag" lineEndContext="#stay"> |
| 277 |
<DetectChar context="#pop" attribute="Symbol" char="}" /> |
| 278 |
<IncludeRules context="DefaultTypeInsideTag" /> |
| 279 |
</context> |
| 280 |
<context name="TypeInsideTag-SquareBracket" attribute="Component Tag" lineEndContext="#stay"> |
| 281 |
<DetectChar context="#pop" attribute="Symbol" char="]" /> |
| 282 |
<IncludeRules context="DefaultTypeInsideTag" /> |
| 283 |
</context> |
| 284 |
<context name="TypeInsideTag-RoundBracket" attribute="Component Tag" lineEndContext="#stay"> |
| 285 |
<DetectChar context="#pop" attribute="Symbol" char=")" /> |
| 286 |
<IncludeRules context="DefaultTypeInsideTag" /> |
| 287 |
</context> |
| 288 |
|
| 289 |
<!-- Inside the tag --> |
| 290 |
<context name="ElementTag" attribute="Normal Text" lineEndContext="#stay"> |
| 291 |
<Detect2Chars context="#pop" attribute="Element Tag" char="/" char1=">" endRegion="Element" /> |
| 292 |
<DetectChar context="#pop!ElementTagContent" attribute="Element Tag" char=">" /> |
| 293 |
<IncludeRules context="DefaultTag" /> |
| 294 |
</context> |
| 295 |
<context name="ComponentTag" attribute="Normal Text" lineEndContext="#stay"> |
| 296 |
<Detect2Chars context="#pop" attribute="Component Tag" char="/" char1=">" endRegion="ComponentElement" /> |
| 297 |
<DetectChar context="#pop!ComponentTagContent" attribute="Component Tag" char=">" /> |
| 298 |
<IncludeRules context="DefaultTag" /> |
| 299 |
</context> |
| 300 |
<context name="DefaultTag" attribute="Normal Text" lineEndContext="#stay"> |
| 301 |
<RegExpr context="Attribute" attribute="Attribute" String="&nameWithBound;" /> |
| 302 |
<IncludeRules context="FindEvaluatedCode" /> |
| 303 |
<IncludeRules context="AllComments" /> |
| 304 |
<RegExpr context="#stay" attribute="Error" String="\S+&name;|\S" /> |
| 305 |
</context> |
| 306 |
|
| 307 |
<!-- Tag content: <Tag> content </Tag> --> |
| 308 |
<context name="ElementTagContent" attribute="Tag Content Text" lineEndContext="#stay"> |
| 309 |
<RegExpr context="#pop" attribute="Element Tag" String="</\s*>" endRegion="Element" /> |
| 310 |
<!-- With component tag (error) --> |
| 311 |
<RegExpr context="ElementTagEnd" attribute="Element Tag" String="</\s*(&simpleName;|(?=[A-Z_\$]))" /> |
| 312 |
<IncludeRules context="DefaultTagContent" /> |
| 313 |
</context> |
| 314 |
<context name="ComponentTagContent" attribute="Tag Content Text" lineEndContext="#stay"> |
| 315 |
<RegExpr context="#pop" attribute="Component Tag" String="</\s*>" endRegion="ComponentElement" /> |
| 316 |
<RegExpr context="ComponentTagEnd" attribute="Component Tag" String="</\s*&name;" /> |
| 317 |
<IncludeRules context="DefaultTagContent" /> |
| 318 |
</context> |
| 319 |
<context name="DefaultTagContent" attribute="Tag Content Text" lineEndContext="#stay"> |
| 320 |
<IncludeRules context="FindTagsInTagContent" /> |
| 321 |
<IncludeRules context="FindEntityRefs" /> |
| 322 |
<IncludeRules context="FindEvaluatedCode" /> |
| 323 |
<DetectChar context="#stay" attribute="Error" char="<" /> |
| 324 |
</context> |
| 325 |
|
| 326 |
<context name="ElementTagEnd" attribute="Normal Text" lineEndContext="#stay"> |
| 327 |
<DetectChar context="#pop#pop" attribute="Element Tag" char=">" endRegion="Element" /> |
| 328 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 329 |
</context> |
| 330 |
<context name="ComponentTagEnd" attribute="Normal Text" lineEndContext="#stay"> |
| 331 |
<DetectChar context="#pop#pop" attribute="Component Tag" char=">" endRegion="ComponentElement" /> |
| 332 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 333 |
</context> |
| 334 |
|
| 335 |
<!-- Tag attribute --> |
| 336 |
<context name="Attribute" attribute="Normal Text" lineEndContext="#stay"> |
| 337 |
<RegExpr context="#pop" attribute="Error" String="\=(?=\s*/?>)" /> |
| 338 |
<DetectChar context="#pop!Value" attribute="Symbol" char="=" /> |
| 339 |
<IncludeRules context="FindEndTag" /> |
| 340 |
<DetectChar context="#pop" char="{" lookAhead="true" /> <!-- EvaluatedCode --> |
| 341 |
<IncludeRules context="AllComments" /> |
| 342 |
<RegExpr context="#stay" attribute="Attribute" String="&nameWithBound;" /> |
| 343 |
<RegExpr context="#stay" attribute="Error" String="\S+&name;|\S" /> |
| 344 |
</context> |
| 345 |
|
| 346 |
<context name="Value" attribute="Normal Text" lineEndContext="#stay"> |
| 347 |
<DetectChar context="#pop!ValueDQ" attribute="Value" char=""" /> |
| 348 |
<DetectChar context="#pop!ValueSQ" attribute="Value" char="'" /> |
| 349 |
<DetectChar context="#pop" char="{" lookAhead="true" /> <!-- EvaluatedCode --> |
| 350 |
<IncludeRules context="FindEndTag" /> |
| 351 |
<IncludeRules context="AllComments" /> |
| 352 |
<RegExpr context="#stay" attribute="Error" String="\S" /> |
| 353 |
</context> |
| 354 |
<context name="ValueDQ" attribute="Value" lineEndContext="#stay"> |
| 355 |
<DetectChar context="#pop" attribute="Value" char=""" /> |
| 356 |
<IncludeRules context="FindEntityRefs" /> |
| 357 |
</context> |
| 358 |
<context name="ValueSQ" attribute="Value" lineEndContext="#stay"> |
| 359 |
<DetectChar context="#pop" attribute="Value" char="'" /> |
| 360 |
<IncludeRules context="FindEntityRefs" /> |
| 361 |
</context> |
| 362 |
|
| 363 |
<context name="FindEndTag" attribute="Normal Text" lineEndContext="#stay"> |
| 364 |
<Detect2Chars context="#pop" char="/" char1=">" lookAhead="true" /> |
| 365 |
<DetectChar context="#pop" char=">" lookAhead="true" /> |
| 366 |
</context> |
| 367 |
|
| 368 |
<context name="FindEvaluatedCode" attribute="Normal Text" lineEndContext="#stay"> |
| 369 |
<!-- Find tags and send to the "EvaluatedCode" context --> |
| 370 |
<DetectChar context="EvaluatedCode-BeforeTag" attribute="Code Brackets" char="{" beginRegion="Code" /> |
| 371 |
</context> |
| 372 |
<context name="EvaluatedCode" attribute="Normal Text" lineEndContext="#stay"> |
| 373 |
<DetectChar context="#pop" attribute="Code Brackets" char="}" endRegion="Code" /> |
| 374 |
<IncludeRules context="Normal" /> |
| 375 |
</context> |
| 376 |
|
| 377 |
<context name="AllComments" attribute="Normal Text" lineEndContext="#stay"> |
| 378 |
<!-- TypeScript uses this for comments --> |
| 379 |
<IncludeRules context="FindComments##JavaScript" /> |
| 380 |
</context> |
| 381 |
|
| 382 |
</contexts> |
| 383 |
|
| 384 |
<itemDatas> |
| 385 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" /> |
| 386 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 387 |
|
| 388 |
<itemData name="Tag Content Text" defStyleNum="dsNormal" /> |
| 389 |
<itemData name="Element Tag" defStyleNum="dsKeyword" spellChecking="false" /> |
| 390 |
<itemData name="Component Tag" defStyleNum="dsFunction" bold="1" spellChecking="false" /> |
| 391 |
<itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false" /> |
| 392 |
<itemData name="Value" defStyleNum="dsString" spellChecking="false" /> |
| 393 |
<itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false" /> |
| 394 |
<itemData name="Code Brackets" defStyleNum="dsVariable" spellChecking="false" /> |
| 395 |
<itemData name="Error" defStyleNum="dsError" spellChecking="false" /> |
| 396 |
|
| 397 |
<!-- itemDatas in JavaScript XML file --> |
| 398 |
<itemData name="Symbol" defStyleNum="dsOperator" /> |
| 399 |
<itemData name="ControlFlow" defStyleNum="dsControlFlow" spellChecking="false" /> |
| 400 |
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false" /> |
| 401 |
<itemData name="Reserved" defStyleNum="dsKeyword" italic="true" spellChecking="false" /> |
| 402 |
<itemData name="Module" defStyleNum="dsImport" spellChecking="false" /> |
| 403 |
<itemData name="Template" defStyleNum="dsVerbatimString" /> |
| 404 |
<itemData name="Substitution" defStyleNum="dsSpecialChar" spellChecking="false" /> |
| 405 |
<itemData name="Special Operators" defStyleNum="dsKeyword" spellChecking="false" /> |
| 406 |
</itemDatas> |
| 407 |
|
| 408 |
</highlighting> |
| 409 |
|
| 410 |
<general> |
| 411 |
<keywords casesensitive="1" /> |
| 412 |
<comments> |
| 413 |
<comment name="singleLine" start="//" /> |
| 414 |
<comment name="multiLine" start="/*" end="*/" /> |
| 415 |
</comments> |
| 416 |
</general> |
| 417 |
|
| 418 |
</language> |
| 419 |
<!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; --> |