[gtksourceview] Add python3 language file.



commit 5dfc410de89977c7d9e53bf1aa096552f82d57b5
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Feb 4 14:54:44 2012 +0100

    Add python3 language file.
    
    Patch by Stefano Palazzo, bug #668136.

 data/language-specs/Makefile.am  |    1 +
 data/language-specs/python3.lang |  192 ++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                   |    1 +
 3 files changed, 194 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index 9b4c152..f72025e 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -73,6 +73,7 @@ LANGUAGES =			\
 	pkgconfig.lang		\
 	po.lang			\
 	python.lang		\
+	python3.lang		\
 	prolog.lang		\
 	protobuf.lang		\
 	R.lang			\
diff --git a/data/language-specs/python3.lang b/data/language-specs/python3.lang
new file mode 100644
index 0000000..ea47714
--- /dev/null
+++ b/data/language-specs/python3.lang
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView
+
+ Author: Stefano Palazzo <stefano-palazzo ubuntu com>
+ Copyright (C) 2012 Stefano Palazzo <stefano-palazzo ubuntu com>
+
+ GtkSourceView is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ GtkSourceView is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+-->
+<language id="python3" _name="Python 3" version="2.0" _section="Scripts">
+  <metadata>
+    <property name="globs">*.py3</property>
+    <property name="line-comment-start">#</property>
+  </metadata>
+
+  <styles>
+    <style id="module-handler"    _name="Module Handler"        map-to="python:module-handler"/>
+    <style id="keyword"           _name="Keyword"               map-to="python:keyword"/>
+    <style id="multiline-string"  _name="Multiline string"      map-to="python:multiline-string"/>
+    <style id="string"            _name="String"                map-to="python:string"/>
+    <style id="escaped-char"      _name="Escaped Character"     map-to="python:escaped-char"/>
+    <style id="format"            _name="Format"                map-to="python:format"/>
+    <style id="special-variable"  _name="Special Variable"      map-to="python:special-variable"/>
+    <style id="boolean"           _name="Boolean"               map-to="python:boolean"/>
+    <style id="floating-point"    _name="Floating point number" map-to="python:floating-point"/>
+    <style id="decimal"           _name="Decimal number"        map-to="python:decimal"/>
+    <style id="base-n-integer"    _name="Base-N number"         map-to="python:base-n-integer"/>
+    <style id="complex"           _name="Complex number"        map-to="python:complex"/>
+    <style id="builtin-constant"  _name="Builtin Constant"      map-to="python:builtin-constant"/>
+    <style id="builtin-object"    _name="Builtin Object"        map-to="python:builtin-object"/>
+    <style id="builtin-function"  _name="Builtin Function"      map-to="python:builtin-function"/>
+  </styles>
+
+  <definitions>
+    <define-regex id="identifier">[_a-zA-Z][_a-zA-Z0-9]*</define-regex>
+    <define-regex id="number">[1-9][0-9]*</define-regex>
+
+
+    <define-regex id="string-prefix">(b|B)?</define-regex>
+    <define-regex id="raw-string-prefix">(r|R|rb|RB|rB|Rb|br|BR|bR|Br)</define-regex>
+
+    <context id="multiline-double-quoted-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
+      <start>\%{string-prefix}"""</start>
+      <end>"""</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="python:escaped-char"/>
+      </include>
+    </context>
+
+    <context id="multiline-single-quoted-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
+      <start>\%{string-prefix}'''</start>
+      <end>'''</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="python:escaped-char"/>
+      </include>
+    </context>
+
+    <context id="double-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
+      <start>\%{string-prefix}"</start>
+      <end>"</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="python:escaped-char"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="single-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
+      <start>\%{string-prefix}'</start>
+      <end>'</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="python:escaped-char"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="multiline-double-quoted-raw-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
+      <start>\%{raw-string-prefix}"""</start>
+      <end>"""</end>
+      <include>
+        <context ref="python:format"/>
+      </include>
+    </context>
+
+    <context id="multiline-single-quoted-raw-string" style-ref="multiline-string" class="string" class-disabled="no-spell-check">
+      <start>\%{raw-string-prefix}'''</start>
+      <end>'''</end>
+      <include>
+        <context ref="python:format"/>
+      </include>
+    </context>
+
+    <context id="double-quoted-raw-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
+      <start>\%{raw-string-prefix}"</start>
+      <end>"</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="single-quoted-raw-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
+      <start>\%{raw-string-prefix}'</start>
+      <end>'</end>
+      <include>
+        <context ref="python:format"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="python3" class="no-spell-check">
+      <include>
+        <context ref="def:shebang"/>
+        <context ref="def:shell-like-comment"/>
+
+        <context ref="multiline-double-quoted-string"/>
+        <context ref="multiline-single-quoted-string"/>
+        <context ref="double-quoted-string"/>
+        <context ref="single-quoted-string"/>
+
+        <context ref="multiline-double-quoted-raw-string"/>
+        <context ref="multiline-single-quoted-raw-string"/>
+        <context ref="double-quoted-raw-string"/>
+        <context ref="single-quoted-raw-string"/>
+
+        <context ref="python:special-variables"/>
+        <context ref="python:boolean"/>
+
+        <context ref="python:complex"/>
+
+        <context ref="python:float"/>
+
+        <context ref="python:decimal"/>
+
+        <context id="binary" style-ref="base-n-integer">
+          <match>(?&lt;![\w\.])0[bB][0-1]+[lL]?(?![\w\.])</match>
+        </context>
+
+        <context id="octal" style-ref="base-n-integer">
+          <match>(?&lt;![\w\.])0[oO][0-7]+[lL]?(?![\w\.])</match>
+        </context>
+
+        <context ref="python:hex"/>
+
+        <context ref="python:module-handler"/>
+
+        <context ref="python:keywords"/>
+        <context id="3x-only-keywords" style-ref="keyword">
+          <keyword>nonlocal</keyword>
+        </context>
+
+        <context ref="python:builtin-constants"/>
+        <context ref="python:builtin-objects"/>
+        <context id="3x-only-builtin-objects" style-ref="builtin-object">
+          <prefix>(?&lt;![\w\.])</prefix>
+          <keyword>ResourceWarning</keyword>
+        </context>
+
+        <context ref="python:builtin-functions"/>
+        <context id="3x-only-builtin-functions" style-ref="builtin-function">
+          <prefix>(?&lt;![\w\.])</prefix>
+          <keyword>ascii</keyword>
+          <keyword>bin</keyword>
+          <keyword>bytearray</keyword>
+          <keyword>bytes</keyword>
+          <keyword>exec</keyword>
+          <keyword>format</keyword>
+          <keyword>memoryview</keyword>
+          <keyword>next</keyword>
+          <keyword>print</keyword>
+        </context>
+      </include>
+    </context>
+  </definitions>
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index af092b9..6b1abb2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -73,6 +73,7 @@ data/language-specs/po.lang
 data/language-specs/prolog.lang
 data/language-specs/protobuf.lang
 data/language-specs/python.lang
+data/language-specs/python3.lang
 data/language-specs/R.lang
 data/language-specs/rpmspec.lang
 data/language-specs/ruby.lang



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]