gtksourceview r1913 - in trunk: . gtksourceview/language-specs
- From: muntyan svn gnome org
- To: svn-commits-list gnome org
- Subject: gtksourceview r1913 - in trunk: . gtksourceview/language-specs
- Date: Fri, 29 Feb 2008 17:07:36 +0000 (GMT)
Author: muntyan
Date: Fri Feb 29 17:07:36 2008
New Revision: 1913
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=1913&view=rev
Log:
2008-02-29 Yevgen Muntyan <muntyan tamu edu>
* gtksourceview/language-specs/c.lang: (printf): highlight
width and precision given as '*';
(escaped-character): highlight \b; hex digit is \\x[HEX]+,
not \\x[HEX]{0,2};
(string), (char): highlight 'L' prefix in wide char literals.
* gtksourceview/language-specs/yacc.lang: prettified.
* gtksourceview/language-specs/lua.lang: do not highlight
_G.* in the middle of idenitifiers.
Modified:
trunk/ChangeLog
trunk/gtksourceview/language-specs/c.lang
trunk/gtksourceview/language-specs/lua.lang
trunk/gtksourceview/language-specs/yacc.lang
Modified: trunk/gtksourceview/language-specs/c.lang
==============================================================================
--- trunk/gtksourceview/language-specs/c.lang (original)
+++ trunk/gtksourceview/language-specs/c.lang Fri Feb 29 17:07:36 2008
@@ -55,22 +55,21 @@
<!-- man 3 printf -->
<context id="printf" style-ref="printf" extend-parent="false">
<match extended="true">
- \%\%|
- \%([1-9][0-9]*\$)?
- [#0\-\ \+\'I]*
- (\-?[1-9][0-9]*)?
- (\.\-?[1-9][0-9]*)?
- (hh|ll|[hlLqjzt])?
- [diouxXeEfFgGaAcsCSpnm]
+ \%\%|\%
+ (?:[1-9][0-9]*\$)? # argument
+ [#0\-\ \+\'I]* # flags
+ (?:[1-9][0-9]*|\*)? # width
+ (?:\.\-?(?:[0-9]+|\*))? # precision
+ (?:hh|ll|[hlLqjzt])? # length modifier
+ [diouxXeEfFgGaAcsCSpnm] # conversion specifier
</match>
</context>
- <!-- http://en.wikipedia.org/wiki/C_syntax#Strings -->
<define-regex id="escaped-character" extended="true">
\\( # leading backslash
- [\\\"\'nrtfav\?e] | # escaped character
+ [\\\"\'nrbtfav\?] | # escaped character
[0-7]{1,3} | # one, two, or three octal digits
- x[0-9A-Fa-f]{0,2} # 'x' followed by zero, one, or two hex digits
+ x[0-9A-Fa-f]+ # 'x' followed by hex digits
)
</define-regex>
@@ -145,7 +144,7 @@
</context>
<context id="string" style-ref="string" end-at-line-end="true">
- <start>"</start>
+ <start>L?"</start>
<end>"</end>
<include>
<context ref="printf"/>
@@ -157,7 +156,7 @@
</context>
<context id="char" style-ref="char">
- <match>'(\%{escaped-character}|.)'</match>
+ <match>L?'(\%{escaped-character}|.)'</match>
</context>
<!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
@@ -260,7 +259,7 @@
<keyword>__STDC__</keyword>
</context>
- <!-- C99 booleans -->
+ <!-- C99 booleans -->
<context id="boolean" style-ref="boolean">
<keyword>true</keyword>
<keyword>false</keyword>
Modified: trunk/gtksourceview/language-specs/lua.lang
==============================================================================
--- trunk/gtksourceview/language-specs/lua.lang (original)
+++ trunk/gtksourceview/language-specs/lua.lang Fri Feb 29 17:07:36 2008
@@ -124,7 +124,7 @@
</context>
<context id="lua-reserved" style-ref="reserved">
- <match>_[A-Z]+</match>
+ <keyword>_[A-Z][A-Za-z0-9_]*</keyword>
</context>
<context id="nil-value" style-ref="nil-value">
Modified: trunk/gtksourceview/language-specs/yacc.lang
==============================================================================
--- trunk/gtksourceview/language-specs/yacc.lang (original)
+++ trunk/gtksourceview/language-specs/yacc.lang Fri Feb 29 17:07:36 2008
@@ -2,7 +2,7 @@
<!--
Author: Yevgen Muntyan <muntyan tamu edu>
- Copyright (C) 2006-2007 Yevgen Muntyan <muntyan tamu edu>
+ Copyright (C) 2006-2008 Yevgen Muntyan <muntyan tamu edu>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -30,9 +30,10 @@
</metadata>
<styles>
- <style id="inline-c" _name="Inline C Code" map-to="def:keyword"/>
- <style id="grammar" _name="grammar" map-to="def:keyword"/>
- <style id="keyword" _name="keyword" map-to="def:keyword"/>
+ <!--FIXME make it better names, and make them translatable -->
+ <style id="keyword" name="keyword" map-to="def:keyword"/>
+ <style id="token-type" name="token-type" map-to="def:type"/>
+ <style id="rule" name="rule" map-to="def:identifier"/>
</styles>
<definitions>
@@ -40,42 +41,124 @@
<start>^%{</start>
<end>^%}</end>
<include>
- <context sub-pattern="0" where="start" style-ref="inline-c" />
- <context sub-pattern="0" where="end" style-ref="inline-c" />
+ <context sub-pattern="0" where="start" style-ref="keyword"/>
+ <context sub-pattern="0" where="end" style-ref="keyword"/>
<context ref="c:c"/>
</include>
</context>
- <context id="keywords" style-ref="keyword">
+ <context id="options" style-ref="keyword">
<prefix>^%</prefix>
- <keyword>name-prefix</keyword>
+ <keyword>debug</keyword>
+ <keyword>defines</keyword>
+ <keyword>destructor</keyword>
+ <keyword>dprec</keyword>
<keyword>error-verbose</keyword>
- <keyword>lex-param</keyword>
- <keyword>parse-param</keyword>
<keyword>expect</keyword>
- <keyword>union</keyword>
- <keyword>token</keyword>
- <keyword>type</keyword>
+ <keyword>glr-parser</keyword>
+ <keyword>initial-action</keyword>
<keyword>left</keyword>
+ <keyword>lex-param</keyword>
+ <keyword>locations</keyword>
+ <keyword>merge</keyword>
+ <keyword>name-prefix</keyword>
+ <keyword>no[_-]lines</keyword>
+ <keyword>nonassoc</keyword>
+ <keyword>output</keyword>
+ <keyword>parse-param</keyword>
+ <keyword>prec</keyword>
+ <keyword>pure[_-]parser</keyword>
+ <keyword>raw</keyword>
+ <keyword>require</keyword>
<keyword>right</keyword>
+ <keyword>start</keyword>
+ <keyword>token[_-]table</keyword>
+ <keyword>union</keyword>
+ </context>
+
+ <context id="token">
+ <start>^(%(token|type))(<[A-Za-z_][A-Za-z0-9_]*>)?(?![\w_-])</start>
+ <end></end>
+ <include>
+ <context sub-pattern="1" where="start" style-ref="keyword"/>
+ <context sub-pattern="3" where="start" style-ref="token-type"/>
+ </include>
+ </context>
+
+ <context id="before-grammar">
+ <include>
+ <context ref="inline-c"/>
+ <context ref="options"/>
+ <context ref="token"/>
+ <context ref="c:comment"/>
+ <context ref="c:comment-multiline"/>
+ </include>
+ </context>
+
+ <context id="after-grammar">
+ <start>^%%</start>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="keyword"/>
+ <context ref="c:c"/>
+ </include>
+ </context>
+
+ <context id="c-with-brackets">
+ <include>
+ <context>
+ <start>{</start>
+ <end>}</end>
+ <include>
+ <context ref="c-with-brackets"/>
+ </include>
+ </context>
+ <context ref="c:c"/>
+ </include>
+ </context>
+
+ <context id="rule-code">
+ <start>{</start>
+ <end>}</end>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="keyword"/>
+ <context sub-pattern="0" where="end" style-ref="keyword"/>
+ <context ref="c-with-brackets"/>
+ <context style-ref="keyword">
+ <match>\$(<[\w\d_-]*>)?[\$0-9]</match>
+ </context>
+ </include>
+ </context>
+
+ <context id="rule">
+ <start>[a-zA-Z_.][a-zA-Z0-9_.]*</start>
+ <end>;</end>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="rule"/>
+ <context ref="c:comment"/>
+ <context ref="c:comment-multiline"/>
+ <context ref="c:char"/>
+ <context ref="c:string"/>
+ <context ref="rule-code"/>
+ </include>
</context>
<context id="grammar">
<start>^%%</start>
- <end>^%%</end>
<include>
- <context sub-pattern="0" where="start" style-ref="grammar" />
- <context sub-pattern="0" where="end" style-ref="grammar" />
+ <context sub-pattern="0" where="start" style-ref="keyword"/>
+ <context ref="c:comment"/>
+ <context ref="c:comment-multiline"/>
+ <context ref="c:char"/>
+ <context ref="c:string"/>
+ <context ref="rule"/>
+ <context ref="after-grammar"/>
</include>
</context>
<context id="yacc">
<include>
- <context ref="inline-c"/>
+ <context ref="before-grammar"/>
<context ref="grammar"/>
- <context ref="keywords"/>
- <context ref="c:comment"/>
- <context ref="c:comment-multiline"/>
</include>
</context>
</definitions>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]