File: R.lang

package info (click to toggle)
gtksourceview2 2.2.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,856 kB
  • ctags: 1,896
  • sloc: ansic: 18,630; sh: 9,199; xml: 4,509; python: 424; makefile: 272
file content (127 lines) | stat: -rw-r--r-- 4,212 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Vaidotas Zemlys <mpiktas@gmail.com>
 Copyright (C) 2005 Vaidotas Zemlys <mpiktas@gmail.com>

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program 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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

-->
<language id="r" _name="R" version="2.0" _section="Scripts">
  <metadata>
    <property name="mimetypes">text/x-R</property>
    <property name="globs">*.R,*.Rout;*.r;*.Rhistory;*.Rt;*.Rout.save;*.Rout.fail</property>
    <property name="line-comment-start">#</property>
  </metadata>

  <styles>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="reserved-classes" _name="Reserved Class" map-to="def:type"/>
    <style id="assignment-operator" _name="Assignment Operator" map-to="def:operator"/>
    <style id="delimiter" _name="Delimiter" map-to="def:operator"/>
    <style id="special-constant" _name="Special Constant" map-to="def:special-constant"/>
    <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
    <style id="integer-number" _name="Integer Number" map-to="def:base-n-integer"/>
    <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
  </styles>

  <definitions>

    <context id="keywords" style-ref="keyword">
      <keyword>break</keyword>
      <keyword>else</keyword>
      <keyword>for</keyword>
      <keyword>if</keyword>
      <keyword>in</keyword>
      <keyword>next</keyword>
      <keyword>repeat</keyword>
      <keyword>return</keyword>
      <keyword>switch</keyword>
      <keyword>try</keyword>
      <keyword>while</keyword>
    </context>

    <context id="reserved-classes" style-ref="reserved-classes">
      <keyword>array</keyword>
      <keyword>character</keyword>
      <keyword>complex</keyword>
      <keyword>data.frame</keyword>
      <keyword>double</keyword>
      <keyword>factor</keyword>
      <keyword>function</keyword>
      <keyword>integer</keyword>
      <keyword>list</keyword>
      <keyword>logical</keyword>
      <keyword>matrix</keyword>
      <keyword>numeric</keyword>
      <keyword>vector</keyword>
    </context>

    <context id="assignment-operator" style-ref="assignment-operator">
      <match>(&lt;){1,2}-</match>
    </context>

    <context id="delimiters" style-ref="delimiter">
      <match>[\)\(]+|[\{\}]+|[][]+</match>
    </context>

    <context id="special-constants" style-ref="special-constant">
      <keyword>Inf</keyword>
      <keyword>NA</keyword>
      <keyword>NaN</keyword>
      <keyword>NULL</keyword>
    </context>

    <context id="boolean" style-ref="boolean">
      <keyword>FALSE</keyword>
      <keyword>TRUE</keyword>
    </context>

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

    <context id="floating-point" style-ref="floating-point">
      <match extended="true">
        (?&lt;![\w\.])
        ([0-9]+[Ee][-+]?[0-9]+|
         ([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-+]?[0-9]+)?)
        [i]?
        (?![\w\.])
      </match>
    </context>

    <context id="r">
      <include>
        <context ref="def:shell-like-comment"/>
        <context ref="def:string"/>
        <context ref="def:single-quoted-string"/>
        <context ref="keywords"/>
        <context ref="assignment-operator"/>
        <context ref="delimiters"/>
        <context ref="special-constants"/>
        <context ref="boolean"/>
        <context ref="integer-number"/>
        <context ref="floating-point"/>
      </include>
    </context>

  </definitions>

</language>