~ubuntu-branches/ubuntu/karmic/rkward/karmic

« back to all changes in this revision

Viewing changes to rkward/syntax/r.xml

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2006-11-06 16:30:00 UTC
  • mfrom: (1.2.1 upstream) (3.1.1 feisty)
  • Revision ID: james.westby@ubuntu.com-20061106163000-qi8ju75eqecrfay7
* new upstream release
* depend on either php4-cli or php5-cli

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE language SYSTEM "language.dtd">
 
3
<!-- Kate 2.5 (KDE 3.5) highlighting module for R
 
4
        based on an earlier version by E.L. Willighagen. Code folding code by Ben Goodrich
 
5
        version 2.0: (c) 2006 Thomas Friedrichsmeier, Arne Henningsen, and the RKWard Team
 
6
        license: GPL v2
 
7
        Kate   : http://kate.kde.org/
 
8
        R      : http://www.r-project.org/
 
9
        RKWard : http://rkward.sourceforge.net/
 
10
        -->
 
11
<language version="2.00" kateversion="2.5" name="R Script" section="Scripts" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPL">
 
12
<highlighting>
 
13
 
 
14
        <list name="controls">
 
15
                <item> for </item>
 
16
                <item> in </item>
 
17
                <item> next </item>
 
18
                <item> break </item>
 
19
                <item> while </item>
 
20
                <item> repeat </item>
 
21
                <item> if </item>
 
22
                <item> else </item>
 
23
                <item> switch </item>
 
24
                <item> function </item>
 
25
        </list>
 
26
        <list name="words">
 
27
                <item> TRUE </item>
 
28
                <item> FALSE </item>
 
29
                <item> NULL </item>
 
30
                <item> NA </item>
 
31
                <item> Inf </item>
 
32
                <item> NaN </item>
 
33
        </list>
 
34
 
 
35
        <contexts>
 
36
                <!-- This context is really only good for detecting unexpected closing braces '}'. Since opening braces go to ctx0 (and nesting in there), this context is only active on the base level -->
 
37
                <context attribute="Normal Text" lineEndContext="#stay" name="level0">
 
38
                        <IncludeRules context="CommonRules"/>
 
39
 
 
40
                        <DetectChar attribute="Error" context="#stay" char="}" />
 
41
                        <DetectChar attribute="Error" context="#stay" char=")"/>
 
42
                </context>
 
43
                
 
44
                <context attribute="Normal Text" lineEndContext="#stay" name="ctx0">
 
45
                        <IncludeRules context="CommonRules"/>
 
46
 
 
47
                        <DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" />
 
48
                        <DetectChar attribute="Error" context="#stay" char=")"/>
 
49
                </context>
 
50
 
 
51
                <context attribute="In Parenthesis" lineEndContext="#stay" name="parenthesis">
 
52
                        <LineContinue attribute="Boolean" context="#stay"/>
 
53
                        <DetectChar attribute="Keyword" context="#pop" char=")"/>
 
54
 
 
55
                        <RegExpr attribute="Identifier" context="#stay" String="[a-zA-Z_\.][0-9a-zA-Z_\.]*[\s]*=(?=([^=]|$))"/>
 
56
 
 
57
                        <IncludeRules context="CommonRules"/>
 
58
                        <DetectChar attribute="Error" context="#stay" char="}" />
 
59
                </context>
 
60
 
 
61
                <context attribute="String" lineEndContext="#stay" name="string">
 
62
                        <DetectChar attribute="String" context="#pop" char="&quot;"/>
 
63
                        <HlCStringChar attribute="String Char" context="#stay"/>
 
64
                </context>
 
65
 
 
66
                <context attribute="Headline" lineEndContext="#pop" name="Headline"/>
 
67
                <context attribute="Comment" lineEndContext="#pop" name="Comment"/>
 
68
 
 
69
                <!-- This context is not really used, but contains the common rules -->
 
70
                <context name="CommonRules" lineEndContext="#stay" attribute="Normal Text" >
 
71
                        <DetectChar attribute="String" context="string" char="&quot;"/>
 
72
                        <keyword attribute="Control Structure" context="#stay" String="controls"/>
 
73
                        <keyword attribute="Reserved Words" context="#stay" String="words"/>
 
74
                        <Float attribute="Float" context="#stay"/>
 
75
                        <Int attribute="Int" context="#stay"/>
 
76
                        <RegExpr attribute="Keyword" context="#stay" String="[a-zA-Z_]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
 
