[gtksourceview] Added OOC language. Bug #608598.



commit b1e212ffbaf923bf0734c72b2c904be6af91ae8b
Author: Amos Wenger aka nddrylliog <amoswenger gmail com>
Date:   Mon Feb 1 11:45:32 2010 +0100

    Added OOC language. Bug #608598.

 gtksourceview/language-specs/Makefile.am  |    3 +-
 gtksourceview/language-specs/ooc.lang     |  264 +++++++++++++++++++++++++++++
 gtksourceview/language-specs/testfiles.sh |   13 ++
 3 files changed, 279 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/language-specs/Makefile.am b/gtksourceview/language-specs/Makefile.am
index d6ebf63..7b06c20 100644
--- a/gtksourceview/language-specs/Makefile.am
+++ b/gtksourceview/language-specs/Makefile.am
@@ -47,7 +47,7 @@ LANGUAGES =			\
 	lua.lang		\
 	m4.lang			\
 	makefile.lang		\
-	mallard.lang	\
+	mallard.lang		\
 	msil.lang		\
 	nemerle.lang		\
 	nsis.lang		\
@@ -55,6 +55,7 @@ LANGUAGES =			\
 	ocaml.lang		\
 	ocl.lang		\
 	octave.lang		\
+	ooc.lang		\
 	pascal.lang		\
 	perl.lang		\
 	php.lang		\
