| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!ENTITY digitPart "[0-9](?:_?[0-9])*"> |
| 5 |
<!ENTITY beforeDigit "(?<![\.\w[:^ascii:]])"> |
| 6 |
<!ENTITY beforePointFloat "(?<![\w[:^ascii:]])"> |
| 7 |
|
| 8 |
<!-- Python 2 style. Syntax: |
| 9 |
1. start character '%' |
| 10 |
2. [optional] Mapping key, e.g. '(foo)' |
| 11 |
3. [optional] Conversion flags, one of '#0- +' |
| 12 |
4. [optional] Minimum width, integer or '*' |
| 13 |
5. [optional] Precision, '.' followed by integer or '*' |
| 14 |
6. [optional] Length modifier, one of 'hlL' |
| 15 |
7. conversion type, one of 'crsdiouxXeEfFgG%' |
| 16 |
[Special cases: %prog and %default - see http://docs.python.org/library/optparse.html] |
| 17 |
--> |
| 18 |
<!ENTITY strsubstitution_py2 "%(?:(?:\([a-zA-Z0-9_]+\))?[#0\- +]?(?:[1-9][0-9]*|\*)?(?:\.(?:[1-9][0-9]*|\*))?[hlL]?[crsdiouxXeEfFgG%]|prog|default)"> |
| 19 |
<!-- http://docs.python.org/2/library/string.html#format-string-syntax: |
| 20 |
replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}" |
| 21 |
field_name ::= arg_name ("." attribute_name | "[" element_index "]")* |
| 22 |
arg_name ::= [identifier | integer] |
| 23 |
attribute_name ::= identifier |
| 24 |
element_index ::= integer | index_string |
| 25 |
index_string ::= <any source character except "]"> + |
| 26 |
conversion ::= "r" | "s" |
| 27 |
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type] |
| 28 |
fill ::= <any character> |
| 29 |
align ::= "<" | ">" | "=" | "^" |
| 30 |
sign ::= "+" | "-" | " " |
| 31 |
width ::= integer |
| 32 |
precision ::= integer |
| 33 |
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%" |
| 34 |
--> |
| 35 |
<!ENTITY strsubstitution_py3 "\{(?:(?:[a-zA-Z0-9_]+|[0-9]+)(?:\.[a-zA-Z0-9_]+|\[[^ \]]+\])*)?(?:![rs])?(?::(?:[^}]?[<>=^])?[ +-]?#?0?[0-9]*(?:\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}"> |
| 36 |
|
| 37 |
<!ENTITY rawString "(?:ru|u?r|)(?:'(?:[^']++|\\')*+'|"(?:[^"]++|\\")*+")"> |
| 38 |
<!ENTITY formatString "(?:r?f|fr?)(?:'(?:[^'{]++|\\'|\{\{|\{[^}]++\})*+'|"(?:[^"]++|\\"|\{\{|\{[^}]*+\})*+")"> |
| 39 |
<!ENTITY string "&rawString;|&formatString;"> |
| 40 |
]> |
| 41 |
<!-- Python syntax highlightning v0.9 by Per Wigren --> |
| 42 |
<!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) --> |
| 43 |
<!-- Python syntax highlighting v1.97 by Paul Giannaros --> |
| 44 |
<!-- Python syntax highlighting v1.99 by Primoz Anzur --> |
| 45 |
<!-- Python syntax highlighting v2.01 by Paul Giannaros: |
| 46 |
* full format character support |
| 47 |
* unicode string modifier supported --> |
| 48 |
<!-- v2.02 remove RegExpr for nums and make indent consistent --> |
| 49 |
<!-- v2.03 highlight decorators, remove operator regex, don't highlight parens as operators --> |
| 50 |
<!-- v2.04 make alerts visible even if they are directly after ''' or # without a space --> |
| 51 |
<!-- v2.06 decorator names can (and often do) contain periods --> |
| 52 |
<!-- v2.07 add support for %prog and co, see bug 142832 --> |
| 53 |
<!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords --> |
| 54 |
<!-- v2.29 recognize escape sequenzes correctly --> |
| 55 |
<language name="Python" version="26" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;*.pyi;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> |
| 56 |
<highlighting> |
| 57 |
<list name="import"> |
| 58 |
<item>import</item> |
| 59 |
<item>from</item> |
| 60 |
<item>as</item> |
| 61 |
</list> |
| 62 |
<list name="defs"> |
| 63 |
<item>class</item> |
| 64 |
<item>def</item> |
| 65 |
<item>del</item> |
| 66 |
<item>global</item> |
| 67 |
<item>lambda</item> |
| 68 |
<item>nonlocal</item> |
| 69 |
</list> |
| 70 |
<list name="operators"> |
| 71 |
<item>and</item> |
| 72 |
<item>in</item> |
| 73 |
<item>is</item> |
| 74 |
<item>not</item> |
| 75 |
<item>or</item> |
| 76 |
</list> |
| 77 |
<list name="flow"> |
| 78 |
<item>assert</item> |
| 79 |
<item>break</item> |
| 80 |
<item>continue</item> |
| 81 |
<item>elif</item> |
| 82 |
<item>else</item> |
| 83 |
<item>except</item> |
| 84 |
<item>finally</item> |
| 85 |
<item>for</item> |
| 86 |
<item>if</item> |
| 87 |
<item>pass</item> |
| 88 |
<item>raise</item> |
| 89 |
<item>return</item> |
| 90 |
<item>try</item> |
| 91 |
<item>while</item> |
| 92 |
<item>with</item> |
| 93 |
<item>async</item> |
| 94 |
<item>await</item> |
| 95 |
</list> |
| 96 |
<list name="flow_yield"> |
| 97 |
<item>yield</item> |
| 98 |
<!-- |
| 99 |
"yield from" added here as a keyword for autocompletion. The actual handling |
| 100 |
is in context="yield" so that we won't need to add space as a weakDeliminator. |
| 101 |
--> |
| 102 |
<item>yield from</item> |
| 103 |
</list> |
| 104 |
<list name="patternmatching"> |
| 105 |
<item>match</item> |
| 106 |
<item>case</item> |
| 107 |
</list> |
| 108 |
<list name="builtinfuncs"> |
| 109 |
<!-- https://docs.python.org/3.11/library/functions.html#built-in-funcs --> |
| 110 |
<item>__import__</item> |
| 111 |
<item>abs</item> |
| 112 |
<item>aiter</item> |
| 113 |
<item>all</item> |
| 114 |
<item>anext</item> |
| 115 |
<item>any</item> |
| 116 |
<item>apply</item> |
| 117 |
<item>ascii</item> |
| 118 |
<item>basestring</item> |
| 119 |
<item>bin</item> |
| 120 |
<item>breakpoint</item> |
| 121 |
<item>bool</item> |
| 122 |
<item>buffer</item> |
| 123 |
<item>bytearray</item> |
| 124 |
<item>bytes</item> |
| 125 |
<item>callable</item> |
| 126 |
<item>chr</item> |
| 127 |
<item>classmethod</item> |
| 128 |
<item>cmp</item> |
| 129 |
<item>coerce</item> |
| 130 |
<item>compile</item> |
| 131 |
<item>complex</item> |
| 132 |
<item>delattr</item> |
| 133 |
<item>dict</item> |
| 134 |
<item>dir</item> |
| 135 |
<item>divmod</item> |
| 136 |
<item>enumerate</item> |
| 137 |
<item>eval</item> |
| 138 |
<item>exec</item> |
| 139 |
<item>execfile</item> |
| 140 |
<item>file</item> |
| 141 |
<item>filter</item> |
| 142 |
<item>float</item> |
| 143 |
<item>format</item> |
| 144 |
<item>frozenset</item> |
| 145 |
<item>getattr</item> |
| 146 |
<item>globals</item> |
| 147 |
<item>hasattr</item> |
| 148 |
<item>hash</item> |
| 149 |
<item>help</item> |
| 150 |
<item>hex</item> |
| 151 |
<item>id</item> |
| 152 |
<item>input</item> |
| 153 |
<item>int</item> |
| 154 |
<item>intern</item> |
| 155 |
<item>isinstance</item> |
| 156 |
<item>issubclass</item> |
| 157 |
<item>iter</item> |
| 158 |
<item>len</item> |
| 159 |
<item>list</item> |
| 160 |
<item>locals</item> |
| 161 |
<item>long</item> |
| 162 |
<item>map</item> |
| 163 |
<item>max</item> |
| 164 |
<item>memoryview</item> |
| 165 |
<item>min</item> |
| 166 |
<item>next</item> |
| 167 |
<item>object</item> |
| 168 |
<item>oct</item> |
| 169 |
<item>open</item> |
| 170 |
<item>ord</item> |
| 171 |
<item>pow</item> |
| 172 |
<item>print</item> |
| 173 |
<item>property</item> |
| 174 |
<item>range</item> |
| 175 |
<item>raw_input</item> |
| 176 |
<item>reduce</item> |
| 177 |
<item>reload</item> |
| 178 |
<item>repr</item> |
| 179 |
<item>reversed</item> |
| 180 |
<item>round</item> |
| 181 |
<item>set</item> |
| 182 |
<item>setattr</item> |
| 183 |
<item>slice</item> |
| 184 |
<item>sorted</item> |
| 185 |
<item>staticmethod</item> |
| 186 |
<item>str</item> |
| 187 |
<item>sum</item> |
| 188 |
<item>super</item> |
| 189 |
<item>tuple</item> |
| 190 |
<item>type</item> |
| 191 |
<item>unichr</item> |
| 192 |
<item>unicode</item> |
| 193 |
<item>vars</item> |
| 194 |
<item>xrange</item> |
| 195 |
<item>zip</item> |
| 196 |
</list> |
| 197 |
<list name="specialvars"> |
| 198 |
<item>None</item> |
| 199 |
<item>self</item> |
| 200 |
<item>True</item> |
| 201 |
<item>False</item> |
| 202 |
<item>NotImplemented</item> |
| 203 |
<item>Ellipsis</item> |
| 204 |
<item>__debug__</item> |
| 205 |
<item>__file__</item> |
| 206 |
<item>__name__</item> |
| 207 |
<item>__qualname__</item> |
| 208 |
</list> |
| 209 |
<list name="bindings"> |
| 210 |
<item>SIGNAL</item> |
| 211 |
<item>SLOT</item> |
| 212 |
<item>connect</item> |
| 213 |
</list> |
| 214 |
<list name="overloaders"> |
| 215 |
<!-- https://docs.python.org/3.10/reference/datamodel.html#special-method-names --> |
| 216 |
<item>__new__</item> |
| 217 |
<item>__init__</item> |
| 218 |
<item>__del__</item> |
| 219 |
<item>__repr__</item> |
| 220 |
<item>__str__</item> |
| 221 |
<item>__lt__</item> |
| 222 |
<item>__le__</item> |
| 223 |
<item>__eq__</item> |
| 224 |
<item>__ne__</item> |
| 225 |
<item>__gt__</item> |
| 226 |
<item>__ge__</item> |
| 227 |
<item>__cmp__</item> |
| 228 |
<item>__rcmp__</item> |
| 229 |
<item>__hash__</item> |
| 230 |
<item>__bool__</item> |
| 231 |
<item>__nonzero__</item> |
| 232 |
<item>__unicode__</item> |
| 233 |
<item>__getattr__</item> |
| 234 |
<item>__setattr__</item> |
| 235 |
<item>__delattr__</item> |
| 236 |
<item>__getattribute__</item> |
| 237 |
<item>__get__</item> |
| 238 |
<item>__set__</item> |
| 239 |
<item>__delete__</item> |
| 240 |
<item>__call__</item> |
| 241 |
<item>__len__</item> |
| 242 |
<item>__length_hint__</item> |
| 243 |
<item>__getitem__</item> |
| 244 |
<item>__setitem__</item> |
| 245 |
<item>__delitem__</item> |
| 246 |
<item>__missing__</item> |
| 247 |
<item>__iter__</item> |
| 248 |
<item>__reversed__</item> |
| 249 |
<item>__contains__</item> |
| 250 |
<item>__getslice__</item> |
| 251 |
<item>__setslice__</item> |
| 252 |
<item>__delslice__</item> |
| 253 |
<item>__add__</item> |
| 254 |
<item>__sub__</item> |
| 255 |
<item>__mul__</item> |
| 256 |
<item>__matmul__</item> |
| 257 |
<item>__floordiv__</item> |
| 258 |
<item>__mod__</item> |
| 259 |
<item>__divmod__</item> |
| 260 |
<item>__pow__</item> |
| 261 |
<item>__lshift__</item> |
| 262 |
<item>__rshift__</item> |
| 263 |
<item>__and__</item> |
| 264 |
<item>__xor__</item> |
| 265 |
<item>__or__</item> |
| 266 |
<item>__div__</item> |
| 267 |
<item>__truediv__</item> |
| 268 |
<item>__radd__</item> |
| 269 |
<item>__rsub__</item> |
| 270 |
<item>__rmul__</item> |
| 271 |
<item>__rmatmul__</item> |
| 272 |
<item>__rdiv__</item> |
| 273 |
<item>__rtruediv__</item> |
| 274 |
<item>__rfloordiv__</item> |
| 275 |
<item>__rmod__</item> |
| 276 |
<item>__rdivmod__</item> |
| 277 |
<item>__rpow__</item> |
| 278 |
<item>__rlshift__</item> |
| 279 |
<item>__rrshift__</item> |
| 280 |
<item>__rand__</item> |
| 281 |
<item>__rxor__</item> |
| 282 |
<item>__ror__</item> |
| 283 |
<item>__iadd__</item> |
| 284 |
<item>__isub__</item> |
| 285 |
<item>__imul__</item> |
| 286 |
<item>__imatmul__</item> |
| 287 |
<item>__idiv__</item> |
| 288 |
<item>__itruediv__</item> |
| 289 |
<item>__ifloordiv__</item> |
| 290 |
<item>__imod__</item> |
| 291 |
<item>__ipow__</item> |
| 292 |
<item>__ilshift__</item> |
| 293 |
<item>__irshift__</item> |
| 294 |
<item>__iand__</item> |
| 295 |
<item>__ixor__</item> |
| 296 |
<item>__ior__</item> |
| 297 |
<item>__neg__</item> |
| 298 |
<item>__pos__</item> |
| 299 |
<item>__abs__</item> |
| 300 |
<item>__invert__</item> |
| 301 |
<item>__complex__</item> |
| 302 |
<item>__int__</item> |
| 303 |
<item>__long__</item> |
| 304 |
<item>__float__</item> |
| 305 |
<item>__oct__</item> |
| 306 |
<item>__hex__</item> |
| 307 |
<item>__index__</item> |
| 308 |
<item>__round__</item> |
| 309 |
<item>__trunc__</item> |
| 310 |
<item>__floor__</item> |
| 311 |
<item>__ceil__</item> |
| 312 |
<item>__coerce__</item> |
| 313 |
<item>__enter__</item> |
| 314 |
<item>__exit__</item> |
| 315 |
<item>__match_args__</item> |
| 316 |
<item>__bytes__</item> |
| 317 |
<item>__format__</item> |
| 318 |
<item>__next__</item> |
| 319 |
<item>__dir__</item> |
| 320 |
<item>__await__</item> |
| 321 |
<item>__aiter__</item> |
| 322 |
<item>__anext__</item> |
| 323 |
<item>__aenter__</item> |
| 324 |
<item>__aexit__</item> |
| 325 |
<item>__slots__</item> |
| 326 |
<item>__init_subclass__</item> |
| 327 |
<item>__set_name__</item> |
| 328 |
<item>__prepare__</item> |
| 329 |
<item>__instancecheck__</item> |
| 330 |
<item>__subclasscheck__</item> |
| 331 |
<item>__class_getitem__</item> |
| 332 |
</list> |
| 333 |
<list name="exceptions"> |
| 334 |
<!-- |
| 335 |
Exceptions list resources used: |
| 336 |
- http://docs.python.org/2.7/library/exceptions.html#exception-hierarchy |
| 337 |
- http://docs.python.org/3.10/library/exceptions.html#exception-hierarchy |
| 338 |
--> |
| 339 |
<item>ArithmeticError</item> |
| 340 |
<item>AssertionError</item> |
| 341 |
<item>AttributeError</item> |
| 342 |
<item>BaseException</item> |
| 343 |
<item>BlockingIOError</item> |
| 344 |
<item>BrokenPipeError</item> |
| 345 |
<item>BufferError</item> |
| 346 |
<item>BytesWarning</item> |
| 347 |
<item>ChildProcessError</item> |
| 348 |
<item>ConnectionAbortedError</item> |
| 349 |
<item>ConnectionError</item> |
| 350 |
<item>ConnectionRefusedError</item> |
| 351 |
<item>ConnectionResetError</item> |
| 352 |
<item>DeprecationWarning</item> |
| 353 |
<item>EnvironmentError</item> |
| 354 |
<item>EOFError</item> |
| 355 |
<item>EncodingWarning</item> |
| 356 |
<item>Exception</item> |
| 357 |
<item>FileExistsError</item> |
| 358 |
<item>FileNotFoundError</item> |
| 359 |
<item>FloatingPointError</item> |
| 360 |
<item>FutureWarning</item> |
| 361 |
<item>GeneratorExit</item> |
| 362 |
<item>ImportError</item> |
| 363 |
<item>ImportWarning</item> |
| 364 |
<item>IndentationError</item> |
| 365 |
<item>IndexError</item> |
| 366 |
<item>InterruptedError</item> |
| 367 |
<item>IOError</item> |
| 368 |
<item>IsADirectoryError</item> |
| 369 |
<item>KeyboardInterrupt</item> |
| 370 |
<item>KeyError</item> |
| 371 |
<item>LookupError</item> |
| 372 |
<item>MemoryError</item> |
| 373 |
<item>ModuleNotFoundError</item> |
| 374 |
<item>NameError</item> |
| 375 |
<item>NotADirectoryError</item> |
| 376 |
<item>NotImplementedError</item> |
| 377 |
<item>OSError</item> |
| 378 |
<item>OverflowError</item> |
| 379 |
<item>PendingDeprecationWarning</item> |
| 380 |
<item>PermissionError</item> |
| 381 |
<item>ProcessLookupError</item> |
| 382 |
<item>RecursionError</item> |
| 383 |
<item>ReferenceError</item> |
| 384 |
<item>ResourceWarning</item> |
| 385 |
<item>RuntimeError</item> |
| 386 |
<item>RuntimeWarning</item> |
| 387 |
<item>StandardError</item> |
| 388 |
<item>StopAsyncIteration</item> |
| 389 |
<item>StopIteration</item> |
| 390 |
<item>SyntaxError</item> |
| 391 |
<item>SyntaxWarning</item> |
| 392 |
<item>SystemError</item> |
| 393 |
<item>SystemExit</item> |
| 394 |
<item>TabError</item> |
| 395 |
<item>TimeoutError</item> |
| 396 |
<item>TypeError</item> |
| 397 |
<item>UnboundLocalError</item> |
| 398 |
<item>UnicodeDecodeError</item> |
| 399 |
<item>UnicodeEncodeError</item> |
| 400 |
<item>UnicodeError</item> |
| 401 |
<item>UnicodeTranslateError</item> |
| 402 |
<item>UnicodeWarning</item> |
| 403 |
<item>UserWarning</item> |
| 404 |
<item>ValueError</item> |
| 405 |
<item>Warning</item> |
| 406 |
<item>WindowsError</item> |
| 407 |
<item>ZeroDivisionError</item> |
| 408 |
</list> |
| 409 |
<contexts> |
| 410 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 411 |
<DetectSpaces attribute="Normal Text"/> |
| 412 |
|
| 413 |
<keyword attribute="Import" String="import" context="#stay"/> |
| 414 |
<keyword attribute="Definition Keyword" String="defs" context="#stay"/> |
| 415 |
<keyword attribute="Operator Keyword" String="operators" context="#stay"/> |
| 416 |
<keyword attribute="Flow Control Keyword" String="flow" context="#stay"/> |
| 417 |
<keyword attribute="Flow Control Keyword" String="flow_yield" context="yield"/> |
| 418 |
<keyword attribute="Flow Control Keyword" String="patternmatching" context="Pattern Matching" lookAhead="1" firstNonSpace="1"/> |
| 419 |
<keyword attribute="Builtin Function" String="builtinfuncs" context="#stay"/> |
| 420 |
<keyword attribute="Special Variable" String="specialvars" context="#stay"/> |
| 421 |
<keyword attribute="Extensions" String="bindings" context="#stay"/> |
| 422 |
<keyword attribute="Exceptions" String="exceptions" context="#stay"/> |
| 423 |
<keyword attribute="Overloaders" String="overloaders" context="#stay"/> |
| 424 |
|
| 425 |
<DetectChar attribute="Normal Text" char="{" context="Dictionary" beginRegion="Dictionary"/> |
| 426 |
<DetectChar attribute="Normal Text" char="[" context="List" beginRegion="List"/> |
| 427 |
<DetectChar attribute="Normal Text" char="(" context="Tuple" beginRegion="Tuple"/> |
| 428 |
|
| 429 |
<DetectChar attribute="Comment" char="#" context="Hash comment"/> |
| 430 |
|
| 431 |
<IncludeRules context="Number" /> |
| 432 |
<IncludeRules context="CommentVariants" /> |
| 433 |
<IncludeRules context="StringVariants" /> |
| 434 |
|
| 435 |
<DetectIdentifier attribute="Normal Text"/> |
| 436 |
|
| 437 |
<RegExpr attribute="Decorator" String="@[_a-zA-Z[:^ascii:]][\._a-zA-Z0-9[:^ascii:]]*" firstNonSpace="true"/> |
| 438 |
<Detect2Chars attribute="Operator" char=":" char1="=" context="#stay"/> |
| 439 |
<AnyChar attribute="Operator" String="+*/%|=;<>!^&~-@" context="#stay"/> |
| 440 |
|
| 441 |
<LineContinue attribute="Operator" context="MultiLineExpr"/> |
| 442 |
|
| 443 |
<Int attribute="Error"/> |
| 444 |
</context> |
| 445 |
<context name="MultiLineExpr" attribute="Normal Text" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> |
| 446 |
<DetectSpaces attribute="Normal Text"/> |
| 447 |
<IncludeRules context="StringVariants" /> |
| 448 |
</context> |
| 449 |
|
| 450 |
<!-- https://docs.python.org/2/reference/lexical_analysis.html#integer-and-long-integer-literals --> |
| 451 |
<!-- https://docs.python.org/3/reference/lexical_analysis.html#integer-literals --> |
| 452 |
<context name="Number" attribute="Normal Text" lineEndContext="#pop"> |
| 453 |
<!-- fast path --> |
| 454 |
<RegExpr String="&beforeDigit;[0-9]|&beforePointFloat;\.[0-9]" context="AssumeNumber" lookAhead="1"/> |
| 455 |
</context> |
| 456 |
<context name="AssumeNumber" attribute="Normal Text" lineEndContext="#pop"> |
| 457 |
<!-- Complex: 1j ; 1.1j ; 1.j ; .1j ; 1e3j ; 1.1e3j ; 1.e3j ; .1e3j --> |
| 458 |
<RegExpr attribute="Complex" String="(?:&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)(?:[eE][\+\-]?&digitPart;)?[jJ]" context="CheckSuffixError"/> |
| 459 |
<!-- Hexadecimal: 0xA1, Binary: 0b01, Octal: 0o71 --> |
| 460 |
<RegExpr attribute="Hex" String="0[xX](?:_?[0-9a-fA-F])+" context="CheckSuffixError"/> |
| 461 |
<RegExpr attribute="Binary" String="0[bB](?:_?[01])+" context="CheckSuffixError"/> |
| 462 |
<RegExpr attribute="Octal" String="0[oO](?:_?[0-7])+" context="CheckSuffixError"/> |
| 463 |
<!-- Float: 1.1 ; 1. ; .1 ; 1e3 ; 1.1e3 ; 1.e3 ; .1e3 --> |
| 464 |
<RegExpr attribute="Float" String="(?:&digitPart;(?:\.(?:&digitPart;)?)?|\.&digitPart;)[eE][\+\-]?&digitPart;|&digitPart;\.(?:&digitPart;)?|\.&digitPart;" context="CheckSuffixError"/> |
| 465 |
<!-- Decimal: 123 ; 000 --> |
| 466 |
<!-- l and L are python2 suffixes --> |
| 467 |
<RegExpr attribute="Int" String="(?:[1-9](?:_?\d)*|0(?:_?0)*)[lL]?" context="CheckSuffixError"/> |
| 468 |
</context> |
| 469 |
<context name="CheckSuffixError" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="1" fallthroughContext="#pop#pop"> |
| 470 |
<RegExpr attribute="Error" String="[\w\d]+" context="#pop#pop"/> |
| 471 |
</context> |
| 472 |
|
| 473 |
<context name="yield" attribute="Flow Control Keyword" lineEndContext="#pop" fallthrough="1" fallthroughContext="#pop"> |
| 474 |
<DetectSpaces attribute="Normal Text" context="#stay"/> |
| 475 |
<WordDetect attribute="Flow Control Keyword" context="#pop" String="from"/> |
| 476 |
</context> |
| 477 |
|
| 478 |
<context name="Pattern Matching" attribute="Flow Control Keyword" lineEndContext="#pop"> |
| 479 |
<!-- |
| 480 |
Python 3.10: https://docs.python.org/3.10/reference/compound_stmts.html#the-match-statement |
| 481 |
( 'match' | 'case' ) expression ':' |
| 482 |
exclude: |
| 483 |
( 'match' | 'case' ) ( 'if' | 'for' | '.' | ':' | '=' | ',' | ']' | ')' ) ... |
| 484 |
--> |
| 485 |
<RegExpr attribute="Flow Control Keyword" String="\w++(?=\s+(?!(?:if|for)\b)[\w'"~]|\s*+(?![.:=\]),]|(?:if|for)\b)((?:&string;|[^#;(){}]|\(\)|\((?1)\)|\{\}|\{(\s*+(?:(?:&string;|[a-zA-Z0-9.]++)\s*+:\s*+(?:&string;|[^#;(){},]|\(\)|\((?1)\)|\{\}|\{(?2)\})++,?)*+)\})+?):)|" context="#pop"/> |
| 486 |
<DetectIdentifier attribute="Normal Text" context="#pop"/> |
| 487 |
</context> |
| 488 |
|
| 489 |
<context name="#CheckForString" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 490 |
<DetectSpaces/> |
| 491 |
<LineContinue attribute="Normal Text" context="#pop!CheckForStringNext"/> |
| 492 |
</context> |
| 493 |
|
| 494 |
<context name="CheckForStringNext" attribute="Normal Text" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop"> |
| 495 |
<DetectSpaces/> |
| 496 |
<LineContinue attribute="Normal Text" context="#stay"/> |
| 497 |
<IncludeRules context="StringVariants"/> |
| 498 |
</context> |
| 499 |
|
| 500 |
<!-- https://docs.python.org/2/reference/lexical_analysis.html#string-literals --> |
| 501 |
<!-- https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals --> |
| 502 |
<context name="StringVariants" attribute="Normal Text" lineEndContext="#stay"> |
| 503 |
<!-- fast path --> |
| 504 |
<RegExpr String="(?:u|r|b|f|ur|fr|rf|br|rb)?['"]" insensitive="true" context="AssumeStringVariants" lookAhead="1"/> |
| 505 |
</context> |
| 506 |
<context name="AssumeStringVariants" attribute="Normal Text" lineEndContext="#stay"> |
| 507 |
<RegExpr attribute="String" String="u?'''" insensitive="true" context="#pop!Triple A-string" beginRegion="Triple A-region"/> |
| 508 |
<RegExpr attribute="String" String="u?"""" insensitive="true" context="#pop!Triple Q-string" beginRegion="Triple Q-region"/> |
| 509 |
<RegExpr attribute="String" String="u?'" insensitive="true" context="#pop!Single A-string"/> |
| 510 |
<RegExpr attribute="String" String="u?"" insensitive="true" context="#pop!Single Q-string"/> |
| 511 |
|
| 512 |
<RegExpr attribute="Raw String" String="u?r'''" insensitive="true" context="#pop!Raw Triple A-string" beginRegion="Triple A-region"/> |
| 513 |
<RegExpr attribute="Raw String" String="u?r"""" insensitive="true" context="#pop!Raw Triple Q-string" beginRegion="Triple Q-region"/> |
| 514 |
<RegExpr attribute="Raw String" String="u?r'" insensitive="true" context="#pop!Raw A-string"/> |
| 515 |
<RegExpr attribute="Raw String" String="u?r"" insensitive="true" context="#pop!Raw Q-string"/> |
| 516 |
|
| 517 |
<StringDetect attribute="F-String" String="f'''" insensitive="true" context="#pop!Triple A-F-String" beginRegion="Triple A-region"/> |
| 518 |
<StringDetect attribute="F-String" String="f"""" insensitive="true" context="#pop!Triple Q-F-String" beginRegion="Triple Q-region"/> |
| 519 |
<StringDetect attribute="F-String" String="f'" insensitive="true" context="#pop!Single A-F-String"/> |
| 520 |
<StringDetect attribute="F-String" String="f"" insensitive="true" context="#pop!Single Q-F-String"/> |
| 521 |
|
| 522 |
<RegExpr attribute="Raw F-String" String="(?:fr|rf)'''" insensitive="true" context="#pop!Raw Triple A-F-String" beginRegion="Triple A-region"/> |
| 523 |
<RegExpr attribute="Raw F-String" String="(?:fr|rf)"""" insensitive="true" context="#pop!Raw Triple Q-F-String" beginRegion="Triple Q-region"/> |
| 524 |
<RegExpr attribute="Raw F-String" String="(?:fr|rf)'" insensitive="true" context="#pop!Raw A-F-String"/> |
| 525 |
<RegExpr attribute="Raw F-String" String="(?:fr|rf)"" insensitive="true" context="#pop!Raw Q-F-String"/> |
| 526 |
|
| 527 |
<StringDetect attribute="B-String" String="b'''" insensitive="true" context="#pop!Triple A-B-String" beginRegion="Triple A-region"/> |
| 528 |
<StringDetect attribute="B-String" String="b"""" insensitive="true" context="#pop!Triple Q-B-String" beginRegion="Triple Q-region"/> |
| 529 |
<StringDetect attribute="B-String" String="b'" insensitive="true" context="#pop!Single A-B-String"/> |
| 530 |
<StringDetect attribute="B-String" String="b"" insensitive="true" context="#pop!Single Q-B-String"/> |
| 531 |
|
| 532 |
<RegExpr attribute="Raw B-String" String="(?:br|rb)'''" insensitive="true" context="#pop!Raw Triple A-B-String" beginRegion="Triple A-region"/> |
| 533 |
<RegExpr attribute="Raw B-String" String="(?:br|rb)"""" insensitive="true" context="#pop!Raw Triple Q-B-String" beginRegion="Triple Q-region"/> |
| 534 |
<RegExpr attribute="Raw B-String" String="(?:br|rb)'" insensitive="true" context="#pop!Raw A-B-String"/> |
| 535 |
<RegExpr attribute="Raw B-String" String="(?:br|rb)"" insensitive="true" context="#pop!Raw Q-B-String"/> |
| 536 |
</context> |
| 537 |
|
| 538 |
<!-- https://docs.python.org/2/reference/lexical_analysis.html#string-literals --> |
| 539 |
<!-- https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals --> |
| 540 |
<context name="CommentVariants" attribute="Normal Text" lineEndContext="#stay"> |
| 541 |
<!-- fast path --> |
| 542 |
<RegExpr String="(?:u|r|ur)?['"]" insensitive="true" firstNonSpace="true" context="AssumeCommentVariants" lookAhead="1"/> |
| 543 |
</context> |
| 544 |
<context name="AssumeCommentVariants" attribute="Normal Text" lineEndContext="#stay"> |
| 545 |
<RegExpr attribute="Comment" String="(?:u?r?)'''" insensitive="true" context="#pop!Triple A-comment" beginRegion="Triple A-region"/> |
| 546 |
<RegExpr attribute="Comment" String="(?:u?r?)"""" insensitive="true" context="#pop!Triple Q-comment" beginRegion="Triple Q-region"/> |
| 547 |
<RegExpr attribute="Comment" String="(?:u?r?)'" insensitive="true" context="#pop!Single A-comment"/> |
| 548 |
<RegExpr attribute="Comment" String="(?:u?r?)"" insensitive="true" context="#pop!Single Q-comment"/> |
| 549 |
</context> |
| 550 |
|
| 551 |
<context name="Dictionary" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 552 |
<DetectSpaces/> |
| 553 |
<DetectChar attribute="Normal Text" char="}" context="#pop" endRegion="Dictionary"/> |
| 554 |
<IncludeRules context="StringVariants" /> |
| 555 |
<IncludeRules context="Normal" /> |
| 556 |
</context> |
| 557 |
|
| 558 |
<context name="List" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 559 |
<DetectSpaces/> |
| 560 |
<DetectChar attribute="Normal Text" char="]" context="#pop" endRegion="List"/> |
| 561 |
<IncludeRules context="StringVariants" /> |
| 562 |
<IncludeRules context="Normal" /> |
| 563 |
</context> |
| 564 |
|
| 565 |
<context name="Tuple" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 566 |
<DetectSpaces/> |
| 567 |
<DetectChar attribute="Normal Text" char=")" context="#pop" endRegion="Tuple"/> |
| 568 |
<IncludeRules context="StringVariants" /> |
| 569 |
<IncludeRules context="Normal" /> |
| 570 |
</context> |
| 571 |
|
| 572 |
<context name="UnfinishedStringError" attribute="Error" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 573 |
<!-- A single string/comment reached the end of the line without a \ line escape --> |
| 574 |
<!-- We set the following line (or part of it) to the "Error" attribute so that this error is easier to spot --> |
| 575 |
<RegExpr attribute="Error" String="^(\s{4,}|[^[\]()"']{4,}(["'].*)?)" context="#pop" column="0"/> |
| 576 |
</context> |
| 577 |
|
| 578 |
<!-- Comments --> |
| 579 |
|
| 580 |
<context name="Hash comment" attribute="Comment" lineEndContext="#pop"> |
| 581 |
<DetectSpaces /> |
| 582 |
<IncludeRules context="##Comments" /> |
| 583 |
<DetectIdentifier/> |
| 584 |
</context> |
| 585 |
|
| 586 |
<context name="Triple A-comment" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 587 |
<DetectSpaces/> |
| 588 |
<StringDetect attribute="Comment" String="'''" context="#pop" endRegion="Triple A-region"/> |
| 589 |
<IncludeRules context="##Comments" /> |
| 590 |
<DetectIdentifier/> |
| 591 |
<IncludeRules context="stringescape"/> |
| 592 |
<LineContinue attribute="String Char" context="#stay"/> |
| 593 |
</context> |
| 594 |
|
| 595 |
<context name="Triple Q-comment" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 596 |
<DetectSpaces/> |
| 597 |
<StringDetect attribute="Comment" String=""""" context="#pop" endRegion="Triple Q-region"/> |
| 598 |
<IncludeRules context="##Comments" /> |
| 599 |
<DetectIdentifier/> |
| 600 |
<IncludeRules context="stringescape"/> |
| 601 |
<LineContinue attribute="String Char" context="#stay"/> |
| 602 |
</context> |
| 603 |
|
| 604 |
<context name="Single A-comment" attribute="Comment" lineEndContext="#pop!UnfinishedStringError"> |
| 605 |
<DetectSpaces/> |
| 606 |
<DetectChar attribute="Comment" char="'" context="#pop"/> |
| 607 |
<IncludeRules context="##Comments" /> |
| 608 |
<DetectIdentifier/> |
| 609 |
<IncludeRules context="stringescape"/> |
| 610 |
<LineContinue attribute="String Char" context="#stay"/> |
| 611 |
</context> |
| 612 |
|
| 613 |
<context name="Single Q-comment" attribute="Comment" lineEndContext="#pop!UnfinishedStringError"> |
| 614 |
<DetectSpaces/> |
| 615 |
<DetectChar attribute="Comment" char=""" context="#pop"/> |
| 616 |
<IncludeRules context="##Comments" /> |
| 617 |
<DetectIdentifier/> |
| 618 |
<IncludeRules context="stringescape"/> |
| 619 |
<LineContinue attribute="String Char" context="#stay"/> |
| 620 |
</context> |
| 621 |
|
| 622 |
<!-- Strings --> |
| 623 |
|
| 624 |
<!-- format characters --> |
| 625 |
<context name="stringformat" attribute="String Substitution" lineEndContext="#stay"> |
| 626 |
<RegExpr attribute="String Substitution" String="&strsubstitution_py2;|&strsubstitution_py3;" context="#stay"/> |
| 627 |
<Detect2Chars attribute="String Substitution" char="{" char1="{" context="#stay" /> |
| 628 |
<Detect2Chars attribute="String Substitution" char="}" char1="}" context="#stay" /> |
| 629 |
</context> |
| 630 |
|
| 631 |
<!-- escape characters --> |
| 632 |
<context name="stringescape" attribute="String Char" lineEndContext="#stay"> |
| 633 |
<!-- As this highlighting style is for both, Python 2 and 3, |
| 634 |
we do not know if a normal string is “unicode” or not. So we |
| 635 |
--> |
| 636 |
<RegExpr attribute="String Char" String="\\[\\'"abfnrtv]|\\[0-7]{1,3}|\\x[0-9A-Fa-f]{2}|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8}|\\N\{[a-zA-Z0-9\- ]+\}" context="#stay"/> |
| 637 |
</context> |
| 638 |
|
| 639 |
<!-- escape characters --> |
| 640 |
<context name="bytesescape" attribute="String Char" lineEndContext="#stay"> |
| 641 |
<!-- As this highlighting style is for both, Python 2 and 3, |
| 642 |
we do not know if a normal string is “unicode” or not. So we |
| 643 |
--> |
| 644 |
<RegExpr attribute="String Char" String="\\[\\'"abfnrtv]|\\[0-7]{1,3}|\\x[0-9A-Fa-f]{2}" context="#stay"/> |
| 645 |
</context> |
| 646 |
|
| 647 |
<!-- f-literals --> |
| 648 |
<context name="stringinterpolation" attribute="F-String" lineEndContext="#stay"> |
| 649 |
<Detect2Chars attribute="String Char" char="{" char1="{" context="#stay"/> |
| 650 |
<DetectChar attribute="String Substitution" char="{" context="String Interpolation"/> |
| 651 |
<Detect2Chars attribute="String Char" char="}" char1="}" context="#stay"/> |
| 652 |
<DetectChar attribute="Error" char="}" context="#stay"/> |
| 653 |
</context> |
| 654 |
<context name="String Interpolation" attribute="String Substitution" lineEndContext="#stay"> |
| 655 |
<DetectChar attribute="Error" char="\" context="#pop"/> |
| 656 |
<!-- format specifiers: [[fill]align][sign][#][0][minimumwidth][.precision][type] --> |
| 657 |
<RegExpr attribute="String Substitution" String="(?:![rsa])?(?::(?:[^}]?[<>=^])?[ +-]?#?0?[0-9]*(?:\.[0-9]+)?[bcdeEfFgGnosxX%]?)?\}" context="#pop"/> |
| 658 |
<IncludeRules context="Normal"/> <!-- TODO: create expression context instead --> |
| 659 |
</context> |
| 660 |
|
| 661 |
|
| 662 |
<!-- |
| 663 |
It follows a Binary tree of string kinds (not even touching byte literals). |
| 664 |
The levels are: |
| 665 |
1. triple- vs. single-quoted |
| 666 |
2. apostrophe vs. quotation mark |
| 667 |
3. static vs. interpolated (f-literal) |
| 668 |
4. escaped vs. raw |
| 669 |
Adding byte literals wouldn’t make the current 2⁴ into 2⁵ contexts, as there are no byte f-literals |
| 670 |
--> |
| 671 |
|
| 672 |
<!-- Triple-quoted A-strings --> |
| 673 |
<context name="Triple A-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 674 |
<DetectSpaces attribute="String"/> |
| 675 |
<DetectIdentifier attribute="String"/> |
| 676 |
<IncludeRules context="stringescape"/> |
| 677 |
<IncludeRules context="stringformat"/> |
| 678 |
<StringDetect attribute="String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 679 |
<LineContinue attribute="String Char" context="#stay"/> |
| 680 |
</context> |
| 681 |
|
| 682 |
<context name="Raw Triple A-string" attribute="Raw String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 683 |
<DetectSpaces attribute="Raw String"/> |
| 684 |
<DetectIdentifier attribute="Raw String"/> |
| 685 |
<Detect2Chars attribute="Raw String" char="\" char1="'"/> |
| 686 |
<Detect2Chars attribute="Raw String" char="\" char1="\"/> |
| 687 |
<IncludeRules context="stringformat"/> |
| 688 |
<StringDetect attribute="Raw String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 689 |
</context> |
| 690 |
|
| 691 |
<context name="Triple A-F-String" attribute="F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 692 |
<DetectSpaces attribute="F-String"/> |
| 693 |
<DetectIdentifier attribute="F-String"/> |
| 694 |
<IncludeRules context="stringescape"/> |
| 695 |
<IncludeRules context="stringinterpolation"/> |
| 696 |
<StringDetect attribute="F-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 697 |
<LineContinue attribute="String Char" context="#stay"/> |
| 698 |
</context> |
| 699 |
|
| 700 |
<context name="Raw Triple A-F-String" attribute="Raw F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 701 |
<DetectSpaces attribute="Raw F-String"/> |
| 702 |
<DetectIdentifier attribute="Raw F-String"/> |
| 703 |
<Detect2Chars attribute="Raw F-String" char="\" char1="'"/> |
| 704 |
<Detect2Chars attribute="Raw F-String" char="\" char1="\"/> |
| 705 |
<IncludeRules context="stringinterpolation"/> |
| 706 |
<StringDetect attribute="Raw F-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 707 |
</context> |
| 708 |
|
| 709 |
<context name="Triple A-B-String" attribute="B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 710 |
<RegExpr attribute="B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2})|'(?!''))++"/> |
| 711 |
<IncludeRules context="bytesescape"/> |
| 712 |
<StringDetect attribute="B-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 713 |
<LineContinue attribute="String Char" context="#stay"/> |
| 714 |
<RegExpr attribute="Error" String="."/> |
| 715 |
</context> |
| 716 |
|
| 717 |
<context name="Raw Triple A-B-String" attribute="Raw B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 718 |
<RegExpr attribute="Raw B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\.?|'(?!''))++"/> |
| 719 |
<StringDetect attribute="Raw B-String" String="'''" context="#pop!#CheckForString" endRegion="Triple A-region"/> |
| 720 |
<RegExpr attribute="Error" String="."/> |
| 721 |
</context> |
| 722 |
|
| 723 |
<!-- Triple-quoted Q-strings --> |
| 724 |
<context name="Triple Q-string" attribute="String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 725 |
<DetectSpaces attribute="String"/> |
| 726 |
<DetectIdentifier attribute="String"/> |
| 727 |
<IncludeRules context="stringescape"/> |
| 728 |
<IncludeRules context="stringformat"/> |
| 729 |
<StringDetect attribute="String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 730 |
<LineContinue attribute="String Char" context="#stay"/> |
| 731 |
</context> |
| 732 |
|
| 733 |
<context name="Raw Triple Q-string" attribute="Raw String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 734 |
<DetectSpaces attribute="Raw String"/> |
| 735 |
<DetectIdentifier attribute="Raw String"/> |
| 736 |
<Detect2Chars attribute="Raw String" char="\" char1="""/> |
| 737 |
<Detect2Chars attribute="Raw String" char="\" char1="\"/> |
| 738 |
<IncludeRules context="stringformat"/> |
| 739 |
<StringDetect attribute="Raw String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 740 |
</context> |
| 741 |
|
| 742 |
<context name="Triple Q-F-String" attribute="F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 743 |
<DetectSpaces attribute="F-String"/> |
| 744 |
<DetectIdentifier attribute="F-String"/> |
| 745 |
<IncludeRules context="stringescape"/> |
| 746 |
<IncludeRules context="stringinterpolation"/> |
| 747 |
<StringDetect attribute="F-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 748 |
<LineContinue attribute="String Char" context="#stay"/> |
| 749 |
</context> |
| 750 |
|
| 751 |
<context name="Raw Triple Q-F-String" attribute="Raw F-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 752 |
<DetectSpaces attribute="Raw F-String"/> |
| 753 |
<DetectIdentifier attribute="Raw F-String"/> |
| 754 |
<Detect2Chars attribute="Raw F-String" char="\" char1="""/> |
| 755 |
<Detect2Chars attribute="Raw F-String" char="\" char1="\"/> |
| 756 |
<IncludeRules context="stringinterpolation"/> |
| 757 |
<StringDetect attribute="Raw F-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 758 |
</context> |
| 759 |
|
| 760 |
<context name="Triple Q-B-String" attribute="B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 761 |
<RegExpr attribute="B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2})|"(?!""))++"/> |
| 762 |
<IncludeRules context="bytesescape"/> |
| 763 |
<StringDetect attribute="B-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 764 |
<LineContinue attribute="String Char" context="#stay"/> |
| 765 |
<RegExpr attribute="Error" String="."/> |
| 766 |
</context> |
| 767 |
|
| 768 |
<context name="Raw Triple Q-B-String" attribute="Raw B-String" lineEndContext="#stay" noIndentationBasedFolding="true"> |
| 769 |
<RegExpr attribute="Raw B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\.?|"(?!""))++"/> |
| 770 |
<StringDetect attribute="Raw B-String" String=""""" context="#pop!#CheckForString" endRegion="Triple Q-region"/> |
| 771 |
<RegExpr attribute="Error" String="."/> |
| 772 |
</context> |
| 773 |
|
| 774 |
|
| 775 |
<!-- Single-quoted A-strings --> |
| 776 |
<context name="Single A-string" attribute="String" lineEndContext="#pop!UnfinishedStringError"> |
| 777 |
<DetectSpaces attribute="String"/> |
| 778 |
<DetectIdentifier attribute="String"/> |
| 779 |
<IncludeRules context="stringescape"/> |
| 780 |
<IncludeRules context="stringformat"/> |
| 781 |
<DetectChar attribute="String" char="'" context="#pop!#CheckForString"/> |
| 782 |
<LineContinue attribute="String Char" context="#stay"/> |
| 783 |
</context> |
| 784 |
|
| 785 |
<context name="Raw A-string" attribute="Raw String" lineEndContext="#pop!UnfinishedStringError"> |
| 786 |
<DetectSpaces attribute="Raw String"/> |
| 787 |
<DetectIdentifier attribute="Raw String"/> |
| 788 |
<Detect2Chars attribute="Raw String" char="\" char1="'"/> |
| 789 |
<Detect2Chars attribute="Raw String" char="\" char1="\"/> |
| 790 |
<IncludeRules context="stringformat"/> |
| 791 |
<DetectChar attribute="Raw String" char="'" context="#pop!#CheckForString"/> |
| 792 |
<LineContinue attribute="Raw String" context="#stay"/> |
| 793 |
</context> |
| 794 |
|
| 795 |
<context name="Single A-F-String" attribute="F-String" lineEndContext="#pop!UnfinishedStringError"> |
| 796 |
<DetectSpaces attribute="F-String"/> |
| 797 |
<DetectIdentifier attribute="F-String"/> |
| 798 |
<IncludeRules context="stringescape"/> |
| 799 |
<IncludeRules context="stringinterpolation"/> |
| 800 |
<DetectChar attribute="F-String" char="'" context="#pop!#CheckForString"/> |
| 801 |
<LineContinue attribute="String Char" context="#stay"/> |
| 802 |
</context> |
| 803 |
|
| 804 |
<context name="Raw A-F-String" attribute="Raw F-String" lineEndContext="#pop!UnfinishedStringError"> |
| 805 |
<DetectSpaces attribute="Raw F-String"/> |
| 806 |
<DetectIdentifier attribute="Raw F-String"/> |
| 807 |
<Detect2Chars attribute="Raw F-String" char="\" char1="'"/> |
| 808 |
<Detect2Chars attribute="Raw F-String" char="\" char1="\"/> |
| 809 |
<IncludeRules context="stringinterpolation"/> |
| 810 |
<DetectChar attribute="Raw F-String" char="'" context="#pop!#CheckForString"/> |
| 811 |
<LineContinue attribute="Raw F-String" context="#stay"/> |
| 812 |
</context> |
| 813 |
|
| 814 |
<context name="Single A-B-String" attribute="B-String" lineEndContext="#pop!UnfinishedStringError"> |
| 815 |
<RegExpr attribute="B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2}))++"/> |
| 816 |
<IncludeRules context="bytesescape"/> |
| 817 |
<DetectChar attribute="B-String" char="'" context="#pop!#CheckForString"/> |
| 818 |
<LineContinue attribute="String Char" context="#stay"/> |
| 819 |
<RegExpr attribute="Error" String="."/> |
| 820 |
</context> |
| 821 |
|
| 822 |
<context name="Raw A-B-String" attribute="Raw B-String" lineEndContext="#pop!UnfinishedStringError"> |
| 823 |
<RegExpr attribute="Raw B-String" String="([\x20-\x26\x28-\x5B\x5D-\x7E]++|\\.)++"/> |
| 824 |
<DetectChar attribute="Raw B-String" char="'" context="#pop!#CheckForString"/> |
| 825 |
<LineContinue attribute="Raw B-String" context="#stay"/> |
| 826 |
<RegExpr attribute="Error" String="."/> |
| 827 |
</context> |
| 828 |
|
| 829 |
<!-- Single-quoted Q-strings --> |
| 830 |
<context name="Single Q-string" attribute="String" lineEndContext="#pop!UnfinishedStringError"> |
| 831 |
<DetectSpaces attribute="String"/> |
| 832 |
<DetectIdentifier attribute="String"/> |
| 833 |
<IncludeRules context="stringescape"/> |
| 834 |
<IncludeRules context="stringformat"/> |
| 835 |
<DetectChar attribute="String" char=""" context="#pop!#CheckForString"/> |
| 836 |
<LineContinue attribute="String Char" context="#stay"/> |
| 837 |
</context> |
| 838 |
|
| 839 |
<context name="Raw Q-string" attribute="Raw String" lineEndContext="#pop!UnfinishedStringError"> |
| 840 |
<DetectSpaces attribute="Raw String"/> |
| 841 |
<DetectIdentifier attribute="Raw String"/> |
| 842 |
<Detect2Chars attribute="Raw String" char="\" char1="""/> |
| 843 |
<Detect2Chars attribute="Raw String" char="\" char1="\"/> |
| 844 |
<IncludeRules context="stringformat"/> |
| 845 |
<DetectChar attribute="Raw String" char=""" context="#pop!#CheckForString"/> |
| 846 |
<LineContinue attribute="Raw String" context="#stay"/> |
| 847 |
</context> |
| 848 |
|
| 849 |
<context name="Single Q-F-String" attribute="F-String" lineEndContext="#pop!UnfinishedStringError"> |
| 850 |
<DetectSpaces attribute="F-String"/> |
| 851 |
<DetectIdentifier attribute="F-String"/> |
| 852 |
<IncludeRules context="stringescape"/> |
| 853 |
<IncludeRules context="stringinterpolation"/> |
| 854 |
<DetectChar attribute="F-String" char=""" context="#pop!#CheckForString"/> |
| 855 |
<LineContinue attribute="String Char" context="#stay"/> |
| 856 |
</context> |
| 857 |
|
| 858 |
<context name="Raw Q-F-String" attribute="Raw F-String" lineEndContext="#pop!UnfinishedStringError"> |
| 859 |
<DetectSpaces attribute="Raw F-String"/> |
| 860 |
<DetectIdentifier attribute="Raw F-String"/> |
| 861 |
<Detect2Chars attribute="Raw F-String" char="\" char1="""/> |
| 862 |
<Detect2Chars attribute="Raw F-String" char="\" char1="\"/> |
| 863 |
<IncludeRules context="stringinterpolation"/> |
| 864 |
<DetectChar attribute="Raw F-String" char=""" context="#pop!#CheckForString"/> |
| 865 |
<LineContinue attribute="Raw F-String" context="#stay"/> |
| 866 |
</context> |
| 867 |
|
| 868 |
<context name="Single Q-B-String" attribute="B-String" lineEndContext="#pop!UnfinishedStringError"> |
| 869 |
<RegExpr attribute="B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\(?=[^\\'"abfnrtvx0-7])|\\x(?![0-9a-fA-F]{2}))++"/> |
| 870 |
<IncludeRules context="bytesescape"/> |
| 871 |
<DetectChar attribute="B-String" char=""" context="#pop!#CheckForString"/> |
| 872 |
<LineContinue attribute="String Char" context="#stay"/> |
| 873 |
<RegExpr attribute="Error" String="."/> |
| 874 |
</context> |
| 875 |
|
| 876 |
<context name="Raw Q-B-String" attribute="Raw B-String" lineEndContext="#pop!UnfinishedStringError"> |
| 877 |
<RegExpr attribute="Raw B-String" String="([\x20\x21\x23-\x5B\x5D-\x7E]++|\\.)++"/> |
| 878 |
<DetectChar attribute="Raw B-String" char=""" context="#pop!#CheckForString"/> |
| 879 |
<Detect2Chars attribute="Raw B-String" char="\" char1="\"/> |
| 880 |
<LineContinue attribute="Raw B-String" context="#stay"/> |
| 881 |
<RegExpr attribute="Error" String="."/> |
| 882 |
</context> |
| 883 |
|
| 884 |
</contexts> |
| 885 |
|
| 886 |
<itemDatas> |
| 887 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> |
| 888 |
<itemData name="Definition Keyword" defStyleNum="dsKeyword" spellChecking="false"/> |
| 889 |
<itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/> |
| 890 |
<itemData name="Operator Keyword" defStyleNum="dsKeyword" spellChecking="false"/> |
| 891 |
<itemData name="Flow Control Keyword" defStyleNum="dsControlFlow" spellChecking="false"/> |
| 892 |
<itemData name="Builtin Function" defStyleNum="dsBuiltIn" spellChecking="false"/> |
| 893 |
<itemData name="Special Variable" defStyleNum="dsVariable" spellChecking="false"/> |
| 894 |
<itemData name="Extensions" defStyleNum="dsExtension" spellChecking="false"/> |
| 895 |
<itemData name="Exceptions" defStyleNum="dsPreprocessor" spellChecking="false"/> |
| 896 |
<itemData name="Overloaders" defStyleNum="dsFunction" spellChecking="false"/> |
| 897 |
<itemData name="Import" defStyleNum="dsImport" spellChecking="false"/> |
| 898 |
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> |
| 899 |
<itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/> |
| 900 |
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> |
| 901 |
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> |
| 902 |
<itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/> |
| 903 |
<itemData name="Complex" defStyleNum="dsOthers" spellChecking="false"/> |
| 904 |
<itemData name="Comment" defStyleNum="dsComment"/> |
| 905 |
<itemData name="String" defStyleNum="dsString"/> |
| 906 |
<itemData name="Raw String" defStyleNum="dsVerbatimString"/> |
| 907 |
<itemData name="F-String" defStyleNum="dsSpecialString"/> |
| 908 |
<itemData name="Raw F-String" defStyleNum="dsVerbatimString"/> |
| 909 |
<itemData name="B-String" defStyleNum="dsString" spellChecking="false"/> |
| 910 |
<itemData name="Raw B-String" defStyleNum="dsVerbatimString" spellChecking="false"/> |
| 911 |
<itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> |
| 912 |
<itemData name="String Substitution" defStyleNum="dsSpecialChar" spellChecking="false"/> |
| 913 |
<itemData name="Decorator" defStyleNum="dsAttribute" spellChecking="false"/> |
| 914 |
<itemData name="Error" defStyleNum="dsError"/> |
| 915 |
</itemDatas> |
| 916 |
</highlighting> |
| 917 |
<general> |
| 918 |
<folding indentationsensitive="1" /> |
| 919 |
<emptyLines> |
| 920 |
<emptyLine regexpr="(?:\s+|\s*#.*)"/> |
| 921 |
</emptyLines> |
| 922 |
<comments> |
| 923 |
<comment name="singleLine" start="#" position="afterwhitespace"/> |
| 924 |
</comments> |
| 925 |
<keywords casesensitive="1" additionalDeliminator="#'"/> |
| 926 |
</general> |
| 927 |
</language> |
| 928 |
|
| 929 |
<!-- kate: space-indent off; indent-width 2; --> |