erlang.lang 8.26 KB
Newer Older
Paolo Borelli's avatar
Paolo Borelli committed
1 2 3
<?xml version="1.0" encoding="UTF-8"?>
<!--

4 5
 This file is part of GtkSourceView

Paolo Borelli's avatar
Paolo Borelli committed
6 7 8
 Author: Paolo Borelli <pborelli@gnome.org>
 Copyright (C) 2007 Paolo Borelli

9
 GtkSourceView is free software; you can redistribute it and/or
10
 modify it under the terms of the GNU Lesser General Public
Paolo Borelli's avatar
Paolo Borelli committed
11
 License as published by the Free Software Foundation; either
12
 version 2.1 of the License, or (at your option) any later version.
Paolo Borelli's avatar
Paolo Borelli committed
13

14
 GtkSourceView is distributed in the hope that it will be useful,
Paolo Borelli's avatar
Paolo Borelli committed
15 16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 Lesser General Public License for more details.
Paolo Borelli's avatar
Paolo Borelli committed
18

19 20
 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, see <http://www.gnu.org/licenses/>.
Paolo Borelli's avatar
Paolo Borelli committed
21 22

-->
23
<language id="erlang" name="Erlang" version="2.0" _section="Source">
Paolo Borelli's avatar
Paolo Borelli committed
24 25
  <metadata>
    <property name="mimetypes">text/x-erlang</property>
26
    <property name="globs">*.erl;*.hrl</property>
Paolo Borelli's avatar
Paolo Borelli committed
27 28 29 30
    <property name="line-comment-start">%</property>
  </metadata>

  <styles>
31 32 33 34 35 36 37 38 39 40 41
    <style id="comment" name="Comment" map-to="def:comment"/>
    <style id="keyword" name="Keyword" map-to="def:keyword"/>
    <style id="operator" name="Operator" map-to="def:operator"/>
    <style id="atom" name="Atom" map-to="def:type"/>
    <style id="string" name="String" map-to="def:string"/>
    <style id="character" name="Character" map-to="def:character"/>
    <style id="floating-point" name="Floating point number" map-to="def:floating-point"/>
    <style id="decimal" name="Decimal number" map-to="def:decimal"/>
    <style id="base-n-integer" name="Base-N Integer" map-to="def:base-n-integer"/>
    <style id="builtin" name="Builtin" map-to="def:builtin"/>
    <style id="compiler-directive" name="Compiler Directive" map-to="def:preprocessor"/>
Paolo Borelli's avatar
Paolo Borelli committed
42 43 44 45
  </styles>

  <definitions>

46
    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
Paolo Borelli's avatar
Paolo Borelli committed
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
      <start>%</start>
      <include>
        <context ref="def:in-line-comment"/>
      </include>
    </context>

    <context id="keywords" style-ref="keyword">
      <keyword>after</keyword>
      <keyword>begin</keyword>
      <keyword>case</keyword>
      <keyword>catch</keyword>
      <keyword>cond</keyword>
      <keyword>end</keyword>
      <keyword>fun</keyword>
      <keyword>if</keyword>
      <keyword>let</keyword>
      <keyword>of</keyword>
      <keyword>query</keyword>
      <keyword>receive</keyword>
      <keyword>when</keyword>
    </context>

    <context id="operators" style-ref="operator">
      <keyword>and</keyword>
      <keyword>band</keyword>
      <keyword>bnot</keyword>
      <keyword>bor</keyword>
      <keyword>bsl</keyword>
      <keyword>bsr</keyword>
      <keyword>bxor</keyword>
      <keyword>div</keyword>
      <keyword>not</keyword>
      <keyword>or</keyword>
      <keyword>rem</keyword>
      <keyword>xor</keyword>
    </context>

    <context id="atom" style-ref="atom">
      <start>'</start>
      <end>'</end>
      <include>
        <context ref="def:escape"/>
      </include>
    </context>

92
    <context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
Paolo Borelli's avatar
Paolo Borelli committed
93 94 95 96 97 98 99
      <start>"</start>
      <end>"</end>
      <include>
        <context ref="def:escape"/>
      </include>
    </context>

100 101 102 103 104 105 106
    <context id="character" style-ref="character" class="character" class-disabled="no-spell-check">
      <match>\$(?:(\\.)|.)</match>
      <include>
        <context sub-pattern="1" style-ref="def:special-char"/>
      </include>
    </context>

