gtksourceview r1853 - in trunk: . gtksourceview/language-specs



Author: muntyan
Date: Sun Jan 20 18:52:22 2008
New Revision: 1853
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=1853&view=rev

Log:
2000-01-20  Yevgen Muntyan  <muntyan tamu edu>

	* gtksourceview/language-specs/forth.lang: new lang file,
	for Forth programming language, by Jens-Hanno Schwalm (#504730).
	* gtksourceview/language-specs/Makefile.am:
	* gtksourceview/language-specs/testfiles.sh:
	added it.



Added:
   trunk/gtksourceview/language-specs/forth.lang
Modified:
   trunk/ChangeLog
   trunk/gtksourceview/language-specs/Makefile.am
   trunk/gtksourceview/language-specs/testfiles.sh

Modified: trunk/gtksourceview/language-specs/Makefile.am
==============================================================================
--- trunk/gtksourceview/language-specs/Makefile.am	(original)
+++ trunk/gtksourceview/language-specs/Makefile.am	Sun Jan 20 18:52:22 2008
@@ -18,6 +18,7 @@
 	dpatch.lang		\
 	dtd.lang		\
 	erlang.lang		\
+	forth.lang		\
 	fortran.lang		\
 	gap.lang		\
 	gtk-doc.lang		\

Added: trunk/gtksourceview/language-specs/forth.lang
==============================================================================
--- (empty file)
+++ trunk/gtksourceview/language-specs/forth.lang	Sun Jan 20 18:52:22 2008
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Author: Jens-Hanno Schwalm  <hanno schwalm-bremen de>
+ Copyright (C) 2007 Jens-Hanno Schwalm; <hanno schwalm-bremen de>
+
+ 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="forth" _name="Forth" version="2.0" _section="Sources">
+  <metadata>
+    <property name="mimetypes">text/x-forth</property>
+    <property name="globs">*.frt;*.fs</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="string"        _name="String"        map-to="def:string"/>
+    <style id="preprocessor"  _name="Preprocessor"  map-to="def:preprocessor"/>
+    <style id="keyword"       _name="Keyword"       map-to="def:statement"/>
+    <style id="type"          _name="Data Type"     map-to="def:type"/>
+    <style id="number"        _name="Number"        map-to="def:decimal"/>
+    <style id="debugs"        _name="Debug Code"    map-to="def:comment"/>
+    <style id="error"         _name="Error text"    map-to="def:error"/>
+    <style id="compiler"      _name="Compiler opt"  map-to="def:identifier"/>
+  </styles>
+
+  <default-regex-options case-sensitive="false"/>
+
+  <definitions>
+    <context id="forth">
+      <include>
+        <!--        single line comments                        \        \G        -->
+        <context id="comment" style-ref="comment" end-at-line-end="true">
+          <start>(?&lt;![^\s])(\\|--|\\G)(?![^\s])</start>
+          <include>
+            <context ref="def:in-line-comment"/>
+          </include>
+        </context>
+
+        <!--        multiline comments ending with ")"        (        (S        (F        -->
+        <context id="comment-multiline" style-ref="comment">
+          <start>(?&lt;![^\s])(\(|\(S|\(F)(?![^\s])</start>
+          <end>\)</end>
+          <include>
+            <context ref="def:in-comment"/>
+          </include>
+        </context>
+
+        <!--        multiline comment (* ....*)        -->
+        <context id="comment-multiline2" style-ref="comment">
+          <start>(?&lt;![^\s])\(\*(?![^\s])</start>
+          <end>\*\)(?![^\s])</end>
+          <include>
+            <context ref="def:in-comment"/>
+          </include>
+        </context>
+
+        <!--        multiline comment DOC ... ENDDOC        -->
+        <context id="comment-multiline3" style-ref="comment">
+          <start>(?&lt;![^\s])DOC(?![^\s])</start>
+          <end>(?&lt;![^\s])ENDDOC(?![^\s])</end>
+          <include>
+            <context ref="def:in-comment"/>
+          </include>
+        </context>
+
+        <!--        preprocessor instructions followed by a string        -->
+        <context id="preproc1" style-ref="preprocessor">
+          <match extended="true">
+            (?&lt;![^\s])
+            (NEEDS|INCLUDE|IN|MARKER)\s+[^\s]*
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        REVISION instruction is followed by a filename plus a string between "..."        -->
+        <context id="preproc2" style-ref="preprocessor">
+          <match extended="true">
+            (?&lt;![^\s])
+            (REVISION)\s+[^\s]*\s*".*"
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        preprocessor instructions        -->
+        <context id="preproc3" style-ref="preprocessor">
+          <match extended="true">
+            (?&lt;![^\s])
+            (INCLUDED|INCLUDE-FILE)
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        all defining or compiler extension words are followed by another whitespace delinited word        -->
+        <context id="definers" style-ref="type">
+          <match extended="true">
+            (?&lt;![^\s])
+            (POSTPONE|\[COMPILE\]|\[CHAR\]|\['\]|COMPILE|CHAR|VALUE|DVALUE|FVALUE|VARIABLE|DVARIABLE|FVARIABLE|USER|CODE|LOCAL|DLOCAL|
+            FLOCAL|CONSTANT|DCONSTANT|FCONSTANT|=\:|==\:|DEFER|V\:|\:|H\:|T\:|M\:)\s+[^\s]+
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        the grouped local words like LOCALS| read words until a last |        -->
+        <context id="locals" style-ref="type">
+          <match extended="true">
+            (?&lt;![^\s])
+            (LOCALS|DLOCALS|FLOCALS)\|\s+[^\|]+[\|]
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        strings ended by a "                S"        ."        EVAL"        C"        Z"        -->
+        <context id="string" style-ref="string" end-at-line-end="true">
+          <start>(?&lt;![^\s])(S|[.]|EVAL|C|Z|,)"\s</start>
+          <end>"</end>
+         </context>
+
+        <!--        strings ended by a ~ character when " is inside a string:        .~        -->
+        <context id="string2" style-ref="string" end-at-line-end="true">
+          <start>(?&lt;![^\s])(.~)\s</start>
+          <end>~</end>
+         </context>
+
+        <!--        comment string  .( ..)        -->
+        <context id="string3" style-ref="string" end-at-line-end="true">
+          <start>(?&lt;![^\s])[.]\(\s</start>
+          <end>\)</end>
+         </context>
+
+        <!--        error strings ending with "                ABORT"        ?ERROR"        -->
+        <context id="errorstring" style-ref="error" end-at-line-end="true">
+          <start>(?&lt;![^\s])(ABORT|\?ERROR)"\s</start>
+          <end>"</end>
+         </context>
+
+        <!--        represent numbers including the hex, decimal and binary prefixes, also short characters        -->
+        <context id="number" style-ref="number">
+          <match extended="true">
+            (?&lt;![^\s])
+            ([$][-+]?[A-F0-9.]+ |
+             [#][-+]?[0-9.]+ |
+             [%][-+]?[0-1.]+ |
+             [-+]?[0-9.]+ |
+             [-+]?[0-9]+[.]?[0-9]*[eE][0-9]* |
+             '[^\s]' |
+             [\^][A-Za-z] |
+             TRUE |
+             FALSE)
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        Control flow Keywords -->
+        <context id="keywords" style-ref="keyword">
+          <match extended="true">
+            (?&lt;![^\s])
+            (\[IF\]|\[ELSE\]|\[THEN\]|\[DEFINED\]|\[UNDEFINED\]|\?DEF|\?UNDEF|THROW|CASE|ENDCASE|OF|ENDOF|FOR|NEXT|
+                    IF|ELSE|THEN|ENDIF|BEGIN|WHILE|REPEAT|UNTIL|AGAIN|DO|LOOP|\?DO|\+LOOP|LEAVE|\?LEAVE|UNLOOP|EXIT|\?EXIT|
+                    PAR|ENDPAR|STARTP|ENDP)
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        Compiler modifications -->
+        <context id="keywords2" style-ref="compiler">
+          <match extended="true">
+            (?&lt;![^\s])
+            (PRIVATE|PRIVATES|DEPRIVE|FORGET|IMMEDIATE|ALSO|ONLY|FORTH|DEFINITIONS|HEADERLESS)
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        Defining keywords without displaying the following word        -->
+        <context id="keywords3" style-ref="type">
+          <match extended="true">
+            (?&lt;![^\s])
+            (\:ABOUT|DOES>|FORGET>|CREATE|\:NONAME)
+            (?![^\s])
+          </match>
+        </context>
+
+        <!--        <<DEBUG        ..... DEBUG>> -->
+        <context id="comment-debug" extend-parent="false" style-ref="debugs">
+          <start>(?&lt;![^\s])(&lt;&lt;DEBUG)(?![^\s])</start>
+          <end>(?&lt;![^\s])(DEBUG>>)(?![^\s])</end>
+          <include>
+            <context ref="keywords"/>
+            <context ref="keywords2"/>
+            <context ref="keywords3"/>
+            <context ref="number"/>
+            <context ref="comment"/>
+            <context ref="string" />
+            <context ref="string2" />
+            <context ref="string3" />
+            <context ref="errorstring" />
+            <context ref="locals" />
+            <context ref="definers" />
+            <context ref="comment-multiline"/>
+          </include>
+        </context>
+
+        <!--        [ ... ] is displayed as a preprocessor structure        -->
+        <context id="preproc4" extend-parent="true" style-ref="preprocessor">
+          <start>(?&lt;![^\s])(\[)(?![^\s])</start>
+          <end>(?&lt;![^\s])(\])(?![^\s])</end>
+          <include>
+            <context ref="keywords"/>
+            <context ref="number"/>
+            <context ref="comment"/>
+            <context ref="comment-multiline"/>
+          </include>
+        </context>
+      </include>
+    </context>
+  </definitions>
+</language>
\ No newline at end of file

Modified: trunk/gtksourceview/language-specs/testfiles.sh
==============================================================================
--- trunk/gtksourceview/language-specs/testfiles.sh	(original)
+++ trunk/gtksourceview/language-specs/testfiles.sh	Sun Jan 20 18:52:22 2008
@@ -14,6 +14,17 @@
 dir="testdir"
 mkdir -p $dir/
 
+cat > $dir/file.frt <<EOFEOF
+\ gtk-source-lang: forth
+-- comment
+(* comment! 
+  here still comment
+*)
+NEEDS something
+IF 0 THEN ENDIF
+Numbers: 1234 $233 #345325 %01000
+EOFEOF
+
 cat > $dir/file.testv1 <<EOFEOF
 // gtk-source-lang: testv1
 // comment



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