gtksourceview r1861 - in trunk: . gtksourceview/language-specs
- From: muntyan svn gnome org
- To: svn-commits-list gnome org
- Subject: gtksourceview r1861 - in trunk: . gtksourceview/language-specs
- Date: Sun, 27 Jan 2008 07:13:42 +0000 (GMT)
Author: muntyan
Date: Sun Jan 27 07:13:42 2008
New Revision: 1861
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=1861&view=rev
Log:
2008-01-27 Yevgen Muntyan <muntyan tamu edu>
* gtksourceview/language-specs/fortran.lang: highlight floating
point constants properly; highlight BOZ literals (#496781).
* gtksourceview/language-specs/makefile.lang: escaped quote does
not start a string.
* gtksourceview/language-specs/sh.lang: def:escape is wrong in
shell strings; highlight $! (Luca Cavalli, #512141).
* gtksourceview/language-specs/lua.lang: properly highlight escaped
characters in strings.
* gtksourceview/language-specs/forth.lang: updated.
* gtksourceview/language-specs/testfiles.sh: added a fortran file.
* gtksourceview/language-specs/kate.xml: nicer def:constant color.
Modified:
trunk/ChangeLog
trunk/gtksourceview/language-specs/forth.lang
trunk/gtksourceview/language-specs/fortran.lang
trunk/gtksourceview/language-specs/kate.xml
trunk/gtksourceview/language-specs/lua.lang
trunk/gtksourceview/language-specs/makefile.lang
trunk/gtksourceview/language-specs/sh.lang
trunk/gtksourceview/language-specs/testfiles.sh
Modified: trunk/gtksourceview/language-specs/forth.lang
==============================================================================
--- trunk/gtksourceview/language-specs/forth.lang (original)
+++ trunk/gtksourceview/language-specs/forth.lang Sun Jan 27 07:13:42 2008
@@ -112,8 +112,8 @@
<context id="definers" style-ref="type">
<match extended="true">
(?<![^\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]+
+ (POSTPONE|\[COMPILE\]|\[CHAR\]|\['\]|COMPILE|CHAR|[DFT]?VALUE|[2FT]?VARIABLE|[DS]?FVARIABLE|[T]?USER|[T]?CODE|[DZFT]?LOCAL|
+ [2FT]?CONSTANT|TCONSTANT-|TSUB|=\:|==\:|DEFER|HC\:|[VHTM]?\:)\s+[^\s]+
(?![^\s])
</match>
</context>
@@ -122,7 +122,7 @@
<context id="locals" style-ref="type">
<match extended="true">
(?<![^\s])
- (LOCALS|DLOCALS|FLOCALS)\|\s+[^\|]+[\|]
+ ([DFZ]?LOCALS)\|\s+[^\|]+[\|]
(?![^\s])
</match>
</context>
@@ -173,7 +173,7 @@
<match extended="true">
(?<![^\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|
+ IF[,]?|ELSE[,]?|THEN[,]?|ENDIF[,]?|BEGIN[,]?|WHILE[,]?|REPEAT[,]?|UNTIL[,]?|AGAIN[,]?|DO|LOOP|\?DO|\+LOOP|LEAVE|\?LEAVE|UNLOOP|EXIT|\?EXIT|
PAR|ENDPAR|STARTP|ENDP)
(?![^\s])
</match>
@@ -231,4 +231,4 @@
</include>
</context>
</definitions>
-</language>
\ No newline at end of file
+</language>
Modified: trunk/gtksourceview/language-specs/fortran.lang
==============================================================================
--- trunk/gtksourceview/language-specs/fortran.lang (original)
+++ trunk/gtksourceview/language-specs/fortran.lang Sun Jan 27 07:13:42 2008
@@ -32,7 +32,7 @@
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="floating-point" _name="Floating Point" map-to="def:floating-point"/>
<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="boz-literal" _name="BOZ Literal" map-to="def:base-n-integer"/>
<style id="decimal" _name="Decimal" map-to="def:decimal"/>
<style id="type" _name="Data Type" map-to="def:type"/>
</styles>
@@ -380,24 +380,37 @@
<keyword>allocatable</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>
+ <match extended="true">
+ (?<![\w\.])
+ [+-]?
+ ((\.[0-9]+ | [0-9]+\.[0-9]*) ([ed][+-]?[0-9]*)? |
+ ([0-9]+[ed][+-]?[0-9]*))
+ (?![\w\.])
+ </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 id="decimal" style-ref="decimal">
+ <match extended="true">
+ (?<![\w\.])
+ [+-]? ([1-9][0-9]*|0)
+ (?![\w\.])
+ </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 id="boz-literal" style-ref="boz-literal">
+ <match extended="true">
+ \bb'[01]+'|\bb"[01]+"|
+ \bo'[0-7]+'|\bo"[0-7]+"|
+ \bz'[0-9a-f]+'|\bz"[0-9a-f]+"
+ </match>
</context>
<context id="fortran">
<include>
+ <context ref="floating-point-number"/>
+ <context ref="decimal"/>
+ <context ref="boz-literal"/>
<context ref="def:string"/>
<context ref="def:single-quoted-string"/>
<context ref="line-comment"/>
@@ -407,10 +420,6 @@
<context ref="input-output"/>
<context ref="intrinsics"/>
<context ref="types"/>
- <context ref="decimal"/>
- <context ref="floating-point-number"/>
- <context ref="octal-number"/>
- <context ref="hex-number"/>
</include>
</context>
Modified: trunk/gtksourceview/language-specs/kate.xml
==============================================================================
--- trunk/gtksourceview/language-specs/kate.xml (original)
+++ trunk/gtksourceview/language-specs/kate.xml Sun Jan 27 07:13:42 2008
@@ -56,7 +56,7 @@
<style name="def:doc-comment-element" bold="true"/>
<!-- Constants -->
- <style name="def:constant" foreground="#800080"/>
+ <style name="def:constant" foreground="dark-red"/>
<style name="def:decimal" foreground="blue"/>
<style name="def:base-n-integer" foreground="#008080"/>
<style name="def:floating-point" foreground="#800080"/>
Modified: trunk/gtksourceview/language-specs/lua.lang
==============================================================================
--- trunk/gtksourceview/language-specs/lua.lang (original)
+++ trunk/gtksourceview/language-specs/lua.lang Sun Jan 27 07:13:42 2008
@@ -41,21 +41,12 @@
<definitions>
<context id="lua-escape" style-ref="escape">
- <match>\\([abfnrtv\"'0]|(\d\d\d))</match>
+ <match>\\(\d\d?\d?|.)</match>
</context>
<context id="string" style-ref="string" end-at-line-end="true">
- <start>"</start>
- <end>"</end>
- <include>
- <context ref="lua-escape"/>
- <context ref="def:line-continue"/>
- </include>
- </context>
-
- <context id="string-2" style-ref="string" end-at-line-end="true">
- <start>'</start>
- <end>'</end>
+ <start>["']</start>
+ <end>\%{0 start}</end>
<include>
<context ref="lua-escape"/>
<context ref="def:line-continue"/>
@@ -65,9 +56,6 @@
<context id="multi-line-string" style-ref="string">
<start>\[(=*)\[</start>
<end>]\%{1 start}]</end>
- <include>
- <context ref="lua-escape"/>
- </include>
</context>
<context id="block-comment" style-ref="comment">
@@ -153,7 +141,6 @@
<context ref="def:shebang"/>
<context ref="multi-line-string"/>
<context ref="string"/>
- <context ref="string-2"/>
<context ref="block-comment"/>
<context ref="line-comment"/>
<context ref="keywords"/>
Modified: trunk/gtksourceview/language-specs/makefile.lang
==============================================================================
--- trunk/gtksourceview/language-specs/makefile.lang (original)
+++ trunk/gtksourceview/language-specs/makefile.lang Sun Jan 27 07:13:42 2008
@@ -73,13 +73,23 @@
</include>
</context>
+ <context id="string">
+ <include>
+ <!-- skip escaped characters -->
+ <context>
+ <match>\\.</match>
+ </context>
+ <context ref="def:string"/>
+ </include>
+ </context>
+
<context id="assignment-rhs" style-ref="assignment-rhs" end-at-line-end="true">
<start></start>
<include>
<context ref="def:line-continue"/>
<context ref="def:shell-like-comment"/>
<context ref="variable"/>
- <context ref="def:string"/>
+ <context ref="string"/>
<context ref="def:single-quoted-string"/>
<context ref="backtick-string"/>
</include>
@@ -91,7 +101,7 @@
<context ref="def:line-continue"/>
<context ref="def:shell-like-comment"/>
<context ref="variable"/>
- <context ref="def:string"/>
+ <context ref="string"/>
<context ref="def:single-quoted-string"/>
<context ref="backtick-string"/>
</include>
@@ -179,97 +189,5 @@
</include>
</context>
-
-<!-- <context id="somecontext">
- <include>
- <context ref="def:shebang"/>
- <context ref="def:shell-like-comment"/>
- <context ref="def:string"/>
- <context ref="def:single-quoted-string"/>
-
- <context id="backtick-string" style-ref="function" end-at-line-end="true">
- <start>`</start>
- <end>`</end>
- <include>
- <context ref="def:escape"/>
- <context ref="def:line-continue"/>
- </include>
- </context>
-
- <context id="variable-1" style-ref="variable" end-at-line-end="true">
- <start>^(\%{variable})\s*=</start>
- <include>
- <context sub-pattern="1" where="start"/>
- <context ref="variable"/>
- <context ref="def:line-continue"/>
- </include>
- </context>
-
- <context id="targets">
- <match>^([^\t\:][^\:]*)\:</match>
- <include>
- <context sub-pattern="1" style-ref="target"/>
- </include>
- </context>
-
- <context id="trailing-tab" style-ref="trailing-tab">
- <match>^\t+$</match>
- </context>
-
- <context id="directives" style-ref="keyword">
- <keyword>define</keyword>
- <keyword>else</keyword>
- <keyword>endef</keyword>
- <keyword>endif</keyword>
- <keyword>if</keyword>
- <keyword>ifdef</keyword>
- <keyword>ifeq</keyword>
- <keyword>ifndef</keyword>
- <keyword>ifneq</keyword>
- <keyword>include</keyword>
- <keyword>override</keyword>
- <keyword>unexport</keyword>
- </context>
-
- <context id="functions" style-ref="function">
- <keyword>addprefix</keyword>
- <keyword>addsuffix</keyword>
- <keyword>basename</keyword>
- <keyword>call</keyword>
- <keyword>dir</keyword>
- <keyword>error</keyword>
- <keyword>filter</keyword>
- <keyword>filter-out</keyword>
- <keyword>findstring</keyword>
- <keyword>firstword</keyword>
- <keyword>foreach</keyword>
- <keyword>join</keyword>
- <keyword>notdir</keyword>
- <keyword>origin</keyword>
- <keyword>patsubst</keyword>
- <keyword>shell</keyword>
- <keyword>sort</keyword>
- <keyword>strip</keyword>
- <keyword>subst</keyword>
- <keyword>suffix</keyword>
- <keyword>warning</keyword>
- <keyword>wildcard</keyword>
- <keyword>word</keyword>
- <keyword>words</keyword>
- </context>
-
- <context id="special-targets" style-ref="keyword">
- <prefix>^</prefix>
- <suffix>\b</suffix>
- <keyword>\.DEFAULT</keyword>
- <keyword>\.EXPORT_ALL_VARIABLES</keyword>
- <keyword>\.IGNORE</keyword>
- <keyword>\.PHONY</keyword>
- <keyword>\.PRECIOUS</keyword>
- <keyword>\.SILENT</keyword>
- <keyword>\.SUFFIXES</keyword>
- </context>
- </include>
- </context>-->
</definitions>
</language>
Modified: trunk/gtksourceview/language-specs/sh.lang
==============================================================================
--- trunk/gtksourceview/language-specs/sh.lang (original)
+++ trunk/gtksourceview/language-specs/sh.lang Sun Jan 27 07:13:42 2008
@@ -55,7 +55,14 @@
<start>"</start>
<end>"</end>
<include>
- <context ref="def:escape"/>
+ <!-- highlight escaped chars -->
+ <context style-ref="def:special-char">
+ <match>\\[$`"\\]</match>
+ </context>
+ <!-- skip backslash where it's not an escaping char -->
+ <context>
+ <match>\\</match>
+ </context>
<context ref="def:line-continue"/>
</include>
</context>
@@ -162,7 +169,7 @@
</context>
<context id="variable1" style-ref="variable1">
- <match>\$+[ ?*#\${a-zA-Z0-9_][}a-zA-Z0-9_]*</match>
+ <match>\$+[! ?*#\${a-zA-Z0-9_][}a-zA-Z0-9_]*</match>
</context>
<context id="variable2" style-ref="variable2">
Modified: trunk/gtksourceview/language-specs/testfiles.sh
==============================================================================
--- trunk/gtksourceview/language-specs/testfiles.sh (original)
+++ trunk/gtksourceview/language-specs/testfiles.sh Sun Jan 27 07:13:42 2008
@@ -14,10 +14,20 @@
dir="testdir"
mkdir -p $dir/
+cat > $dir/file.f <<EOFEOF
+! gtk-source-lang: fortran
+c comment
+if .TRUE.
+.FALSE.
+endif
+Numbers: 1234 o'10176' b'10101' z'23FF'
+12. .12 12.12 1.23e+09 1.23D+09
+EOFEOF
+
cat > $dir/file.frt <<EOFEOF
\ gtk-source-lang: forth
-- comment
-(* comment!
+(* comment!
here still comment
*)
NEEDS something
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]