summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-10 15:25:30 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-10 15:25:30 +0100
commitda4cac818de97d99de4b09ee0ddc668684be266e (patch)
tree1cf46882650872f9cf6aa3655d1e38933baae5b0 /contrib
parenteefefdc97cd49d830cf0b72b15cb08464a3745f2 (diff)
Updated gedit syntax highlighting for osdl, added test document for testing that syntax highlighter
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gtksourceview-3.0/language-specs/ousia.lang48
-rw-r--r--contrib/test.osdm29
2 files changed, 63 insertions, 14 deletions
diff --git a/contrib/gtksourceview-3.0/language-specs/ousia.lang b/contrib/gtksourceview-3.0/language-specs/ousia.lang
index a4d598e..4cefac3 100644
--- a/contrib/gtksourceview-3.0/language-specs/ousia.lang
+++ b/contrib/gtksourceview-3.0/language-specs/ousia.lang
@@ -21,43 +21,63 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
-<language id="ousia" _name="Ousia" version="2.0" _section="Source">
+<language id="ousia" _name="Ousia" version="2.0" _section="Markup">
<metadata>
<property name="mimetypes">text/vnd.ousia</property>
- <property name="globs">*.opd;*.opm</property>
+ <property name="globs">*.osdm</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="common-commands" _name="Command" map-to="def:keyword"/>
- <style id="command" _name="Command" map-to="def:keyword"/>
+ <style id="common-commands" _name="Command" map-to="latex:common-commands"/>
+ <style id="command" _name="Command" map-to="latex:command"/>
<style id="name" _name="Name" map-to="def:identifier"/>
</styles>
<definitions>
<!-- An ousia command -->
- <define-regex id="builtin">\\(include|import|begin|end)</define-regex>
- <define-regex id="command">\\[^#[{\s]*</define-regex>
- <define-regex id="name">#[^#[{}\s]*</define-regex>
+ <define-regex id="identifier">[a-zA-z][a-zA-z_-]*</define-regex>
+ <define-regex id="identifierWithNS">\%{identifier}(:\%{identifier})*</define-regex>
+ <define-regex id="command">(?P&lt;command_cmd&gt;\\\%{identifierWithNS})(?P&lt;command_name&gt;#\%{identifier})?</define-regex>
+ <define-regex id="begin_command">(?P&lt;begin&gt;\\begin){(?P&lt;begin_cmd&gt;\%{identifierWithNS})(?P&lt;begin_name&gt;#\%{identifier})?}</define-regex>
+ <define-regex id="end_command">(?P&lt;end&gt;\\end){(?P&lt;end_cmd&gt;\%{identifierWithNS})}</define-regex>
+ <define-regex id="builtin">\\(begin|end|import|include)</define-regex>
<context id="ousia">
<include>
+ <!-- Begin command -->
+ <context id="begin-command" class="no-spell-check">
+ <match>\%{begin_command}</match>
+ <include>
+ <context sub-pattern="begin" style-ref="common-commands"/>
+ <context sub-pattern="begin_cmd" style-ref="command"/>
+ <context sub-pattern="begin_name" style-ref="name"/>
+ </include>
+ </context>
+
+ <!-- End command -->
+ <context id="end-command" class="no-spell-check">
+ <match>\%{end_command}</match>
+ <include>
+ <context sub-pattern="end" style-ref="common-commands"/>
+ <context sub-pattern="end_cmd" style-ref="command"/>
+ </include>
+ </context>
+
<!-- Keywords -->
<context id="common-commands" style-ref="common-commands" class="no-spell-check">
<match>\%{builtin}</match>
</context>
<!-- Any command -->
- <context id="command" style-ref="command" class="no-spell-check">
+ <context id="command" class="no-spell-check">
<match>\%{command}</match>
+ <include>
+ <context sub-pattern="command_cmd" style-ref="command"/>
+ <context sub-pattern="command_name" style-ref="name"/>
+ </include>
</context>
- <!-- Name -->
- <context id="name" style-ref="name" class="no-spell-check">
- <match>\%{name}</match>
- </context>
-
-
<!-- Multiline comments -->
<context id="comment-multiline" style-ref="comment">
<start>%{</start>
diff --git a/contrib/test.osdm b/contrib/test.osdm
new file mode 100644
index 0000000..100bc77
--- /dev/null
+++ b/contrib/test.osdm
@@ -0,0 +1,29 @@
+%{
+ We're currently inside a block comment.
+ %{
+ Note that block comments can be nested, easily allowing you to comment
+ out blocks which already contain comments.
+ }%
+}%
+
+% Well, line comments, as we know them from TeX also work
+
+\import{meta}
+\import{book}
+
+\domain#special_words{
+ \struct#latex
+ \struct#ousia
+}
+
+\book{
+ \include{chapters/chapter1}
+ \include{chapters/chapter2}
+
+ \begin{note}{Behaviour of "Include"}
+ Analogous to the `include` command in \latex, \ousia forces the included
+ file to be *complete* in a sense, that it must not have dangling open
+ commands.
+ \end{note}
+}
+