Commit c36a3ccd authored by Pino Toscano's avatar Pino Toscano
Browse files

scripting: update Python-Kig highlight definition

synchronize it from the current Python definition in
syntax-highlighting, adding our customizations on top
parent a3e63345
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY digitPart "[0-9](?:_?[0-9])*">
<!ENTITY beforeDigit "(?&lt;![\.\w[:^ascii:]])">
<!ENTITY beforePointFloat "(?&lt;![\w[:^ascii:]])">
]>
<!-- Python syntax highlightning v0.9 by Per Wigren -->
<!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) -->
<!-- Python syntax highlighting v1.97 by Paul Giannaros -->
<!-- Python syntax highlighting v1.99 by Primoz Anzur -->
<!-- Python syntax highlightning v1.99.x for Kig by Pino Toscano -->
<language name="Python-Kig" version="1.99.1" kateversion="2.4" section="Scripts" extensions="*.py;*.pyw" mimetype="application/x-python;text/x-python" casesensitive="1" author="Michael Bueker" license="">
<!-- Python syntax highlighting v2.01 by Paul Giannaros:
* full format character support
* unicode string modifier supported -->
<!-- v2.02 remove RegExpr for nums and make indent consistent -->
<!-- v2.03 highlight decorators, remove operator regex, don't highlight parens as operators -->
<!-- v2.04 make alerts visible even if they are directly after ''' or # without a space -->
<!-- v2.06 decorator names can (and often do) contain periods -->
<!-- v2.07 add support for %prog and co, see bug 142832 -->
<!-- v2.08 add missing overloaders, new Python 3 statements, builtins, and keywords -->
<!-- v2.29 recognize escape sequenzes correctly -->
<!-- v2.29.1 for Kig by Pino Toscano -->
<language name="Python-Kig" version="11.1" style="python" indenter="python" kateversion="5.0" section="Scripts" extensions="*.py;*.pyw;SConstruct;SConscript;*.FCMacro" mimetype="application/x-python;text/x-python;text/x-python3" casesensitive="1" author="Michael Bueker" license="">
<highlighting>
<list name="prep">
<item> import </item>
<item> from </item>
<item> as </item>
<list name="import">
<item>import</item>
<item>from</item>
<item>as</item>
</list>
<list name="defs">
<item> class </item>
<item> def </item>
<item> del </item>
<item> global </item>
<item> lambda </item>
<item>class</item>
<item>def</item>
<item>del</item>
<item>global</item>
<item>lambda</item>
<item>nonlocal</item>
</list>
<list name="operators">
<item> and </item>
<item> assert </item>
<item> in </item>
<item> is </item>
<item> not </item>
<item> or </item>
</list>
<list name="commands">
<item> exec </item>
<item> print </item>
<item>and</item>
<item>in</item>
<item>is</item>
<item>not</item>
<item>or</item>
</list>
<list name="flow">
<item> break </item>
<item> continue </item>
<item> elif </item>
<item> else </item>
<item> except </item>
<item> finally </item>
<item> for </item>
<item> if </item>
<item> pass </item>
<item> raise </item>
<item> return </item>
<item> try </item>
<item> while </item>
<item> yield </item>
<item>assert</item>
<item>break</item>
<item>continue</item>
<item>elif</item>
<item>else</item>
<item>except</item>
<item>finally</item>
<item>for</item>
<item>if</item>
<item>pass</item>
<item>raise</item>
<item>return</item>
<item>try</item>
<item>while</item>
<item>with</item>
<item>yield</item>
<item>async</item>
<item>await</item>
</list>
<list name="builtinfuncs">
<item> __future__ </item>
<item> __import__ </item>
<item> __name__ </item>
<item> abs </item>
<item> all </item>
<item> any </item>
<item> apply </item>
<item> basestring </item>
<item> bool </item>
<item> buffer </item>
<item> callable </item>
<item> chr </item>
<item> classmethod </item>
<item> cmp </item>
<item> coerce </item>
<item> compile </item>
<item> complex </item>
<item> delattr </item>
<item> dict </item>
<item> dir </item>
<item> divmod </item>
<item> enumerate </item>
<item> eval </item>
<item> execfile </item>
<item> file </item>
<item> filter </item>
<item> float </item>
<item> frozenset </item>
<item> getattr </item>
<item> globals </item>
<item> hasattr </item>
<item> hash </item>
<item> hex </item>
<item> id </item>
<item> input </item>
<item> int </item>
<item> intern </item>
<item> isinstance </item>
<item> issubclass </item>
<item> iter </item>
<item> len </item>
<item> list </item>
<item> locals </item>
<item> long </item>
<item> map </item>
<item> max </item>
<item> min </item>
<item> object </item>
<item> oct </item>
<item> open </item>
<item> ord </item>
<item> pow </item>
<item> property </item>
<item> range </item>
<item> raw_input </item>
<item> reduce </item>
<item> reload </item>
<item> repr </item>
<item> reversed </item>
<item> round </item>
<item> set </item>
<item> setattr </item>
<item> slice </item>
<item> sorted </item>
<item> staticmethod </item>
<item> str </item>
<item> sum </item>
<item> super </item>
<item> tuple </item>
<item> type </item>
<item> unichr </item>
<item> unicode </item>
<item> vars </item>
<item> xrange </item>
<item> zip </item>
<item>__import__</item>
<item>abs</item>
<item>all</item>
<item>any</item>
<item>apply</item>
<item>ascii</item>
<item>basestring</item>
<item>bin</item>
<item>breakpoint</item>
<item>bool</item>
<item>buffer</item>
<item>bytearray</item>
<item>bytes</item>
<item>callable</item>
<item>chr</item>
<item>classmethod</item>
<item>cmp</item>
<item>coerce</item>
<item>compile</item>
<item>complex</item>
<item>delattr</item>
<item>dict</item>
<item>dir</item>
<item>divmod</item>
<item>enumerate</item>
<item>eval</item>
<item>exec</item>
<item>execfile</item>
<item>file</item>
<item>filter</item>
<item>float</item>
<item>format</item>
<item>frozenset</item>
<item>getattr</item>
<item>globals</item>
<item>hasattr</item>
<item>hash</item>
<item>help</item>
<item>hex</item>
<item>id</item>
<item>input</item>
<item>int</item>
<item>intern</item>
<item>isinstance</item>
<item>issubclass</item>
<item>iter</item>
<item>len</item>
<item>list</item>
<item>locals</item>
<item>long</item>
<item>map</item>
<item>max</item>
<item>memoryview</item>
<item>min</item>
<item>next</item>
<item>object</item>
<item>oct</item>
<item>open</item>
<item>ord</item>
<item>pow</item>
<item>print</item>
<item>property</item>
<item>range</item>
<item>raw_input</item>
<item>reduce</item>
<item>reload</item>
<item>repr</item>
<item>reversed</item>
<item>round</item>
<item>set</item>
<item>setattr</item>
<item>slice</item>
<item>sorted</item>
<item>staticmethod</item>
<item>str</item>
<item>sum</item>
<item>super</item>
<item>tuple</item>
<item>type</item>
<item>unichr</item>
<item>unicode</item>
<item>vars</item>
<item>xrange</item>
<item>zip</item>
<!-- BEGIN: math module functions -->
<item> acos </item>
<item> asin </item>
<item> atan </item>
<item> atan2 </item>
<item> ceil </item>
<item> cos </item>
<item> cosh </item>
<item> degrees </item>
<item> exp </item>
<item> fabs </item>
<item> floor </item>
<item> fmod </item>
<item> frexp </item>
<item> hypot </item>
<item> ldexp </item>
<item> log </item>
<item> log10 </item>
<item> modf </item>
<item> radians </item>
<item> sin </item>
<item> sinh </item>
<item> sqrt </item>
<item> tan </item>
<item> tanh </item>
<item>acos</item>
<item>asin</item>
<item>atan</item>
<item>atan2</item>
<item>ceil</item>
<item>cos</item>
<item>cosh</item>
<item>degrees</item>
<item>exp</item>
<item>fabs</item>
<item>floor</item>
<item>fmod</item>
<item>frexp</item>
<item>hypot</item>
<item>ldexp</item>
<item>log</item>
<item>log10</item>
<item>modf</item>
<item>radians</item>
<item>sin</item>
<item>sinh</item>
<item>sqrt</item>
<item>tan</item>
<item>tanh</item>
<!-- END: math module functions -->
</list>
<list name="specialvars">
<item> None </item>
<item> self </item>
<item> True </item>
<item> False </item>
<item> NotImplemented </item>
<item> Ellipsis </item>
<item>None</item>
<item>self</item>
<item>True</item>
<item>False</item>
<item>NotImplemented</item>
<item>Ellipsis</item>
<item>__debug__</item>
<item>__file__</item>
<item>__name__</item>
</list>
<list name="bindings">
<item> SIGNAL </item>
<item> SLOT </item>
<item> connect </item>
<item>SIGNAL</item>
<item>SLOT</item>
<item>connect</item>
</list>
<list name="overloaders">
<item>__new__</item>
......@@ -180,33 +207,138 @@
<item>__hash__</item>
<item>__nonzero__</item>
<item>__unicode__</item>
<item>__getattr__</item>
<item>__setattr__</item>
<item>__delattr__</item>
<item>__getattribute__</item>
<item>__get__</item>
<item>__set__</item>
<item>__delete__</item>
<item>__call__</item>
<item>__len__</item>
<item>__getitem__</item>
<item>__setitem__</item>
<item>__delitem__</item>
<item>__iter__</item>
<item>__reversed__</item>
<item>__contains__</item>
<item>__getslice__</item>
<item>__setslice__</item>
<item>__delslice__</item>
<item>__add__</item>
<item>__sub__</item>
<item>__mul__</item>
<item>__floordiv__</item>
<item>__mod__</item>
<item>__divmod__</item>
<item>__pow__</item>
<item>__lshift__</item>
<item>__rshift__</item>
<item>__and__</item>
<item>__xor__</item>
<item>__or__</item>
<item>__div__</item>
<item>__truediv__</item>
<item>__radd__</item>
<item>__rsub__</item>
<item>__rmul__</item>
<item>__rdiv__</item>
<item>__rtruediv__</item>
<item>__rfloordiv__</item>
<item>__rmod__</item>
<item>__rdivmod__</item>
<item>__rpow__</item>
<item>__rlshift__</item>
<item>__rrshift__</item>
<item>__rand__</item>
<item>__rxor__</item>
<item>__ror__</item>
<item>__iadd__</item>
<item>__isub__</item>
<item>__imul__</item>
<item>__idiv__</item>
<item>__itruediv__</item>
<item>__ifloordiv__</item>
<item>__imod__</item>
<item>__ipow__</item>
<item>__ilshift__</item>
<item>__irshift__</item>
<item>__iand__</item>
<item>__ixor__</item>
<item>__ior__</item>
<item>__neg__</item>
<item>__pos__</item>
<item>__abs__</item>
<item>__invert__</item>
<item>__complex__</item>
<item>__int__</item>
<item>__long__</item>
<item>__float__</item>
<item>__oct__</item>
<item>__hex__</item>
<item>__index__</item>
<item>__coerce__</item>
<item>__enter__</item>
<item>__exit__</item>
<item>__bytes__</item>
<item>__format__</item>
<item>__next__</item>
<item>__dir__</item>
<item>__await__</item>
<item>__aiter__</item>
<item>__anext__</item>
<item>__aenter__</item>
<item>__aexit__</item>
</list>
<list name="exceptions">
<!--
Exceptions list resources used:
- http://docs.python.org/2.7/library/exceptions.html#exception-hierarchy
- http://docs.python.org/3.4/library/exceptions.html#exception-hierarchy
-->
<item>ArithmeticError</item>
<item>AssertionError</item>
<item>AttributeError</item>
<item>BaseException</item>
<item>BlockingIOError</item>
<item>BrokenPipeError</item>
<item>BufferError</item>
<item>BytesWarning</item>
<item>ChildProcessError</item>
<item>ConnectionAbortedError</item>
<item>ConnectionError</item>
<item>ConnectionRefusedError</item>
<item>ConnectionResetError</item>
<item>DeprecationWarning</item>
<item>EnvironmentError</item>
<item>EOFError</item>
<item>Exception</item>
<item>FileExistsError</item>
<item>FileNotFoundError</item>
<item>FloatingPointError</item>
<item>FutureWarning</item>
<item>GeneratorExit</item>
<item>IOError</item>
<item>ImportError</item>
<item>ImportWarning</item>
<item>IndentationError</item>
<item>IndexError</item>
<item>KeyError</item>
<item>InterruptedError</item>
<item>IOError</item>
<item>IsADirectoryError</item>
<item>KeyboardInterrupt</item>
<item>KeyError</item>
<item>LookupError</item>
<item>MemoryError</item>
<item>NameError</item>
<item>NotADirectoryError</item>
<item>NotImplementedError</item>
<item>OSError</item>
<item>OverflowError</item>
<item>PendingDeprecationWarning</item>
<item>PermissionError</item>
<item>ProcessLookupError</item>
<item>ReferenceError</item>
<item>ResourceWarning</item>
<item>RuntimeError</item>
<item>RuntimeWarning</item>
<item>StandardError</item>
......@@ -215,59 +347,60 @@
<item>SyntaxWarning</item>
<item>SystemError</item>
<item>SystemExit</item>
<item>TabError</item>
<item>TimeoutError</item>
<item>TypeError</item>
<item>UnboundLocalError</item>
<item>UserWarning</item>
<item>UnicodeError</item>
<item>UnicodeWarning</item>
<item>UnicodeEncodeError</item>
<item>UnicodeDecodeError</item>
<item>UnicodeEncodeError</item>
<item>UnicodeError</item>
<item>UnicodeTranslateError</item>
<item>UnicodeWarning</item>
<item>UserWarning</item>
<item>ValueError</item>
<item>Warning</item>
<item>WindowsError</item>
<item>ZeroDivisionError</item>
</list>
<list name="kigobjects">
<item> AbstractLine </item>
<item> Angle </item>
<item> Arc </item>
<item> BogusObject </item>
<item> CartesianConic </item>
<item> Circle </item>
<item> Conic </item>
<item> ConicCartesianData </item>
<item> ConicPolarData </item>
<item> Coordinate </item>
<item> Cubic </item>
<item> CubicCartesianData </item>
<item> Curve </item>
<item> DoubleObject </item>
<item> IntObject </item>
<item> InvalidObject </item>
<item> Line </item>
<item> LineData </item>
<item> Object </item>
<item> ObjectType </item>
<item> Point </item>
<item> PolarConic </item>
<item> Ray </item>
<item> Segment </item>
<item> StringObject </item>
<item> TestResultObject </item>
<item> Transformation </item>
<item> Vector </item>
<item>AbstractLine</item>
<item>Angle</item>
<item>Arc</item>
<item>BogusObject</item>
<item>CartesianConic</item>
<item>Circle</item>
<item>Conic</item>
<item>ConicCartesianData</item>
<item>ConicPolarData</item>
<item>Coordinate</item>
<item>Cubic</item>
<item>CubicCartesianData</item>
<item>Curve</item>
<item>DoubleObject</item>
<item>IntObject</item>
<item>InvalidObject</item>
<item>Line</item>
<item>LineData</item>
<item>Object</item>
<item>ObjectType</item>
<item>Point</item>
<item>PolarConic</item>
<item>Ray</item>
<item>Segment</item>
<item>StringObject</item>
<item>TestResultObject</item>
<item>Transformation</item>
<item>Vector</item>
</list>
<list name="mathconsts">
<item> e </item>
<item> pi </item>
<item>e</item>
<item>pi</item>
</list>
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<keyword attribute="Preprocessor" String="prep" context="#stay"/>
<keyword attribute="Import" String="import" context="#stay"/>
<keyword attribute="Definition Keyword" String="defs" context="#stay"/>
<keyword attribute="Operator" String="operators" context="#stay"/>
<keyword attribute="Command Keyword" String="commands" context="#stay"/>
<keyword attribute="Operator Keyword" String="operators" context="#stay"/>
<keyword attribute="Flow Control Keyword" String="flow" context="#stay"/>
<keyword attribute="Builtin Function" String="builtinfuncs" context="#stay"/>
<keyword attribute="Special Variable" String="specialvars" context="#stay"/>
......@@ -276,155 +409,350 @@
<keyword attribute="Overloaders" String="overloaders" context="#stay"/>
<keyword attribute="Kig Object" String="kigobjects" context="#stay" />
<keyword attribute="Math Constants" String="mathconsts" context="#stay" />
<RegExpr attribute="Normal" String="[a-zA-Z_][a-zA-Z_0-9]+" context="#stay"/>
<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"/>
<RegExpr attribute="Float" String="([0-9]+\.[0-9]*|\.[0-9]+)([eE][0-9]+)?" context="#stay"/>
<RegExpr attribute="Int" String="([1-9][0-9]*([eE][0-9]+)?|0)" context="#stay"/>
<RegExpr attribute="Long" String="[1-9][0-9]*([eE][0-9.]+)?[Ll]" context="#stay"/>
<RegExpr attribute="Hex" String="0[Xx][0-9a-fA-F]+" context="#stay"/>
<RegExpr attribute="Octal" String="0[1-9][0-9]*" context="#stay"/>
<RegExpr attribute="Raw String" String="[rR]'''" context="Raw Tripple A-string"/>
<RegExpr attribute="Raw String" String="[rR]&quot;&quot;&quot;" context="Raw Tripple Q-string"/>
<RegExpr attribute="Raw String" String="[rR]'" context="Raw A-string"/>
<RegExpr attribute="Raw String" String="[rR]&quot;" context="Raw Q-string"/>
<RegExpr attribute="Comment" String="#.*$" context="#stay"/>
<RegExpr attribute="Comment" String="^\s*u?'''" context="Tripple A-comment" beginRegion="Tripple A-region"/>
<RegExpr attribute="Comment" String="^\s*u?&quot;&quot;&quot;" context="Tripple Q-comment" beginRegion="Tripple Q-region"/>
<StringDetect attribute="String" String="'''" context="Tripple A-string" beginRegion="Tripple A-region"/>
<StringDetect attribute="String" String="&quot;&quot;&quot;" context="Tripple Q-string" beginRegion="Tripple Q-region"/>
<DetectChar attribute="String" char="'" context="Single A-string"/>
<DetectChar attribute="String" char="&quot;" context="Single Q-string"/>
<DetectChar attribute="Operator" char="(" context="parenthesised" beginRegion="parenthesis"/>
<DetectChar attribute="Operator" char=")" context="#pop" endRegion="parenthesis"/>
<RegExpr attribute="Operator" String="[+*/%\|=;\!&lt;&gt;!^&amp;~-]" context="#stay"/>
<RegExpr attribute="String Substitution" String="%[a-zA-Z]" context="#stay"/>
</context>
<context name="parenthesised" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true">
<IncludeRules context="Normal" />
<RegExpr attribute="Normal Text" String="[a-zA-Z_][a-zA-Z_0-9]{2,}" context="#stay"/>
<!-- Complex: 1j ; 1.1j ; 1.j ; .1j ; 1e3j ; 1.1e3j ; 1.e3j ; .1e3j -->
<RegExpr attribute="Complex" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)(?:[eE][\+\-]?&digitPart;)?[jJ]\b" context="#stay"/>
<!-- Hexadecimal: 0xA1, Binary: 0b01, Octal: 0o71 -->
<RegExpr attribute="Hex" String="&beforeDigit;0[xX](?:_?[\da-fA-F])+\b" context="#stay"/>
<RegExpr attribute="Binary" String="&beforeDigit;0[bB](?:_?[01])+\b" context="#stay"/>
<RegExpr attribute="Octal" String="&beforeDigit;0[oO](?:_?[0-7])+\b" context="#stay"/>
<!-- Float: 1.1 ; 1. ; .1 ; 1e3 ; 1.1e3 ; 1.e3 ; .1e3 -->
<RegExpr attribute="Float" String="(?:&beforeDigit;&digitPart;(?:\.(?:&digitPart;)?)?|&beforePointFloat;\.&digitPart;)[eE][\+\-]?&digitPart;\b" context="#stay"/>
<RegExpr attribute="Float" String="(?:&beforeDigit;&digitPart;\.(?:&digitPart;\b)?|&beforePointFloat;\.&digitPart;\b)" context="#stay"/>
<!-- Decimal: 123 ; 000 -->
<RegExpr attribute="Int" String="&beforeDigit;(?:[1-9](?:_?\d)*|0(?:_?0)*)[lL]?\b" context="#stay"/>
<DetectChar attribute="Normal Text" char="{" context="Dictionary" beginRegion="Dictionary"/>