summaryrefslogtreecommitdiff
path: root/contrib/gtksourceview-3.0/language-specs/ousia.lang
blob: e8ebbdf4181bbdbe7dc2cc66174dc68fa8b5444a (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 Author: Andreas Stöckel
 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"/>
    <style id="string" _name="String" map-to="def:string"/>
    <style id="attribute-name" _name="Attribute name" map-to="def:identifier"/>
    <style id="boolean" _name="Boolean Value" map-to="def:boolean"/>
    <style id="type" _name="Data Type" map-to="def:type"/>
  </styles>
  <definitions>
    <!-- An ousia command -->
    <define-regex id="identifier">[a-zA-z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?</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">\\(import|include)</define-regex>

    <!-- 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>

    <!-- 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>

    <!-- Argument lists (maps/arrays) -->
    <context id="map">
      <start>\[</start>
      <end>\]</end>
      <include>
        <context ref="map"/>
        <context ref="map-key"/>
        <context ref="def:string" style-ref="string"/>
        <context ref="def:single-quoted-string" style-ref="string"/>
        <context ref="def:float"/>
        <context ref="def:decimal"/>
        <context ref="def:hexadecimal"/>
        <context ref="boolean"/>
        <context ref="type"/>
        <context ref="cardinality"/>
      </include>
    </context>

    <context id="map-key" style-ref="attribute-name" class="no-spell-check">
      <match>\%{identifier}\s*=</match>
    </context>

    <context id="boolean" style-ref="boolean">
      <keyword>false</keyword>
      <keyword>true</keyword>
    </context>

    <context id="type" style-ref="type">
      <keyword>int</keyword>
      <keyword>double</keyword>
      <keyword>string</keyword>
      <keyword>bool</keyword>
    </context>

    <context id="cardinality">
      <start>{</start>
      <end>}</end>
      <include>
        <context ref="def:decimal"/>
      </include>
    </context>

    <!-- Keywords -->
    <context id="common-commands" style-ref="common-commands" class="no-spell-check">
      <match>\%{builtin}</match>
    </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>

    <!-- Main context -->
    <context id="ousia">
      <include>
        <context ref="begin-command"/>
        <context ref="end-command"/>
        <context ref="common-commands"/>
        <context ref="command"/>
        <context ref="comment-multiline"/>
        <context ref="comment"/>
        <context ref="map"/>
      </include>
    </context>
  </definitions>
</language>