77
                        <RegExpr attribute="Keyword" context="#stay" String="\.[a-zA-Z_\.]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
 
78
                        <RegExpr attribute="Keyword" context="parenthesis" String="\("/>
 
79
                        <StringDetect attribute="Headline" context="Headline" String="##"/>
 
80
                        <DetectChar attribute="Comment" context="Comment" char="#"/>
 
81
 
 
82
                        <!-- The following three lines look worse than they are: If there are any other operators directly before or after -> and <-, this is a syntax error (expections: ->> and <<-) -->
 
83
                        <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~!&amp;\|=&gt;@^])([&lt;]{1,2}\-|\-[&gt;]{1,2})"/>
 
84
                        <RegExpr attribute="Error" context="#stay" String="([&lt;]{1,2}\-|\-[&gt;]{1,2})([\+\-\*/\^\:\$~!&amp;\|=&lt;@])"/>
 
85
                        <RegExpr attribute="Error" context="#stay" String="([&lt;]{3}|[&gt;]{3})"/>
 
86
                        <RegExpr attribute="Assign" context="#stay" String="[&lt;]{1,2}\-"/>
 
87
                        <RegExpr attribute="Assign" context="#stay" String="\-[&gt;]{1,2}"/>
 
88
                        <!-- Much like above: Most other operators are forbidden around = -->
 
89
                        <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&amp;\|@^])="/>
 
90
                        <RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!&lt;&gt;&amp;\|@^])"/>
 
91
                        <RegExpr attribute="Assign" context="#stay" String="=(?!=)"/>
 
92
 
 
93
                        <!-- These operators are fine as long as they're followed by something else or end of line. Error otherwise -->
 
94
                        <RegExpr attribute="Operator" context="#stay" String="(\+|\-|\*|/|&lt;=|&gt;=|={1,2}|\!=|\|{1,2}|&amp;{1,2}|:{1,2}|\^|@|\$|~)((?!(\+|\-|\*|/|&lt;=|&gt;=|=|\!=|\||&amp;|:|\^|@|\$|~))|$)"/>
 
95
                        <RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|&lt;=|&gt;=|={1,2}|\!=|\|{1,2}|&amp;{1,2}|:{1,2}|\^|@|\$|~){2,}"/>       
 
96
                        <RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
 
97
                        
 
98
                        <DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" />
 
99
                </context>
 
100
        </contexts>
 
101
 
 
102
        <itemDatas>
 
103
        <!-- KDE default colors: http://accessibility.kde.org/oxygen.php?color=white -->
 
104
                <itemData name="Normal Text" defStyleNum="dsNormal"/>
 
105
                <itemData name="Symbol" defStyleNum="dsNormal"/>
 
106
                <itemData name="Keyword" defStyleNum="dsKeyword"/>
 
107
                <itemData name="Identifier" defStyleNum="dsDataType"/>
 
108
                <itemData name="String" defStyleNum="dsString"/>
 
109
                <itemData name="Headline" defStyleNum="dsNormal" color="#b00000" selColor="#b00000" bold="1" italic="0"/> <!-- KDE default color: text 5 -->
 
110
                <itemData name="Comment" defStyleNum="dsComment"/>
 
111
                <itemData name="Assign" defStyleNum="dsNormal" color="#336366" selColor="#ccc099" bold="1" italic="0"/> <!-- KDE default color: text 7 -->
 
112
                <itemData name="Control Structure" defStyleNum="dsNormal" color="#0000bf" selColor="#bfbf00"/> <!-- KDE default color: text 2 -->
 
113
                <itemData name="Reserved Words" defStyleNum="dsOthers"/>
 
114
                <itemData name="Error" defStyleNum="dsError"/>
 
115
                <itemData name="Operator" defStyleNum="dsNormal"  color="#803f00" selColor="#000077" bold="0" italic="0"/> <!-- KDE default color: focussed text -->
 
116
                <itemData name="String Char"  defStyleNum="dsChar"/>
 
117
                <itemData name="Float" defStyleNum="dsFloat"/>
 
118
                <itemData name="Int" defStyleNum="dsDecVal"/>
 
119
        </itemDatas>
 
120
</highlighting>
 
121
 
 
122
<general>
 
123
        <comments>
 
124
                <comment name="singleLine" start="#" end=""/>
 
125
        </comments>
 
126
        <keywords casesensitive="1" />
 
127
</general>
 
128
</language>