[gtksourceview] Add Scilab lang file.



commit a8fbb8ab2d3267d67f67b696087176ce22e0b10d
Author: Sylvestre Ledru <sylvestre ledru scilab org>
Date:   Thu Sep 23 17:27:18 2010 +0200

    Add Scilab lang file.

 data/language-specs/Makefile.am |    1 +
 data/language-specs/scilab.lang |  209 +++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                  |    1 +
 tests/testfiles.sh              |   17 +++
 4 files changed, 228 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index fb8dfec..33d92ad 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -70,6 +70,7 @@ LANGUAGES =			\
 	rpmspec.lang		\
 	ruby.lang		\
 	scheme.lang		\
+	scilab.lang		\
 	sh.lang			\
 	sparql.lang		\
 	sql.lang		\
diff --git a/data/language-specs/scilab.lang b/data/language-specs/scilab.lang
new file mode 100644
index 0000000..3d940b7
--- /dev/null
+++ b/data/language-specs/scilab.lang
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView.
+
+ Authors: Sylvestre Ledru
+ Copyright (C) 2010 Sylvestre Ledru <sylvestre ledru scilab org>
+
+ 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="scilab" _name="Scilab" version="2.0" _section="Scientific">
+  <metadata>
+    <property name="globs">*.sce;*.sci</property>
+    <property name="line-comment-start">//</property>
+  </metadata>
+
+  <styles>
+    <style id="comment"           _name="Comment"           map-to="def:comment"/>
+    <style id="floating-point"    _name="Floating Point"    map-to="def:floating-point"/>
+    <style id="string"            _name="String"            map-to="def:string"/>
+    <style id="keyword"           _name="Keyword"           map-to="def:keyword"/>
+    <style id="base-n-integer"    _name="Base-N Integer"    map-to="def:base-n-integer"/>
+    <style id="function"          _name="Function"          map-to="def:function"/>
+    <style id="decimal"           _name="Decimal"           map-to="def:decimal"/>
+    <style id="boolean"           _name="Boolean"           map-to="def:boolean"/>
+    <style id="reserved-constant" _name="Reserved Constant" map-to="def:special-constant"/>
+  </styles>
+
+  <definitions>
+
+    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
+      <start>//</start>
+      <include>
+        <context ref="def:in-comment"/>
+      </include>
+    </context>
+
+    <context id="double-quoted-string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
+      <start>"</start>
+      <end>"</end>
+      <include>
+        <context ref="def:escape"/>
+        <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">
+      <!--
+       To do not misdetect the transpose operator ' as the start of a string
+       we assert to not follow a variable name (letters, digits and underscores)
+       or a closing bracket (round, square or curly) or a dot (to form the
+       array transpose operator ".'" ). -->
+      <start>(?&lt;![0-9a-zA-Z_)\]}\.])'</start>
+      <end>'</end>
+      <include>
+        <context style-ref="def:special-char">
+          <match>''</match>
+        </context>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
+    <context id="boolean" style-ref="boolean">
+      <keyword>%f</keyword>
+      <keyword>%F</keyword>
+      <keyword>%t</keyword>
+      <keyword>%T</keyword>
+    </context>
+
+    <context id="reserved-constant" style-ref="reserved-constant">
+      <keyword>%pi</keyword>
+      <keyword>%eps</keyword>
+      <keyword>%inf</keyword>
+      <keyword>%nan</keyword>
+      <keyword>%e</keyword>
+      <keyword>%i</keyword>
+      <keyword>%z</keyword>
+      <keyword>%s</keyword>
+    </context>
+
+    <context id="keyword" style-ref="keyword">
+      <keyword>abort</keyword>
+      <keyword>break</keyword>
+      <keyword>case</keyword>
+      <keyword>catch</keyword>
+      <keyword>continue</keyword>
+      <keyword>do</keyword>
+      <keyword>elseif</keyword>
+      <keyword>else</keyword>
+      <keyword>endfunction</keyword>
+      <keyword>end</keyword>
+      <keyword>for</keyword>
+      <keyword>function</keyword>
+      <keyword>#function</keyword>
+      <keyword>global</keyword>
+      <keyword>hidden</keyword>
+      <keyword>if</keyword>
+      <keyword>otherwise</keyword>
+      <keyword>return</keyword>
+      <keyword>select</keyword>
+      <keyword>switch</keyword>
+      <keyword>try</keyword>
+      <keyword>while</keyword>
+    </context>
+
+    <context id="decimal" style-ref="decimal">
+      <match>\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
+    </context>
+
+    <context id="floating-point-number" style-ref="floating-point">
+      <match>\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?</match>
+    </context>
+
+    <context id="octal-number" style-ref="base-n-integer">
+      <match>\b0[0-7]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
+    </context>
+
+    <context id="hex-number" style-ref="base-n-integer">
+      <match>\b0[xX][0-9a-fA-F]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
+    </context>
+
+    <context id="function" style-ref="function">
+      <keyword>abs</keyword>
+      <keyword>and</keyword>
+      <keyword>acos</keyword>
+      <keyword>asin</keyword>
+      <keyword>atan</keyword>
+      <keyword>ceil</keyword>
+      <keyword>clearglobal</keyword>
+      <keyword>cosh</keyword>
+      <keyword>cos</keyword>
+      <keyword>cumprod</keyword>
+      <keyword>error</keyword>
+      <keyword>exec</keyword>
+      <keyword>gettext</keyword>
+      <keyword>floor</keyword>
+      <keyword>fprintf</keyword>
+      <keyword>fread</keyword>
+      <keyword>fsolve</keyword>
+      <keyword>imag</keyword>
+      <keyword>isdef</keyword>
+      <keyword>isempty</keyword>
+      <keyword>isinf</keyword>
+      <keyword>isnan</keyword>
+      <keyword>isvector</keyword>
+      <keyword>length</keyword>
+      <keyword>load</keyword>
+      <keyword>linspace</keyword>
+      <keyword>list</keyword>
+      <keyword>log10</keyword>
+      <keyword>log2</keyword>
+      <keyword>log</keyword>
+      <keyword>max</keyword>
+      <keyword>min</keyword>
+      <keyword>msprintf</keyword>
+      <keyword>mclose</keyword>
+      <keyword>mopen</keyword>
+      <keyword>ones</keyword>
+      <keyword>or</keyword>
+      <keyword>printf</keyword>
+      <keyword>prod</keyword>
+      <keyword>real</keyword>
+      <keyword>round</keyword>
+      <keyword>sinh</keyword>
+      <keyword>sin</keyword>
+      <keyword>size</keyword>
+      <keyword>gsort</keyword>
+      <keyword>sprintf</keyword>
+      <keyword>sqrt</keyword>
+      <keyword>strcat</keyword>
+      <keyword>strcmp</keyword>
+      <keyword>sum</keyword>
+      <keyword>system</keyword>
+      <keyword>tanh</keyword>
+      <keyword>tan</keyword>
+      <keyword>warning</keyword>
+      <keyword>zeros</keyword>
+    </context>
+
+    <context id="scilab" class="no-spell-check">
+      <include>
+        <context ref="line-comment"/>
+        <context ref="double-quoted-string"/>
+        <context ref="single-quoted-string"/>
+        <context ref="boolean"/>
+        <context ref="reserved-constant"/>
+        <context ref="keyword"/>
+        <context ref="decimal"/>
+        <context ref="floating-point-number"/>
+        <context ref="octal-number"/>
+        <context ref="hex-number"/>
+        <context ref="function"/>
+      </include>
+    </context>
+  </definitions>
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7b66381..a83ac8b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -68,6 +68,7 @@ data/language-specs/R.lang
 data/language-specs/rpmspec.lang
 data/language-specs/ruby.lang
 data/language-specs/scheme.lang
+data/language-specs/scilab.lang
 data/language-specs/sh.lang
 data/language-specs/sparql.lang
 data/language-specs/sql.lang
diff --git a/tests/testfiles.sh b/tests/testfiles.sh
index ae4ce6b..dd47ef1 100755
--- a/tests/testfiles.sh
+++ b/tests/testfiles.sh
@@ -15,6 +15,23 @@
 dir="testdir"
 mkdir -p $dir/
 
+cat > $dir/file.sci << EOFEOF
+// A comment with whites and tabulations 		
+// Scilab editor: http://www.scilab.org/
+
+function [a, b] = myfunction(d, e, f)
+	a = 2.71828 + %pi + f($, :);
+	b = cos(a) + cosh(a);
+	if d == e then
+		b = 10 - e.field;
+	else
+		b = "		test     " + home
+		return
+	end
+	myvar = 1.23e-45;
+endfunction
+EOFEOF
+
 cat > $dir/file.cob << EOFEOF
        IDENTIFICATION DIVISION.
        PROGRAM-ID. Age.



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