You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
7.0 KiB
149 lines
7.0 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE language SYSTEM "language.dtd">
|
|
<!-- Kate 2.5 (KDE 3.5) highlighting module for R
|
|
based on an earlier version by E.L. Willighagen. Code folding code by Ben Goodrich
|
|
version 2.0: (c) 2006 Thomas Friedrichsmeier, Arne Henningsen, and the RKWard Team
|
|
license: GPL v2
|
|
Kate : http://kate.kde.org/
|
|
R : http://www.r-project.org/
|
|
RKWard : http://rkward.sourceforge.net/
|
|
-->
|
|
<language version="2.02" kateversion="2.5" name="R Script" section="Scripts" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPL">
|
|
<highlighting>
|
|
|
|
<list name="controls">
|
|
<item> for </item>
|
|
<item> in </item>
|
|
<item> next </item>
|
|
<item> break </item>
|
|
<item> while </item>
|
|
<item> repeat </item>
|
|
<item> if </item>
|
|
<item> else </item>
|
|
<item> switch </item>
|
|
<item> function </item>
|
|
</list>
|
|
<list name="words">
|
|
<item> TRUE </item>
|
|
<item> FALSE </item>
|
|
<item> NULL </item>
|
|
<item> NA </item>
|
|
<item> NA_integer_ </item>
|
|
<item> NA_real_ </item>
|
|
<item> NA_complex_ </item>
|
|
<item> NA_character_ </item>
|
|
<item> Inf </item>
|
|
<item> NaN </item>
|
|
</list>
|
|
|
|
<contexts>
|
|
<!-- 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 -->
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="level0">
|
|
<IncludeRules context="CommonRules"/>
|
|
|
|
<DetectChar attribute="Error" context="#stay" char="}" />
|
|
<DetectChar attribute="Error" context="#stay" char=")"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="ctx0">
|
|
<IncludeRules context="CommonRules"/>
|
|
|
|
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" />
|
|
<DetectChar attribute="Error" context="#stay" char=")"/>
|
|
</context>
|
|
|
|
<context attribute="In Parenthesis" lineEndContext="#stay" name="parenthesis">
|
|
<LineContinue attribute="Boolean" context="#stay"/>
|
|
<DetectChar attribute="Symbol" context="#pop" char=")"/>
|
|
|
|
<RegExpr attribute="Identifier" context="#stay" String="[a-zA-Z_\.][0-9a-zA-Z_\.]*[\s]*=(?=([^=]|$))"/>
|
|
|
|
<IncludeRules context="CommonRules"/>
|
|
<DetectChar attribute="Error" context="#stay" char="}" />
|
|
</context>
|
|
|
|
<context attribute="String" lineEndContext="#stay" name="string">
|
|
<DetectChar attribute="String" context="#pop" char="""/>
|
|
<HlCStringChar attribute="String Char" context="#stay"/>
|
|
</context>
|
|
|
|
<context attribute="String" lineEndContext="#stay" name="string2">
|
|
<DetectChar attribute="String" context="#pop" char="'"/>
|
|
<HlCStringChar attribute="String Char" context="#stay"/>
|
|
</context>
|
|
|
|
<context attribute="Identifier" lineEndContext="#stay" name="backquotedsymbol">
|
|
<DetectChar attribute="String" context="#pop" char="`"/>
|
|
<HlCStringChar attribute="String Char" context="#stay"/>
|
|
</context>
|
|
|
|
<context attribute="Headline" lineEndContext="#pop" name="Headline"/>
|
|
<context attribute="Comment" lineEndContext="#pop" name="Comment"/>
|
|
|
|
<!-- This context is not really used, but contains the common rules -->
|
|
<context name="CommonRules" lineEndContext="#stay" attribute="Normal Text" >
|
|
<DetectChar attribute="String" context="string" char="""/>
|
|
<DetectChar attribute="String" context="string2" char="'"/>
|
|
<DetectChar attribute="String" context="backquotedsymbol" char="`"/>
|
|
<keyword attribute="Control Structure" context="#stay" String="controls"/>
|
|
<keyword attribute="Reserved Words" context="#stay" String="words"/>
|
|
<Float attribute="Float" context="#stay"/>
|
|
<Int attribute="Int" context="#stay"/>
|
|
<RegExpr attribute="Keyword" context="#stay" String="[a-zA-Z_]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
|
|
<RegExpr attribute="Keyword" context="#stay" String="\.[a-zA-Z_\.]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
|
|
<RegExpr attribute="Symbol" context="parenthesis" String="\("/>
|
|
<StringDetect attribute="Headline" context="Headline" String="##"/>
|
|
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
|
|
|
<!-- 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 <<-) -->
|
|
<RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~!&\|=>@^])([<]{1,2}\-|\-[>]{1,2})"/>
|
|
<RegExpr attribute="Error" context="#stay" String="([<]{1,2}\-|\-[>]{1,2})([\+\-\*/\^\:\$~!&\|=<@])"/>
|
|
<RegExpr attribute="Error" context="#stay" String="([<]{3}|[>]{3})"/>
|
|
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
|
|
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
|
|
<!-- Much like above: Most other operators are forbidden around = -->
|
|
<RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&\|@^])="/>
|
|
<RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!<>&\|@^])"/>
|
|
<RegExpr attribute="Assign" context="#stay" String="=(?!=)"/>
|
|
|
|
<!-- These operators are fine as long as they're followed by something else or end of line. Error otherwise -->
|
|
<RegExpr attribute="Operator" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,3}|\^|@|\$|~)((?!(\+|\-|\*|/|<=|>=|=|\!=|\||&|:|\^|@|\$|~))|$)"/>
|
|
<RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,3}|\^|@|\$|~){2,}"/>
|
|
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
|
|
|
|
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" />
|
|
|
|
<!-- This is needed only to assist variable based indentation -->
|
|
<DetectChar attribute="Symbol" context="#stay" char="[" />
|
|
<DetectChar attribute="Symbol" context="#stay" char="]" />
|
|
</context>
|
|
</contexts>
|
|
|
|
<itemDatas>
|
|
<!-- KDE default colors: http://accessibility.kde.org/oxygen.php?color=white -->
|
|
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
|
<itemData name="Symbol" defStyleNum="dsNormal"/>
|
|
<itemData name="Keyword" defStyleNum="dsKeyword"/>
|
|
<itemData name="Identifier" defStyleNum="dsDataType"/>
|
|
<itemData name="String" defStyleNum="dsString"/>
|
|
<itemData name="Headline" defStyleNum="dsNormal" color="#b00000" selColor="#b00000" bold="1" italic="0"/> <!-- KDE default color: text 5 -->
|
|
<itemData name="Comment" defStyleNum="dsComment"/>
|
|
<itemData name="Assign" defStyleNum="dsNormal" color="#336366" selColor="#ccc099" bold="1" italic="0"/> <!-- KDE default color: text 7 -->
|
|
<itemData name="Control Structure" defStyleNum="dsNormal" color="#0000bf" selColor="#bfbf00"/> <!-- KDE default color: text 2 -->
|
|
<itemData name="Reserved Words" defStyleNum="dsOthers"/>
|
|
<itemData name="Error" defStyleNum="dsError"/>
|
|
<itemData name="Operator" defStyleNum="dsNormal" color="#803f00" selColor="#000077" bold="0" italic="0"/> <!-- KDE default color: focussed text -->
|
|
<itemData name="String Char" defStyleNum="dsChar"/>
|
|
<itemData name="Float" defStyleNum="dsFloat"/>
|
|
<itemData name="Int" defStyleNum="dsDecVal"/>
|
|
</itemDatas>
|
|
</highlighting>
|
|
|
|
<general>
|
|
<comments>
|
|
<comment name="singleLine" start="#" end=""/>
|
|
</comments>
|
|
<keywords casesensitive="1" />
|
|
</general>
|
|
</language>
|