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
7
Kate : http://kate.kde.org/
8
R : http://www.r-project.org/
9
RKWard : http://rkward.sourceforge.net/
11
<language version="2.00" kateversion="2.5" name="R Script" section="Scripts" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPL">
14
<list name="controls">
24
<item> function </item>
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"/>
40
<DetectChar attribute="Error" context="#stay" char="}" />
41
<DetectChar attribute="Error" context="#stay" char=")"/>
44
<context attribute="Normal Text" lineEndContext="#stay" name="ctx0">
45
<IncludeRules context="CommonRules"/>
47
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" />
48
<DetectChar attribute="Error" context="#stay" char=")"/>
51
<context attribute="In Parenthesis" lineEndContext="#stay" name="parenthesis">
52
<LineContinue attribute="Boolean" context="#stay"/>
53
<DetectChar attribute="Keyword" context="#pop" char=")"/>
55
<RegExpr attribute="Identifier" context="#stay" String="[a-zA-Z_\.][0-9a-zA-Z_\.]*[\s]*=(?=([^=]|$))"/>
57
<IncludeRules context="CommonRules"/>
58
<DetectChar attribute="Error" context="#stay" char="}" />
61
<context attribute="String" lineEndContext="#stay" name="string">
62
<DetectChar attribute="String" context="#pop" char="""/>
63
<HlCStringChar attribute="String Char" context="#stay"/>
66
<context attribute="Headline" lineEndContext="#pop" name="Headline"/>
67
<context attribute="Comment" lineEndContext="#pop" name="Comment"/>
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="""/>
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="#"/>
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="([\+\-\*/\^\:\$~!&\|=>@^])([<]{1,2}\-|\-[>]{1,2})"/>
84
<RegExpr attribute="Error" context="#stay" String="([<]{1,2}\-|\-[>]{1,2})([\+\-\*/\^\:\$~!&\|=<@])"/>
85
<RegExpr attribute="Error" context="#stay" String="([<]{3}|[>]{3})"/>
86
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
87
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
88
<!-- Much like above: Most other operators are forbidden around = -->
89
<RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&\|@^])="/>
90
<RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!<>&\|@^])"/>
91
<RegExpr attribute="Assign" context="#stay" String="=(?!=)"/>
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="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~)((?!(\+|\-|\*|/|<=|>=|=|\!=|\||&|:|\^|@|\$|~))|$)"/>
95
<RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~){2,}"/>
96
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
98
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" />
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"/>
124
<comment name="singleLine" start="#" end=""/>
126
<keywords casesensitive="1" />