[gtksourceview] Update the full lang-spec file to match the tutorial text
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Update the full lang-spec file to match the tutorial text
- Date: Fri, 13 Sep 2013 11:33:55 +0000 (UTC)
commit 9bd0e326d2e337d380c4e4df6265f53350149767
Author: Ming Hua <minghua rice edu>
Date: Fri Sep 13 01:24:25 2013 -0500
Update the full lang-spec file to match the tutorial text
The full language definition file attached at the end of the tutorial is
updated to match the snippets in the tutorial text. Changes include:
- Use <metadata> for mimetypes and filename extensions;
- Delete "text/x-chdr" mimetype;
- Add "comment" style tag;
- Use context ID "escape" instead of "escaped-character".
- Use "string" style instead of "char" style for "char" context.
- Move "if0-comment" context section before "preprocessor" context so
that it has higher priority to be matched;
- Escape character "&" in "<" and ">";
- Fix typo "inlcuded" -> "included";
The coding style is kept as close as possible to the original, although
the original had inconsistent style to begin with (e.g. 2-space indent
mixed with 4-space indent).
Also see:
https://bugzilla.gnome.org/show_bug.cgi?id=707372
docs/reference/lang-tutorial.xml | 40 +++++++++++++++++++------------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/docs/reference/lang-tutorial.xml b/docs/reference/lang-tutorial.xml
index 23ab3bd..371e184 100644
--- a/docs/reference/lang-tutorial.xml
+++ b/docs/reference/lang-tutorial.xml
@@ -601,9 +601,13 @@ for this tutorial:
<programlisting>
<?xml version="1.0" encoding="UTF-8"?>
-<language id="c" _name="C" version="2.0" _section="Sources"
- mimetypes="text/x-c;text/x-chdr;text/x-csrc">
+<language id="c" _name="C" version="2.0" _section="Sources">
+ <metadata>
+ <property name="mimetypes">text/x-c;text/x-csrc</property>
+ <property name="globs">*.c</property>
+ </metadata>
<styles>
+ <style id="comment" _name="Comment" map-to="def:comment"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
<style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
@@ -626,7 +630,7 @@ for this tutorial:
<start>"</start>
<end>"</end>
<include>
- <context id="escaped-character" style-ref="escaped-character">
+ <context id="escape" style-ref="escaped-character">
<match>\\.</match>
</context>
</include>
@@ -641,11 +645,11 @@ for this tutorial:
</include>
</context>
- <context id="char" end-at-line-end="true" style-ref="char">
+ <context id="char" end-at-line-end="true" style-ref="string">
<start>'</start>
<end>'</end>
<include>
- <context ref="escaped-character"/>
+ <context ref="escape"/>
</include>
</context>
@@ -686,18 +690,6 @@ for this tutorial:
<keyword>void</keyword>
</context>
- <context id="preprocessor"
- style-ref="preprocessor">
- <prefix>^#</prefix>
-
- <keyword>define</keyword>
- <keyword>undef</keyword>
- <keyword>if(n?def)?</keyword>
- <keyword>else</keyword>
- <keyword>elif</keyword>
- <keyword>endif</keyword>
- </context>
-
<context id="if0-comment" style-ref="comment">
<start>^#if 0\b</start>
<end>^#(endif|else|elif)\b</end>
@@ -712,12 +704,22 @@ for this tutorial:
</include>
</context>
+ <context id="preprocessor" style-ref="preprocessor">
+ <prefix>^#</prefix>
+ <keyword>define</keyword>
+ <keyword>undef</keyword>
+ <keyword>if(n?def)?</keyword>
+ <keyword>else</keyword>
+ <keyword>elif</keyword>
+ <keyword>endif</keyword>
+ </context>
+
<context id="include" style-ref="preprocessor">
- <match>^#include (".*"|<.*>)</match>
+ <match>^#include (".*"|&lt;.*&gt;)</match>
<include>
<context id="included-file"
sub-pattern="1"
- style-ref="inlcuded-file"/>
+ style-ref="included-file"/>
</include>
</context>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]