objc.lang 4 KB
Newer Older
1 2 3
<?xml version="1.0" encoding="UTF-8"?>
<!--

4 5
 This file is part of GtkSourceView

6 7 8
 Author: Yevgen Muntyan <muntyan@math.tamu.edu>
 Copyright (C) 2007 Yevgen Muntyan <muntyan@math.tamu.edu>

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

14
 GtkSourceView is distributed in the hope that it will be useful,
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.
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/>.
21 22

-->
23
<language id="objc" name="Objective-C" version="2.0" _section="Source">
24 25 26 27 28 29 30 31 32
  <metadata>
    <property name="mimetypes">text/x-objcsrc</property>
    <property name="globs">*.m</property>
    <property name="line-comment-start">//</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
  </metadata>

  <styles>
33 34 35 36
    <style id="keyword" name="Keyword" map-to="c:keyword"/>
    <style id="type" name="Data Type" map-to="c:type"/>
    <style id="common-defines" name="Common Defines" map-to="c:common-defines"/>
    <style id="string" name="String" map-to="c:string"/>
37 38 39 40 41 42 43
  </styles>

  <definitions>
    <!-- ObjC-specific stuff (i.e. stuff which is not C) -->
    <context id="objc-header">
      <include>
        <context id="keywords" style-ref="keyword">
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
          <prefix>\@</prefix>
          <keyword>interface</keyword>
          <keyword>protocol</keyword>
          <keyword>implementation</keyword>
          <keyword>end</keyword>
          <keyword>class</keyword>
          <keyword>selector</keyword>
          <keyword>encode</keyword>
          <keyword>defs</keyword>
          <keyword>synchronized</keyword>
          <keyword>private</keyword>
          <keyword>protected</keyword>
          <keyword>public</keyword>
          <keyword>try</keyword>
          <keyword>throw</keyword>
          <keyword>catch</keyword>
          <keyword>finally</keyword>
61 62
        </context>

63
        <context id="types" style-ref="type">
64 65
          <keyword>BOOL</keyword>
        </context>
66

67
        <context id="objc-string-literal" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
68 69 70 71 72 73
          <start>\@"</start>
          <end>"</end>
          <include>
            <context ref="c:string:*"/>
          </include>
        </context>
74 75 76 77 78 79 80
      </include>
    </context>

    <!-- ObjC-specific stuff (i.e. stuff which is not C), which isn't
         good to highlight in C headers -->
    <context id="objc-source">
      <include>
81
        <context id="objc-keywords" style-ref="keyword">
82 83
          <keyword>self</keyword>
          <keyword>super</keyword>
84 85
        </context>

86
        <context id="objc-types" style-ref="type">
87 88 89 90 91 92 93 94 95 96 97 98 99
          <keyword>apply_t</keyword>
          <keyword>Class</keyword>
          <keyword>id</keyword>
          <keyword>IMP</keyword>
          <keyword>MetaClass</keyword>
          <keyword>Object</keyword>
          <keyword>Protocol</keyword>
          <keyword>retval_t</keyword>
          <keyword>SEL</keyword>
          <keyword>STR</keyword>
          <keyword>TypedStream</keyword>
        </context>

100
        <context id="objc-common-defines" style-ref="common-defines">
101
          <keyword>METHOD_NULL</keyword>
102 103
          <keyword>nil</keyword>
          <keyword>Nil</keyword>
104 105 106 107 108 109 110
          <keyword>NO</keyword>
          <keyword>YES</keyword>
        </context>
      </include>
    </context>

    <!-- actual language definition: ObjC-specific stuff plus everything from C -->
111
    <context id="objc" class="no-spell-check">
112 113 114 115 116 117 118 119
      <include>
        <context ref="objc-source"/>
        <context ref="objc-header"/>
        <context ref="c:c"/>
      </include>
    </context>
  </definitions>
</language>