summaryrefslogtreecommitdiffstats
path: root/kate/data/mergetagtext.xml
blob: e7da98bc4b6952bc1a54e9e74c3f5680c7091986 (plain)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
  Copyright 2008 Diggory Hardy
  
  Author: Diggory Hardy <[email protected]>
  
  This contains highlighting for mergetag text files, a sub-part of the mde project.
  dsource.org/projects/mde
  
 **********************************************************************
 * This library is free software; you can redistribute it and/or      *
 * modify it under the terms of the GNU Lesser General Public         *
 * License as published by the Free Software Foundation; either       *
 * version 2 of the License, or (at your option) any later version.   *
 *                                                                    *
 * This library 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  *
 * Lesser General Public License for more details.                    *
 *                                                                    *
 * You should have received a copy of the GNU Lesser General Public   *
 * License along with this library; if not, write to the              *
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,   *
 * Boston, MA  02110-1301, USA.                                       *
 **********************************************************************
 -->
<language name="mergetag text" version="0.1" kateversion="2.4" section="Configuration" author="Diggory Hardy ([email protected])" license="LGPL" extensions="*.mtt;">
  <highlighting>
    <contexts>
      <context name="Normal" attribute="Error" lineEndContext="#stay">
        <DetectSpaces />
        <Detect2Chars attribute="Comment Brackets" context="SecComment" char="!" char1="{" beginRegion="SecComment" />
        <Detect2Chars attribute="Comment Brackets" context="TagCommentType" char="!" char1="&lt;" />
        <DetectChar attribute="Brackets" context="SectionIdentifier" char="{" beginRegion="SecID" />
        <DetectChar attribute="Tag Character" context="TagType" char="&lt;" />
      </context>
      
      <context name="SectionIdentifier" attribute="ID" lineEndContext="#stay">
        <DetectChar attribute="Brackets" context="#pop" char="}" endRegion="SecID" />
      </context>
      
      <context name="SecComment" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment Brackets" context="#pop" char="}" endRegion="SecComment" />
        <DetectChar attribute="Comment Brackets" context="SecComment" char="{" beginRegion="SecID" />
      </context>
      
      <context name="TagType" attribute="Type" lineEndContext="#stay">
        <DetectChar attribute="Tag Character" context="TagID" char="|" />
        <IncludeRules context="TagErrors" />
      </context>
      <context name="TagID" attribute="ID" lineEndContext="#stay">
        <DetectChar attribute="Tag Character" context="TagData" char="=" />
        <IncludeRules context="TagErrors" />
      </context>
      <context name="TagData" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Tag Character" context="#pop#pop#pop" char="&gt;" />
        
        <DetectChar attribute="Char"     context="CharLiteral" char="'"/>
        <DetectChar attribute="String"   context="String"      char="&quot;"/>
        <!-- Number literals -->
        <Float attribute="Float" context="#stay" />
        <RegExpr attribute="Binary" context="#pop" String="0[bB][01]+"/>
        <RegExpr attribute="Octal" context="#pop" String="0[oO][0-7]+"/>
        <HlCHex attribute="Hex" context="#stay"/>
        <Int attribute="Integer" context="#stay" />
        
        <IncludeRules context="TagErrors" />
      </context>
      <context name="TagErrors" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Error" context="#stay" char="&lt;" />
        <DetectChar attribute="Error" context="#stay" char="|" />
        <DetectChar attribute="Error" context="#stay" char="=" />
        <DetectChar attribute="Error" context="#stay" char="&gt;" />
      </context>
      
      <context name="TagCommentType" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment Brackets" context="TagCommentID" char="|" />
        <IncludeRules context="TagErrors" />
      </context>
      <context name="TagCommentID" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment Brackets" context="TagCommentData" char="=" />
        <IncludeRules context="TagErrors" />
      </context>
      <context name="TagCommentData" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment Brackets" context="#pop#pop#pop" char="&gt;" />
        <DetectChar attribute="Comment" context="CommentChar" char="'"/>
        <DetectChar attribute="Comment" context="CommentString" char="&quot;"/>
        <IncludeRules context="TagErrors" />
      </context>
      <context name="CommentString" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment" context="#pop" char="&quot;" />
        <RegExpr String="\\." attribute="Comment" context="#stay"/>
      </context>
      <context name="CommentChar" attribute="Comment" lineEndContext="#stay">
        <DetectChar attribute="Comment" context="#pop" char="'" />
        <RegExpr String="\\." attribute="Comment" context="#stay"/>
      </context>
      
      <!-- 'char' -->
      <context name="CharLiteral" attribute="Char" lineEndContext="CharLiteralClosing" fallthrough="true" fallthroughContext="#pop">
        <!-- Empty '' -->
        <DetectChar   attribute="Char" context="#pop"  char="'"/>
        <HlCStringChar attribute="EscapeSequence" context="CharLiteralClosing"/>
        <RegExpr attribute="Char" context="CharLiteralClosing" String="."/>
      </context>
      <!-- Anything other than a closing ' is now be an error -->
      <context name="CharLiteralClosing" attribute="Error" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="#pop#pop">
        <DetectChar attribute="Char" context="#pop#pop"  char="'"/>
      </context>
      <!-- "string" -->
      <context name="String" attribute="String" lineEndContext="#stay">
        <HlCStringChar attribute="EscapeSequence"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>
      </context>
    </contexts>
    
    <itemDatas>
      <itemData name="Brackets"         defStyleNum="dsKeyword"/>
      <itemData name="Tag Character"    defStyleNum="dsKeyword" color="#008040"/>
      <itemData name="Type"             defStyleNum="dsDataType"/>
      <itemData name="Error"            defStyleNum="dsError"/>
      <itemData name="Comment Brackets" defStyleNum="dsComment" italic="0" color="#404040" />
      <itemData name="Comment"          defStyleNum="dsComment"/>
      <itemData name="Normal Text"      defStyleNum="dsNormal"/>
      <itemData name="ID"               defStyleNum="dsOthers"/>
      
      <itemData name="Integer"        defStyleNum="dsDecVal"/>
      <itemData name="Binary"         defStyleNum="dsBaseN"/>
      <itemData name="Octal"          defStyleNum="dsBaseN"/>
      <itemData name="Hex"            defStyleNum="dsBaseN"/>
      <itemData name="Float"          defStyleNum="dsFloat"/>
      
      <itemData name="EscapeSequence" defStyleNum="dsString"   color="#00aa88" selColor="#ff0000"/>
      <itemData name="String"         defStyleNum="dsString"/>
      <itemData name="Char"           defStyleNum="dsChar"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="multiLine"  start="!{" end="}" region="SecComment"/>
    </comments>
    <keywords casesensitive="true" />
  </general>
</language>