Paolo Borelli's avatar
Paolo Borelli committed
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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
    <context id="float" style-ref="floating-point">
      <match extended="true">
        (?&lt;![\w\.])
        [0-9]+\.[0-9]+([Ee][+-]?[0-9]+)?
        (?![\w\.])
      </match>
    </context>

    <context id="base-n-number" style-ref="base-n-integer">
      <match extended="true">
        (?&lt;![\w\.])
        [1-9]([0-9])?#[0-9a-fA-F]+
        (?![\w\.])
      </match>
    </context>

    <context id="decimal-number" style-ref="decimal">
      <match extended="true">
        (?&lt;![\w\.])
        [0-9]+
        (?![\w\.])
      </match>
    </context>

    <context id="builtins" style-ref="builtin">
      <keyword>abs</keyword>
      <keyword>alive</keyword>
      <keyword>apply</keyword>
      <keyword>atom_to_list</keyword>
      <keyword>atom</keyword>
      <keyword>binary_to_list</keyword>
      <keyword>binary_to_ter</keyword>
      <keyword>binary</keyword>
      <keyword>check_process_code</keyword>
      <keyword>concat_binary</keyword>
      <keyword>constant</keyword>
      <keyword>date</keyword>
      <keyword>delete_module</keyword>
      <keyword>disconnect_node</keyword>
      <keyword>element</keyword>
      <keyword>erase</keyword>
      <keyword>exit</keyword>
      <keyword>float</keyword>
      <keyword>float_to_list</keyword>
      <keyword>function</keyword>
      <keyword>get_cookie</keyword>
      <keyword>get_keys</keyword>
      <keyword>get</keyword>
      <keyword>group_leader</keyword>
      <keyword>halt</keyword>
      <keyword>hash</keyword>
      <keyword>hd</keyword>
      <keyword>integer_to_list</keyword>
      <keyword>integer</keyword>
      <keyword>is_alive</keyword>
      <keyword>length</keyword>
      <keyword>link</keyword>
      <keyword>list_to_atom</keyword>
      <keyword>list_to_binary</keyword>
      <keyword>list_to_float</keyword>
      <keyword>list_to_integer</keyword>
      <keyword>list_to_pid</keyword>
      <keyword>list_to_tuple</keyword>
      <keyword>list</keyword>
      <keyword>load_module</keyword>
      <keyword>make_ref</keyword>
      <keyword>math</keyword>
      <keyword>module_loaded</keyword>
      <keyword>monitor_node</keyword>
      <keyword>node</keyword>
      <keyword>nodes</keyword>
      <keyword>now</keyword>
      <keyword>number</keyword>
      <keyword>open_port</keyword>
      <keyword>pid_to_list</keyword>
      <keyword>pid</keyword>
      <keyword>ports</keyword>
      <keyword>port_close</keyword>
      <keyword>port_info</keyword>
      <keyword>preloaded</keyword>
      <keyword>processes</keyword>
      <keyword>process_flag</keyword>
      <keyword>process_info</keyword>
      <keyword>process</keyword>
      <keyword>purge_module</keyword>
      <keyword>put</keyword>
      <keyword>record</keyword>
      <keyword>reference</keyword>
      <keyword>registered</keyword>
      <keyword>register</keyword>
      <keyword>round</keyword>
      <keyword>self</keyword>
      <keyword>setelement</keyword>
      <keyword>set_cookie</keyword>
      <keyword>set_node</keyword>
      <keyword>size</keyword>
      <keyword>spawn_link</keyword>
      <keyword>spawn</keyword>
      <keyword>split_binary</keyword>
      <keyword>statistics</keyword>
      <keyword>term_to_binary</keyword>
      <keyword>throw</keyword>
      <keyword>time</keyword>
      <keyword>tl</keyword>
      <keyword>trunc</keyword>
      <keyword>tuple_to_list</keyword>
      <keyword>unlink</keyword>
      <keyword>unregister</keyword>
      <keyword>whereis</keyword>
    </context>

    <context id="compiler-directives" style-ref="compiler-directive">
      <prefix>-</prefix>
      <keyword>author</keyword>
221
      <keyword>behaviour</keyword>
Paolo Borelli's avatar
Paolo Borelli committed
222 223 224 225 226 227
      <keyword>compile</keyword>
      <keyword>copyright</keyword>
      <keyword>define</keyword>
      <keyword>doc</keyword>
      <keyword>else</keyword>
      <keyword>endif</keyword>
228
      <keyword>error</keyword>
Paolo Borelli's avatar
Paolo Borelli committed
229 230 231 232 233 234 235 236
      <keyword>export</keyword>
      <keyword>file</keyword>
      <keyword>ifdef</keyword>
      <keyword>ifndef</keyword>
      <keyword>import</keyword>
      <keyword>include_lib</keyword>
      <keyword>include</keyword>
      <keyword>module</keyword>
237
      <keyword>on_load</keyword>
Paolo Borelli's avatar
Paolo Borelli committed
238 239
      <keyword>record</keyword>
      <keyword>undef</keyword>
240 241
      <keyword>vsn</keyword>
      <keyword>warning</keyword>
Paolo Borelli's avatar
Paolo Borelli committed
242 243
    </context>

244
    <context id="erlang" class="no-spell-check">
Paolo Borelli's avatar
Paolo Borelli committed
245 246 247 248 249 250
      <include>
        <context ref="line-comment"/>
        <context ref="keywords"/>
        <context ref="operators"/>
        <context ref="atom"/>
        <context ref="string"/>
251
        <context ref="character"/>
Paolo Borelli's avatar
Paolo Borelli committed
252 253 254 255 256 257 258 259 260 261 262
        <context ref="float"/>
        <context ref="base-n-number"/>
        <context ref="decimal-number"/>
        <context ref="builtins"/>
        <context ref="compiler-directives"/>
      </include>
    </context>

  </definitions>

</language>