"Fossies" - the Fresh Open Source Software Archive

Member "gretl/gtksourceview/python.lang" (20 Jun 2018, 15022 Bytes) of package /windows/misc/gretl-2020e-win32.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <?xml version="1.0" encoding="UTF-8"?>
    2 <!--
    3 
    4  Author: Gustavo Giráldez <gustavo.giraldez@gmx.net>
    5  Copyright (C) 2003 Gustavo Giráldez <gustavo.giraldez@gmx.net>
    6  Copyright (C) 2004 Benoît Dejean <TaZForEver@free.fr>
    7  Copyright (C) 2006 Steve Frécinaux <nud@apinc.org>
    8 
    9  This library is free software; you can redistribute it and/or
   10  modify it under the terms of the GNU Library General Public
   11  License as published by the Free Software Foundation; either
   12  version 2 of the License, or (at your option) any later version.
   13 
   14  This library is distributed in the hope that it will be useful,
   15  but WITHOUT ANY WARRANTY; without even the implied warranty of
   16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   17  Library General Public License for more details.
   18 
   19  You should have received a copy of the GNU Library General Public
   20  License along with this library; if not, write to the
   21  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   22  Boston, MA 02111-1307, USA.
   23 
   24 -->
   25 <language id="python" _name="Python" version="2.0" _section="Scripts">
   26   <metadata>
   27     <property name="mimetypes">text/x-python;application/x-python</property>
   28     <property name="globs">*.py</property>
   29     <property name="line-comment-start">#</property>
   30   </metadata>
   31 
   32   <styles>
   33     <style id="module-handler"    _name="Module Handler"        map-to="def:preprocessor"/>
   34     <style id="keyword"           _name="Keyword"               map-to="def:keyword"/>
   35     <style id="multiline-string"  _name="Multiline string"      map-to="def:string"/>
   36     <style id="string"            _name="String"                map-to="def:string"/>
   37     <style id="escaped-char"      _name="Escaped Character"     map-to="def:special-char"/>
   38     <style id="format"            _name="Format"                map-to="def:character"/>
   39     <style id="string-conversion" _name="string-conversion"/>
   40     <style id="special-variable"  _name="Special Variable"      map-to="def:identifier"/>
   41     <style id="boolean"           _name="Boolean"               map-to="def:boolean"/>
   42     <style id="floating-point"    _name="Floating point number" map-to="def:floating-point"/>
   43     <style id="decimal"           _name="Decimal number"        map-to="def:decimal"/>
   44     <style id="base-n-integer"    _name="Base-N number"         map-to="def:base-n-integer"/>
   45     <style id="complex"           _name="Complex number"        map-to="def:complex"/>
   46     <style id="builtin-constant"  _name="Builtin Constant"      map-to="def:special-constant"/>
   47     <style id="builtin-object"    _name="Builtin Object"        map-to="def:type"/>
   48     <style id="builtin-function"  _name="Builtin Function"      map-to="def:builtin"/>
   49   </styles>
   50 
   51   <definitions>
   52     <define-regex id="identifier">[_a-zA-Z][_a-zA-Z0-9]*</define-regex>
   53     <define-regex id="number">[1-9][0-9]*</define-regex>
   54 
   55     <!-- http://docs.python.org/lib/typesseq-strings.html -->
   56     <context id="format" style-ref="format" extend-parent="false">
   57       <match extended="true">
   58         %                       # leading % sign
   59         \(\%{identifier}\)?     # mapping key
   60         [#0\-\ \+]*             # conversion flags
   61         (\-?\%{number}|\*)?     # minimum field width
   62         (\.(\-?\%{number}|\*))? # precision
   63         (hlL)?                  # lentgh modifier
   64         [diouxXeEfFgGcrs%]      # conversion type
   65       </match>
   66     </context>
   67 
   68     <!-- http://docs.python.org/ref/strings.html -->
   69     <context id="escaped-char" style-ref="escaped-char" extend-parent="true">
   70       <match extended="true">
   71         \\(                 # leading backslash
   72         [\\'"abfnrtv]     | # single escaped char
   73         N\{[A-Z\ ]+\}     | # named unicode character
   74         u[0-9A-Fa-f]{4}   | # xxxx - character with 16-bit hex value xxxx
   75         U[0-9A-Fa-f]{8}   | # xxxxxxxx - character with 32-bit hex value xxxxxxxx
   76         x[0-9A-Fa-f]{1,2} | # \xhh - character with hex value hh
   77         [0-7]{1,3}          # \ooo - character with octal value ooo
   78         )
   79       </match>
   80     </context>
   81 
   82     <define-regex id="string-prefix">(u|U)?</define-regex>
   83     <define-regex id="raw-string-prefix">(r|ur|R|UR|Ur|uR)</define-regex>
   84 
   85     <context id="multiline-double-quoted-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
   86       <start>\%{string-prefix}"""</start>
   87       <end>"""</end>
   88       <include>
   89         <context ref="format"/>
   90         <context ref="escaped-char"/>
   91       </include>
   92     </context>
   93 
   94     <context id="multiline-single-quoted-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
   95       <start>\%{string-prefix}'''</start>
   96       <end>'''</end>
   97       <include>
   98         <context ref="format"/>
   99         <context ref="escaped-char"/>
  100       </include>
  101     </context>
  102 
  103     <context id="double-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
  104       <start>\%{string-prefix}"</start>
  105       <end>"</end>
  106       <include>
  107         <context ref="format"/>
  108         <context ref="escaped-char"/>
  109         <context ref="def:line-continue"/>
  110       </include>
  111     </context>
  112 
  113     <context id="single-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
  114       <start>\%{string-prefix}'</start>
  115       <end>'</end>
  116       <include>
  117         <context ref="format"/>
  118         <context ref="escaped-char"/>
  119         <context ref="def:line-continue"/>
  120       </include>
  121     </context>
  122 
  123     <context id="multiline-double-quoted-raw-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
  124       <start>\%{raw-string-prefix}"""</start>
  125       <end>"""</end>
  126       <include>
  127         <context ref="format"/>
  128       </include>
  129     </context>
  130 
  131     <context id="multiline-single-quoted-raw-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
  132       <start>\%{raw-string-prefix}'''</start>
  133       <end>'''</end>
  134       <include>
  135         <context ref="format"/>
  136       </include>
  137     </context>
  138 
  139     <context id="double-quoted-raw-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
  140       <start>\%{raw-string-prefix}"</start>
  141       <end>"</end>
  142       <include>
  143         <context ref="format"/>
  144         <context ref="def:line-continue"/>
  145       </include>
  146     </context>
  147 
  148     <context id="single-quoted-raw-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
  149       <start>\%{raw-string-prefix}'</start>
  150       <end>'</end>
  151       <include>
  152         <context ref="format"/>
  153         <context ref="def:line-continue"/>
  154       </include>
  155     </context>
  156 
  157     <context id="python" class="no-spell-check">
  158       <include>
  159         <context ref="def:shebang"/>
  160         <context ref="def:shell-like-comment"/>
  161 
  162         <context ref="multiline-double-quoted-string"/>
  163         <context ref="multiline-single-quoted-string"/>
  164         <context ref="double-quoted-string"/>
  165         <context ref="single-quoted-string"/>
  166 
  167         <context ref="multiline-double-quoted-raw-string"/>
  168         <context ref="multiline-single-quoted-raw-string"/>
  169         <context ref="double-quoted-raw-string"/>
  170         <context ref="single-quoted-raw-string"/>
  171 
  172         <context id="string-conversion" style-ref="string-conversion" end-at-line-end="true">
  173           <start>`</start>
  174           <end>`</end>
  175           <include>
  176             <context ref="python"/>
  177           </include>
  178         </context>
  179 
  180         <context id="special-variables" style-ref="special-variable">
  181           <prefix>(?&lt;![\w\.])</prefix>
  182           <keyword>self</keyword>
  183           <keyword>__name__</keyword>
  184           <keyword>__debug__</keyword>
  185         </context>
  186 
  187         <context id="boolean" style-ref="boolean">
  188           <prefix>(?&lt;![\w\.])</prefix>
  189           <keyword>False</keyword>
  190           <keyword>True</keyword>
  191         </context>
  192 
  193         <define-regex id="float" extended="true">
  194           ( (\d+)?\.\d+ | \d+\. ) |
  195           ( (\d+|(\d+)?\.\d+|\d+\.)[eE][+-]?\d+ )
  196         </define-regex>
  197 
  198         <context id="complex" style-ref="complex">
  199           <match>(?&lt;![\w\.])(\%{float}|\d+)[jJ]\b</match>
  200         </context>
  201 
  202         <context id="float" style-ref="floating-point">
  203           <match>(?&lt;![\w\.])\%{float}(?![\w\.])</match>
  204         </context>
  205 
  206         <context id="decimal" style-ref="decimal">
  207           <match>(?&lt;![\w\.])([1-9][0-9]*|0)[lL]?(?![\w\.])</match>
  208         </context>
  209 
  210         <context id="octal" style-ref="base-n-integer">
  211           <match>(?&lt;![\w\.])0[0-7]+[lL]?(?![\w\.])</match>
  212         </context>
  213 
  214         <context id="hex" style-ref="base-n-integer">
  215           <match>(?&lt;![\w\.])0[xX][0-9A-Fa-f]+[lL]?(?![\w\.])</match>
  216         </context>
  217 
  218         <context id="module-handler" style-ref="module-handler">
  219           <keyword>import</keyword>
  220           <keyword>from</keyword>
  221           <keyword>as</keyword>
  222         </context>
  223 
  224         <context id="keyword" style-ref="keyword">
  225           <keyword>and</keyword>
  226           <keyword>assert</keyword>
  227           <keyword>break</keyword>
  228           <keyword>class</keyword>
  229           <keyword>continue</keyword>
  230           <keyword>def</keyword>
  231           <keyword>del</keyword>
  232           <keyword>elif</keyword>
  233           <keyword>else</keyword>
  234           <keyword>except</keyword>
  235           <keyword>exec</keyword>
  236           <keyword>finally</keyword>
  237           <keyword>for</keyword>
  238           <keyword>global</keyword>
  239           <keyword>if</keyword>
  240           <keyword>in</keyword>
  241           <keyword>is</keyword>
  242           <keyword>lambda</keyword>
  243           <keyword>not</keyword>
  244           <keyword>or</keyword>
  245           <keyword>pass</keyword>
  246           <keyword>print</keyword>
  247           <keyword>raise</keyword>
  248           <keyword>return</keyword>
  249           <keyword>try</keyword>
  250           <keyword>while</keyword>
  251           <keyword>with</keyword>
  252           <keyword>yield</keyword>
  253         </context>
  254 
  255         <context id="builtin-constants" style-ref="builtin-constant">
  256           <prefix>(?&lt;![\w\.])</prefix>
  257           <keyword>Ellipsis</keyword>
  258           <keyword>None</keyword>
  259           <keyword>NotImplemented</keyword>
  260         </context>
  261 
  262         <context id="builtin-objects" style-ref="builtin-object">
  263           <prefix>(?&lt;![\w\.])</prefix>
  264           <keyword>ArithmeticError</keyword>
  265           <keyword>AssertionError</keyword>
  266           <keyword>AttributeError</keyword>
  267           <keyword>EnvironmentError</keyword>
  268           <keyword>EOFError</keyword>
  269           <keyword>Exception</keyword>
  270           <keyword>FloatingPointError</keyword>
  271           <keyword>ImportError</keyword>
  272           <keyword>IndentationError</keyword>
  273           <keyword>IndexError</keyword>
  274           <keyword>IOError</keyword>
  275           <keyword>KeyboardInterrupt</keyword>
  276           <keyword>KeyError</keyword>
  277           <keyword>LookupError</keyword>
  278           <keyword>MemoryError</keyword>
  279           <keyword>NameError</keyword>
  280           <keyword>NotImplementedError</keyword>
  281           <keyword>OSError</keyword>
  282           <keyword>OverflowError</keyword>
  283           <keyword>ReferenceError</keyword>
  284           <keyword>RuntimeError</keyword>
  285           <keyword>StandardError</keyword>
  286           <keyword>StopIteration</keyword>
  287           <keyword>SyntaxError</keyword>
  288           <keyword>SystemError</keyword>
  289           <keyword>SystemExit</keyword>
  290           <keyword>TabError</keyword>
  291           <keyword>TypeError</keyword>
  292           <keyword>UnboundLocalError</keyword>
  293           <keyword>UnicodeDecodeError</keyword>
  294           <keyword>UnicodeEncodeError</keyword>
  295           <keyword>UnicodeError</keyword>
  296           <keyword>UnicodeTranslateError</keyword>
  297           <keyword>ValueError</keyword>
  298           <keyword>WindowsError</keyword>
  299           <keyword>ZeroDivisionError</keyword>
  300 
  301           <keyword>Warning</keyword>
  302           <keyword>UserWarning</keyword>
  303           <keyword>DeprecationWarning</keyword>
  304           <keyword>PendingDeprecationWarning</keyword>
  305           <keyword>SyntaxWarning</keyword>
  306           <keyword>OverflowWarning</keyword>
  307           <keyword>RuntimeWarning</keyword>
  308           <keyword>FutureWarning</keyword>
  309         </context>
  310 
  311         <context id="builtin-function" style-ref="builtin-function">
  312           <prefix>(?&lt;![\w\.])</prefix>
  313           <keyword>__import__</keyword>
  314           <keyword>abs</keyword>
  315           <keyword>all</keyword>
  316           <keyword>any</keyword>
  317           <keyword>apply</keyword>
  318           <keyword>basestring</keyword>
  319           <keyword>bool</keyword>
  320           <keyword>buffer</keyword>
  321           <keyword>callable</keyword>
  322           <keyword>chr</keyword>
  323           <keyword>classmethod</keyword>
  324           <keyword>cmp</keyword>
  325           <keyword>coerce</keyword>
  326           <keyword>compile</keyword>
  327           <keyword>complex</keyword>
  328           <keyword>delattr</keyword>
  329           <keyword>dict</keyword>
  330           <keyword>dir</keyword>
  331           <keyword>divmod</keyword>
  332           <keyword>enumerate</keyword>
  333           <keyword>eval</keyword>
  334           <keyword>execfile</keyword>
  335           <keyword>file</keyword>
  336           <keyword>filter</keyword>
  337           <keyword>float</keyword>
  338           <keyword>frozenset</keyword>
  339           <keyword>getattr</keyword>
  340           <keyword>globals</keyword>
  341           <keyword>hasattr</keyword>
  342           <keyword>hash</keyword>
  343           <keyword>hex</keyword>
  344           <keyword>id</keyword>
  345           <keyword>input</keyword>
  346           <keyword>int</keyword>
  347           <keyword>intern</keyword>
  348           <keyword>isinstance</keyword>
  349           <keyword>issubclass</keyword>
  350           <keyword>iter</keyword>
  351           <keyword>len</keyword>
  352           <keyword>list</keyword>
  353           <keyword>locals</keyword>
  354           <keyword>long</keyword>
  355           <keyword>map</keyword>
  356           <keyword>max</keyword>
  357           <keyword>min</keyword>
  358           <keyword>object</keyword>
  359           <keyword>oct</keyword>
  360           <keyword>open</keyword>
  361           <keyword>ord</keyword>
  362           <keyword>pow</keyword>
  363           <keyword>property</keyword>
  364           <keyword>range</keyword>
  365           <keyword>raw_input</keyword>
  366           <keyword>reduce</keyword>
  367           <keyword>reload</keyword>
  368           <keyword>repr</keyword>
  369           <keyword>reversed</keyword>
  370           <keyword>round</keyword>
  371           <keyword>setattr</keyword>
  372           <keyword>set</keyword>
  373           <keyword>slice</keyword>
  374           <keyword>sorted</keyword>
  375           <keyword>staticmethod</keyword>
  376           <keyword>str</keyword>
  377           <keyword>sum</keyword>
  378           <keyword>super</keyword>
  379           <keyword>tuple</keyword>
  380           <keyword>type</keyword>
  381           <keyword>unichr</keyword>
  382           <keyword>unicode</keyword>
  383           <keyword>vars</keyword>
  384           <keyword>xrange</keyword>
  385           <keyword>zip</keyword>
  386         </context>
  387       </include>
  388     </context>
  389   </definitions>
  390 </language>