Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/python.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
---|---|---|---|---|---|
2 | <!DOCTYPE language> | 2 | <!DOCTYPE language SYSTEM "language.dtd" | ||
3 | [ | ||||
4 | <!ENTITY digitPart "[0-9](?:_?[0-9])*"> | ||||
5 | <!ENTITY beforeDigit "(?<![\.\w[:^ascii:]])"> | ||||
6 | <!ENTITY beforePointFloat "(?<![\w[:^ascii:]])"> | ||||
7 | ]> | ||||
3 | <!-- Python syntax highlightning v0.9 by Per Wigren --> | 8 | <!-- Python syntax highlightning v0.9 by Per Wigren --> | ||
4 | <!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) --> | 9 | <!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) --> | ||
5 | <!-- Python syntax highlighting v1.97 by Paul Giannaros --> | 10 | <!-- Python syntax highlighting v1.97 by Paul Giannaros --> | ||
6 | <!-- Python syntax highlighting v1.99 by Primoz Anzur --> | 11 | <!-- Python syntax highlighting v1.99 by Primoz Anzur --> | ||
7 | <!-- Python syntax highlighting v2.01 by Paul Giannaros: | 12 | <!-- Python syntax highlighting v2.01 by Paul Giannaros: | ||
8 | * full format character support | 13 | * full format character support | ||
9 | * unicode string modifier supported --> | 14 | * unicode string modifier supported --> | ||
10 | <!-- v2.02 remove RegExpr for nums and make indent consistent --> | 15 | <!-- v2.02 remove RegExpr for nums and make indent consistent --> | ||
11 | <!-- v2.03 highlight decorators, remove operator regex, don't highlight parens as operators --> | 16 | <!-- v2.03 highlight decorators, remove operator regex, don't highlight parens as operators --> | ||
12 | <!-- v2.04 make alerts visible even if they are directly after ''' or # without a space --> | 17 | <!-- v2.04 make alerts visible even if they are directly after ''' or # without a space --> | ||
13 | <!-- v2.06 decorator names can (and often do) contain periods --> | 18 | <!-- v2.06 decorator names can (and often do) contain periods --> | ||
14 | <!-- v2.07 add support for %prog and co, see bug 142832 --> | 19 | <!-- v2.07 add support for %prog and co, see bug 142832 --> | ||
15 | <!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords --> | 20 | <!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords --> | ||
16 | <!-- v2.29 recognize escape sequenzes correctly --> | 21 | <!-- v2.29 recognize escape sequenzes correctly --> | ||
17 | <language name="Python" version="9" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> | 22 | <language name="Python" version="10" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license=""> | ||
18 | <highlighting> | 23 | <highlighting> | ||
19 | <list name="import"> | 24 | <list name="import"> | ||
20 | <item>import</item> | 25 | <item>import</item> | ||
21 | <item>from</item> | 26 | <item>from</item> | ||
22 | <item>as</item> | 27 | <item>as</item> | ||
23 | </list> | 28 | </list> | ||
24 | <list name="defs"> | 29 | <list name="defs"> | ||
25 | <item>class</item> | 30 | <item>class</item> | ||
Show All 34 Lines | 64 | <list name="builtinfuncs"> | |||
60 | <item>__import__</item> | 65 | <item>__import__</item> | ||
61 | <item>abs</item> | 66 | <item>abs</item> | ||
62 | <item>all</item> | 67 | <item>all</item> | ||
63 | <item>any</item> | 68 | <item>any</item> | ||
64 | <item>apply</item> | 69 | <item>apply</item> | ||
65 | <item>ascii</item> | 70 | <item>ascii</item> | ||
66 | <item>basestring</item> | 71 | <item>basestring</item> | ||
67 | <item>bin</item> | 72 | <item>bin</item> | ||
73 | <item>breakpoint</item> | ||||
68 | <item>bool</item> | 74 | <item>bool</item> | ||
69 | <item>buffer</item> | 75 | <item>buffer</item> | ||
70 | <item>bytearray</item> | 76 | <item>bytearray</item> | ||
71 | <item>bytes</item> | 77 | <item>bytes</item> | ||
72 | <item>callable</item> | 78 | <item>callable</item> | ||
73 | <item>chr</item> | 79 | <item>chr</item> | ||
74 | <item>classmethod</item> | 80 | <item>classmethod</item> | ||
75 | <item>cmp</item> | 81 | <item>cmp</item> | ||
▲ Show 20 Lines • Show All 261 Lines • ▼ Show 20 Line(s) | 339 | <context name="Normal" attribute="Normal Text" lineEndContext="#stay"> | |||
337 | <keyword attribute="Flow Control Keyword" String="flow" context="#stay"/> | 343 | <keyword attribute="Flow Control Keyword" String="flow" context="#stay"/> | ||
338 | <keyword attribute="Builtin Function" String="builtinfuncs" context="#stay"/> | 344 | <keyword attribute="Builtin Function" String="builtinfuncs" context="#stay"/> | ||
339 | <keyword attribute="Special Variable" String="specialvars" context="#stay"/> | 345 | <keyword attribute="Special Variable" String="specialvars" context="#stay"/> | ||
340 | <keyword attribute="Extensions" String="bindings" context="#stay"/> | 346 | <keyword attribute="Extensions" String="bindings" context="#stay"/> | ||
341 | <keyword attribute="Exceptions" String="exceptions" context="#stay"/> | 347 | <keyword attribute="Exceptions" String="exceptions" context="#stay"/> | ||
342 | <keyword attribute="Overloaders" String="overloaders" context="#stay"/> | 348 | <keyword attribute="Overloaders" String="overloaders" context="#stay"/> | ||
343 | <RegExpr attribute="Normal Text" String="[a-zA-Z_][a-zA-Z_0-9]{2,}" context="#stay"/> | 349 | <RegExpr attribute="Normal Text" String="[a-zA-Z_][a-zA-Z_0-9]{2,}" context="#stay"/> | ||
344 | 350 | | |||
345 | <RegExpr attribute="Complex" String=" ((([0-9]*\.[0-9]+|[0-9]+\.)|([0-9]+|([0-9]*\.[0-9]+|[0-9]+\.))[eE](\+|-)?[0-9]+)|[0-9]+)[jJ]" context="#stay"/> | 351 | <!-- Complex: 1j ; 1.1j ; 1.j ; .1j ; 1e3j ; 1.1e3j ; 1.e3j ; .1e3j --> | ||
346 | <Float attribute="Float" context="#stay" /> | 352 | <RegExpr attribute="Complex" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)(?:[eE][\+\-]?&digitPart;)?[jJ]\b" context="#stay"/> | ||
347 | <HlCHex attribute="Hex" context="#stay"/> | 353 | <!-- Hexadecimal: 0xA1, Binary: 0b01, Octal: 0o71 --> | ||
348 | <HlCOct attribute="Octal" context="#stay"/> | 354 | <RegExpr attribute="Hex" String="&beforeDigit;0[xX](?:_?[\da-fA-F])+\b" context="#stay"/> | ||
349 | <Int attribute="Int" context="Int Suffixes"/> | 355 | <RegExpr attribute="Binary" String="&beforeDigit;0[bB](?:_?[01])+\b" context="#stay"/> | ||
350 | 356 | <RegExpr attribute="Octal" String="&beforeDigit;0[oO](?:_?[0-7])+\b" context="#stay"/> | |||
351 | <RegExpr attribute="Int" String=" ([0-9]+_)+[0-9]+" context="#stay"/> | 357 | <!-- Float: 1.1 ; 1. ; .1 ; 1e3 ; 1.1e3 ; 1.e3 ; .1e3 --> | ||
352 | <RegExpr attribute="Float" String=" ([0-9]+_)+[0-9]+\.[0-9]+" context="#stay"/> | 358 | <RegExpr attribute="Float" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)[eE][\+\-]?&digitPart;\b" context="#stay"/> | ||
353 | <RegExpr attribute="Hex" String=" [0-9]x([A-F0-9]+_)+[A-F0-9]+" context="#stay"/> | 359 | <RegExpr attribute="Float" String="(?:&beforeDigit;&digitPart;\.(?:&digitPart;\b)?|&beforePointFloat;\.&digitPart;\b)" context="#stay"/> | ||
360 | <!-- Decimal: 123 ; 000 --> | ||||
361 | <RegExpr attribute="Int" String="&beforeDigit;(?:[1-9](?:_?\d)*|0(?:_?0)*)[lL]?\b" context="#stay"/> | ||||
354 | 362 | | |||
355 | <DetectChar attribute="Normal Text" char="{" context="Dictionary" beginRegion="Dictionary"/> | 363 | <DetectChar attribute="Normal Text" char="{" context="Dictionary" beginRegion="Dictionary"/> | ||
356 | <DetectChar attribute="Normal Text" char="[" context="List" beginRegion="List"/> | 364 | <DetectChar attribute="Normal Text" char="[" context="List" beginRegion="List"/> | ||
357 | <DetectChar attribute="Normal Text" char="(" context="Tuple" beginRegion="Tuple"/> | 365 | <DetectChar attribute="Normal Text" char="(" context="Tuple" beginRegion="Tuple"/> | ||
358 | 366 | | |||
359 | <IncludeRules context="CommentVariants" /> | 367 | <IncludeRules context="CommentVariants" /> | ||
360 | 368 | | |||
361 | <DetectChar attribute="Comment" char="#" context="Hash comment"/> | 369 | <DetectChar attribute="Comment" char="#" context="Hash comment"/> | ||
362 | 370 | | |||
363 | <IncludeRules context="StringVariants" /> | 371 | <IncludeRules context="StringVariants" /> | ||
364 | 372 | | |||
365 | <RegExpr attribute="Decorator" String="@[_a-zA-Z][\._a-zA-Z0-9]*" firstNonSpace="true"/> | 373 | <RegExpr attribute="Decorator" String="@[_a-zA-Z[:^ascii:]][\._a-zA-Z0-9[:^ascii:]]*" firstNonSpace="true"/> | ||
366 | <AnyChar attribute="Operator" String="+*/%\|=;\!<>!^&~-@" context="#stay"/> | 374 | <AnyChar attribute="Operator" String="+*/%\|=;\!<>!^&~-@" context="#stay"/> | ||
367 | </context> | 375 | </context> | ||
368 | 376 | | |||
369 | <context name="Int Suffixes" attribute="Int" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | | |||
370 | <StringDetect attribute="Int" context="#pop" String="L" insensitive="true"/> | | |||
371 | </context> | | |||
372 | | ||||
373 | <context name="#CheckForString" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | 377 | <context name="#CheckForString" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||
374 | <DetectSpaces/> | 378 | <DetectSpaces/> | ||
375 | <LineContinue attribute="Normal Text" context="CheckForStringNext"/> | 379 | <LineContinue attribute="Normal Text" context="CheckForStringNext"/> | ||
376 | </context> | 380 | </context> | ||
377 | 381 | | |||
378 | <context name="CheckForStringNext" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | 382 | <context name="CheckForStringNext" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||
379 | <DetectSpaces/> | 383 | <DetectSpaces/> | ||
380 | <LineContinue attribute="Normal Text" context="CheckForStringNext"/> | 384 | <LineContinue attribute="Normal Text" context="CheckForStringNext"/> | ||
▲ Show 20 Lines • Show All 275 Lines • ▼ Show 20 Line(s) | 652 | <itemDatas> | |||
656 | <itemData name="Extensions" defStyleNum="dsExtension" spellChecking="false"/> | 660 | <itemData name="Extensions" defStyleNum="dsExtension" spellChecking="false"/> | ||
657 | <itemData name="Exceptions" defStyleNum="dsPreprocessor" spellChecking="false"/> | 661 | <itemData name="Exceptions" defStyleNum="dsPreprocessor" spellChecking="false"/> | ||
658 | <itemData name="Overloaders" defStyleNum="dsFunction" spellChecking="false"/> | 662 | <itemData name="Overloaders" defStyleNum="dsFunction" spellChecking="false"/> | ||
659 | <itemData name="Import" defStyleNum="dsImport" spellChecking="false"/> | 663 | <itemData name="Import" defStyleNum="dsImport" spellChecking="false"/> | ||
660 | <itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> | 664 | <itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> | ||
661 | <itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/> | 665 | <itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/> | ||
662 | <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> | 666 | <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/> | ||
663 | <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> | 667 | <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/> | ||
668 | <itemData name="Binary" defStyleNum="dsBaseN" spellChecking="false"/> | ||||
664 | <itemData name="Complex" defStyleNum="dsOthers" spellChecking="false"/> | 669 | <itemData name="Complex" defStyleNum="dsOthers" spellChecking="false"/> | ||
665 | <itemData name="Comment" defStyleNum="dsComment"/> | 670 | <itemData name="Comment" defStyleNum="dsComment"/> | ||
666 | <itemData name="String" defStyleNum="dsString"/> | 671 | <itemData name="String" defStyleNum="dsString"/> | ||
667 | <itemData name="Raw String" defStyleNum="dsVerbatimString"/> | 672 | <itemData name="Raw String" defStyleNum="dsVerbatimString"/> | ||
668 | <itemData name="F-String" defStyleNum="dsSpecialString"/> | 673 | <itemData name="F-String" defStyleNum="dsSpecialString"/> | ||
669 | <itemData name="Raw F-String" defStyleNum="dsVerbatimString"/> | 674 | <itemData name="Raw F-String" defStyleNum="dsVerbatimString"/> | ||
670 | <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> | 675 | <itemData name="String Char" defStyleNum="dsChar" spellChecking="false"/> | ||
671 | <itemData name="String Substitution" defStyleNum="dsSpecialChar" spellChecking="false"/> | 676 | <itemData name="String Substitution" defStyleNum="dsSpecialChar" spellChecking="false"/> | ||
Show All 17 Lines |