diff --git a/gtksourceview/language-specs/ooc.lang b/gtksourceview/language-specs/ooc.lang
new file mode 100644
index 0000000..868bb32
--- /dev/null
+++ b/gtksourceview/language-specs/ooc.lang
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Author: Amos Wenger aka nddrylliog <amoswenger gmail com>
+ Copyright (C) 2010 Amos Wenger aka nddrylliog <amoswenger gmail com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+-->
+<language id="ooc" _name="OOC" version="2.0" _section="Sources">
+  <metadata>
+    <property name="globs">*.ooc</property>
+    <property name="line-comment-start">//</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <styles>
+    <style id="comment"           _name="Comment"                  map-to="def:comment"/>
+    <style id="error"             _name="Error"                    map-to="def:error"/>
+    <style id="escaped-character" _name="Escaped Character"        map-to="def:special-char"/>
+    <style id="string"            _name="String"                   map-to="def:string"/>
+    <style id="external"          _name="External"                 map-to="def:preprocessor"/>
+    <style id="declaration"       _name="Declaration"              map-to="def:type"/>
+    <style id="storage-class"     _name="Storage Class"            map-to="def:type"/>
+    <style id="scope-declaration" _name="Scope Declaration"        map-to="def:type"/>
+    <style id="keyword"           _name="Keyword"                  map-to="def:keyword"/>
+    <style id="null-value"        _name="Null Value"               map-to="def:special-constant"/>
+    <style id="boolean"           _name="Boolean value"            map-to="def:boolean"/>
+    <style id="floating-point"    _name="Floating point number"    map-to="def:floating-point"/>
+    <style id="decimal"           _name="Decimal number"           map-to="def:decimal"/>
+    <style id="octal"             _name="Octal number"             map-to="def:base-n-integer"/>
+    <style id="hexadecimal"       _name="Hexadecimal number"       map-to="def:base-n-integer"/>
+    <style id="reserved"          _name="Future Reserved Keywords" map-to="def:error"/>
+    <style id="type"              _name="Data Type"                map-to="def:type"/>
+  </styles>
+
+  <definitions>
+
+    <define-regex id="escaped-character" extended="true">
+      \\(               # leading backslash
+      [\\\"\'nrbtf] |   # escaped character
+      [0-9]{1,3}    |   # latin encoded char
+      u[0-9]{1,4}       # unicode char
+      )
+    </define-regex>
+
+    <context id="string" style-ref="string" end-at-line-end="false">
+      <start>"</start>
+      <end>"</end>
+      <include>
+        <context id="escaped-character" style-ref="escaped-character">
+          <match>\%{escaped-character}</match>
+        </context>
+      </include>
+    </context>
+
+    <context id="line-comment" style-ref="comment" end-at-line-end="true">
+      <start>//</start>
+      <include>
+        <context ref="def:in-line-comment"/>
+      </include>
+    </context>
+
+    <context id="block-comment" style-ref="comment">
+      <start>/\*</start>
+      <end>\*/</end>
+      <include>
+        <context ref="def:in-comment"/>
+      </include>
+    </context>
+
+    <context id="close-comment-outside-comment" style-ref="error">
+      <match>\*/(?!\*)</match>
+    </context>
+
+    <context id="externals" style-ref="external">
+      <keyword>import</keyword>
+      <keyword>include</keyword>
+      <keyword>use</keyword>
+    </context>
+
+    <context id="declarations" style-ref="declaration">
+      <keyword>class</keyword>
+      <keyword>cover</keyword>
+      <keyword>func</keyword>
+      <keyword>implement</keyword>
+      <keyword>interface</keyword>
+      <keyword>operator</keyword>
+    </context>
+
+    <context id="primitive-types" style-ref="type">
+      <keyword>Int</keyword>
+      <keyword>Int8</keyword>
+      <keyword>Int16</keyword>
+      <keyword>Int32</keyword>
+      <keyword>Int64</keyword>
+      <keyword>Int80</keyword>
+      <keyword>Int128</keyword>
+    
+      <keyword>UInt</keyword>
+      <keyword>UInt8</keyword>
+      <keyword>UInt16</keyword>
+      <keyword>UInt32</keyword>
+      <keyword>UInt64</keyword>
+      <keyword>UInt80</keyword>
+      <keyword>UInt128</keyword>
+    
+      <keyword>Octet</keyword>
+      <keyword>Short</keyword>
+      <keyword>UShort</keyword>
+      <keyword>Long</keyword>
+      <keyword>ULong</keyword>
+      <keyword>LLong</keyword>
+      <keyword>ULLong</keyword>
+    
+      <keyword>Float</keyword>
+      <keyword>Double</keyword>
+      <keyword>LDouble</keyword>
+      <keyword>Float32</keyword>
+      <keyword>Float64</keyword>
+      <keyword>Float128</keyword>
+      
+      <keyword>Char</keyword>
+      <keyword>UChar</keyword>
+      <keyword>SChar</keyword>
+      <keyword>WChar</keyword>
+      <keyword>String</keyword>
+     
+      <keyword>Void</keyword>
+      <keyword>Pointer</keyword>
+      <keyword>Bool</keyword>
+      <keyword>SizeT</keyword>
+      <keyword>This</keyword>
+    </context>
+
+    <context id="storage-class" style-ref="storage-class">
+      <keyword>abstract</keyword>
+      <keyword>static</keyword>
+      <keyword>final</keyword>
+      <keyword>extern</keyword>
+      <keyword>const</keyword>
+      <keyword>proto</keyword>
+    </context>
+
+    <context id="scope-declarations" style-ref="scope-declaration">
+      <keyword>private</keyword>
+      <keyword>protected</keyword>
+      <keyword>public</keyword>
+      <keyword>internal</keyword>
+    </context>
+
+    <context id="flow" style-ref="keyword">
+      <keyword>as</keyword>
+      <keyword>break</keyword>
+      <keyword>continue</keyword>
+      <keyword>else</keyword>
+      <keyword>fallthrough</keyword>
+      <keyword>finally</keyword>
+      <keyword>for</keyword>
+      <keyword>if</keyword>
+      <keyword>match</keyword>
+      <keyword>return</keyword>
+      <keyword>while</keyword>
+    </context>
+
+    <context id="memory" style-ref="keyword">
+      <keyword>new</keyword>
+      <keyword>this</keyword>
+    </context>
+
+    <context id="future-reserved-words" style-ref="reserved">
+      <keyword>catch</keyword>
+      <keyword>const</keyword>
+      <keyword>goto</keyword>
+      <keyword>finally</keyword>
+      <keyword>throw</keyword>
+      <keyword>try</keyword>
+      <keyword>with</keyword>
+      <keyword>scope</keyword>
+    </context>
+
+    <context id="null-value" style-ref="null-value">
+      <keyword>null</keyword>
+    </context>
+
+    <context id="boolean" style-ref="boolean">
+      <keyword>false</keyword>
+      <keyword>true</keyword>
+    </context>
+
+    <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
+    <context id="float" style-ref="floating-point">
+        <match extended="true">
+            (?&lt;![\w\.])
+            ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
+             ([0-9]+[Ee][+-]?[0-9]*))
+            [fFlL]?
+            (?![\w\.])
+        </match>
+    </context>
+
+    <context id="hexadecimal" style-ref="hexadecimal">
+        <match extended="true">
+            (?&lt;![\w\.])
+            0[xX][a-fA-F0-9]+[uUlL]*
+            (?![\w\.])
+        </match>
+    </context>
+
+    <context id="octal" style-ref="octal">
+        <match extended="true">
+            (?&lt;![\w\.])
+            0[cC][0-7]+[uUlL]*
+            (?![\w\.])
+        </match>
+    </context>
+
+    <context id="decimal" style-ref="decimal">
+        <match extended="true">
+            (?&lt;![\w\.])
+            [0-9]+[uUlL]*
+            (?![\w\.])
+        </match>
+    </context>
+
+    <context id="ooc">
+      <include>
+        <context ref="string"/>
+        <context ref="line-comment"/>
+        <context ref="block-comment"/>
+        <context ref="close-comment-outside-comment"/>
+        <context ref="externals"/>
+        <context ref="declarations"/>
+        <context ref="primitive-types"/>
+        <context ref="storage-class"/>
+        <context ref="scope-declarations"/>
+        <context ref="flow"/>
+        <context ref="memory"/>
+        <context ref="future-reserved-words"/>
+        <context ref="null-value"/>
+        <context ref="boolean"/>
+        <context ref="decimal"/>
+        <context ref="hexadecimal"/>
+        <context ref="octal"/>
+        <context ref="float"/>
+      </include>
+    </context>
+
+  </definitions>
+</language>
diff --git a/gtksourceview/language-specs/testfiles.sh b/gtksourceview/language-specs/testfiles.sh
index ef3aad5..3c91713 100755
--- a/gtksourceview/language-specs/testfiles.sh
+++ b/gtksourceview/language-specs/testfiles.sh
@@ -15,6 +15,19 @@
 dir="testdir"
 mkdir -p $dir/
 
+cat > $dir/file.ooc << EOFEOF
+import structs/[ArrayList, LinkedList], io/FileReader
+include stdarg, memory, string
+use sdl, gtk
+pi := const 3.14
+Int: cover from int {
+    toString: func -> String { "%d" format() }
+}
+Dog: class extends Animal {
+    barf: func { ("woof! " * 2) println() }
+}
+EOFEOF
+
 cat > $dir/file.bib << EOFEOF
 %A .bib file might contain the following entry, which describes a mathematical handbook
 @Book{abramowitz+stegun,



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