[gtksourceview] Add syntax highlighting for Sweave documents
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Add syntax highlighting for Sweave documents
- Date: Sat, 8 Feb 2014 14:13:20 +0000 (UTC)
commit 35bf57a22d39dcab49e8aeeb4c06b78dee7022f4
Author: Lawrence Hudson <quicklizard googlemail com>
Date: Mon Feb 3 11:56:11 2014 +0100
Add syntax highlighting for Sweave documents
R/S blocks in Sweave documents are parsed using r.lang.
Inline R/S blocks (within \Sexpr{}) are shown as comments.
https://bugzilla.gnome.org/show_bug.cgi?id=620241
data/language-specs/Makefile.am | 1 +
data/language-specs/sweave.lang | 64 +++++++++++++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
3 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index 2bb090c..c0485b0 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -100,6 +100,7 @@ LANGUAGES = \
sml.lang \
sparql.lang \
sql.lang \
+ sweave.lang \
systemverilog.lang \
t2t.lang \
tcl.lang \
diff --git a/data/language-specs/sweave.lang b/data/language-specs/sweave.lang
new file mode 100644
index 0000000..b2b2589
--- /dev/null
+++ b/data/language-specs/sweave.lang
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView
+
+ Authors: Lawrence Hudson
+ Copyright (C) 2010, 2014 Lawrence Hudson <quicklizard googlemail com>
+
+ 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="sweave" _name="Sweave" version="2.0" _section="Markup">
+ <metadata>
+ <property name="globs">*.rnw;*.Rnw;*.snw;*.Snw</property>
+ <property name="line-comment-start">%</property>
+ </metadata>
+
+ <styles>
+ <style id="comment" _name="Comment" map-to="latex:comment"/>
+ <style id="command" _name="Command" map-to="latex:command"/>
+ <style id="verbatim" _name="Command" map-to="latex:verbatim"/>
+ </styles>
+
+ <definitions>
+ <context id="inline-R">
+ <match>(\\Sexpr)(\{)([^\}]*)(\})</match>
+ <include>
+ <context sub-pattern="1" style-ref="command"/>
+ <context sub-pattern="3" style-ref="verbatim"/>
+ </include>
+ </context>
+
+ <context id="R-block" extend-parent="false" style-inside="true">
+ <start>^<<.*>>=</start>
+ <end>@</end>
+ <include>
+ <context sub-pattern="0" where="start" style-ref="command"/>
+ <context sub-pattern="0" where="end" style-ref="command"/>
+ <context ref="r:r"/>
+ </include>
+ </context>
+
+ <context id="sweave">
+ <include>
+ <context ref="inline-R"/>
+ <context ref="R-block"/>
+ <context ref="latex:latex"/>
+ </include>
+ </context>
+ </definitions>
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 741a970..6a69647 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -98,6 +98,7 @@ data/language-specs/sh.lang
data/language-specs/sml.lang
data/language-specs/sparql.lang
data/language-specs/sql.lang
+data/language-specs/sweave.lang
data/language-specs/systemverilog.lang
data/language-specs/t2t.lang
data/language-specs/tcl.lang
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]