summaryrefslogtreecommitdiff
path: root/contrib/gtksourceview-3.0/language-specs/ousia.lang
blob: 7a91d1e43d1781bcac11f4908cca9fe692ae2b04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 Authors: Andreas Stöckel, Benjamin Paaßen
 Copyright (C) 2015 Andreas Stöckel <astoecke@techfak.uni-bielefeld.de>

 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="ousia" _name="Ousia" version="2.0" _section="Markup">
  <metadata>
    <property name="mimetypes">text/vnd.ousia</property>
    <property name="globs">*.osml</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="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="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" 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>

      	<!-- Multiline comments -->
        <context id="comment-multiline" style-ref="comment">
          <start>%{</start>
          <end>}%</end>
          <include>
            <context ref="comment-multiline"/>
          </include>
        </context>

        <!-- Single line comments -->
        <context id="comment" style-ref="comment">
          <start>%</start>
          <end>$</end>
        </context>
      </include>
    </context>
  </definitions>
</language>