summaryrefslogtreecommitdiffstats
path: root/kate/data/grammar.xml
blob: 8156c404bcbb8870b6ea1b37dc1f04a93ae9faa7 (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">
<!--
  Syntax definition for tdev-pg/tdev-pg-qt grammars.
-->
<language name="KDev-PG[-Qt] Grammar" version="0.24" kateversion="2.5" section="Sources" extensions="*.g" casesensitive="1" author="Milian Wolff ([email protected]), Jonathan Schmidt-DominĂ© ([email protected])" license="">
  <highlighting>
    <list name="macros">
      <item> ast_extra_members </item>
      <item> export_macro </item>
      <item> export_macro_header </item>
      <item> namespace </item>
      <item> parserclass </item>
      <item> token </item>
      <item> token_stream </item>
      <item> parser_declaration_header </item>
      <item> parser_bits_header </item>
      <item> ast_header </item>
      <item> ast_base </item>
      <item> parser_base </item>
      <item> bin </item>
      <item> pre </item>
      <item> post </item>
      <item> tern </item>
      <item> paren </item>
      <item> left </item>
      <item> right </item>
      <item> &lt; </item>
      <item> &gt; </item>
    </list>
    <list name="keywords">
      <item> try/rollback </item>
      <item> try/recover </item>
      <item> catch </item>
    </list>
    <list name="access">
      <item> public </item>
      <item> protected </item>
      <item> private </item>
    </list>
    <list name="locations">
      <item> declaration </item>
      <item> destructor </item>
      <item> constructor </item>
    </list>
    
    <contexts>
      <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
        <!-- keywords -->
        <DetectChar attribute="Keyword" context="Macros" char="%" firstNonSpace="true" />
        <keyword attribute="Keyword" context="#stay" String="keywords" />
        <keyword attribute="Access" context="#stay" String="access" />
        <keyword attribute="Location" context="#stay" String="locations" />
        <!-- numbers -->
        <Float attribute="Float" context="#stay" />
        <Int attribute="Decimal" context="#stay" />
        <!-- strings -->
        <DetectChar attribute="String" context="String" char="&quot;" />
        <!-- comments -->
        <Detect2Chars attribute="Comment" context="SingleLineComment" char="-" char1="-" />
        <!-- code segments -->
        <Detect2Chars attribute="Code Segment" context="CodeSegment" char="[" char1=":" beginRegion="code" />
        <!-- tokens are all-uppercase -->
        <RegExpr attribute="Token" insensitive="false" context="#stay" String="\b[A-Z_]+\b" />
        <!-- simple use of an ASTNode without assigning it -->
        <RegExpr attribute="AstNode" insensitive="true" context="#stay" String="\b[a-z]+\b(?!=)" />
        <!-- member=ASTNode -->
        <DetectChar attribute="Symbol" context="MemberAst" char="=" />
        <!-- -> ASTNode -->
        <Detect2Chars attribute="Symbol" context="AstDecl" char="-" char1=">" />
        <!-- symbols -->
        <AnyChar attribute="Symbol" context="#stay" String=";[()]->|=*#@:?" />
      </context>
      <!-- keywords -->
      <context name="Macros" attribute="Keyword" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
        <keyword attribute="Keyword" context="#stay" String="macros" />
        <Detect2Chars lookAhead="true" context="#pop" attribute="Normal Text" char="[" char1=":" />
        <Detect2Chars context="#pop" attribute="Keyword" char=";" char1=";" />
      </context>
      <!-- "string" -->
      <context name="String" attribute="String" lineEndContext="#stay">
        <HlCStringChar attribute="String Char" context="#stay" />
        <DetectChar attribute="String" context="#pop" char="&quot;" />
      </context>
      <!-- comments -->
      <context name="SingleLineComment" attribute="Comment" lineEndContext="#pop"/>
      <!-- code segments -->
      <context name="CodeSegment" attribute="Code Segmentt" lineEndContext="#stay">
        <Detect2Chars attribute="Code Segment" context="#pop" char=":" char1="]" endRegion="code" />
        <IncludeRules context="##C++" />
      </context>
      <!-- memberVar=AstNode -->
      <context name="MemberAst" attribute="AstNode" lineEndContext="#pop">
        <DetectSpaces />
        <!-- tokens are all-uppercase -->
        <RegExpr attribute="Token" insensitive="false" context="#pop" String="\b[A-Z_]+\b" />
        <DetectIdentifier attribute="AstNode" context="#pop" />
      </context>
      <!-- -> AstNode -->
      <context name="AstDecl" attribute="Error" lineEndContext="#stay">
        <DetectSpaces attribute="Normal Text" />
        <DetectIdentifier attribute="AstNode" />
        <DetectChar char="[" attribute="Symbol" context="AstMemberDecl" />
        <Detect2Chars char=";" char1=";" attribute="Symbol" context="#pop" />
      </context>
      <!-- member or temporary variables -->
      <context name="AstMemberDecl" attribute="Normal Text" lineEndContext="#stay">
        <DetectSpaces />
        <RegExpr attribute="Keyword" String="\b(member|temporary)\s+variable\b" />
        <DetectIdentifier attribute="AstMember" />
        <DetectChar attribute="Symbol" char=":" context="AstMemberType" />
        <DetectChar attribute="Symbol" char="]" context="#pop" />
      </context>
      <context name="AstMemberType" attribute="Normal Text" lineEndContext="#stay">
        <DetectIdentifier attribute="AstMemberType" />
        <DetectChar attribute="Symbol" char=";" context="#pop" />
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" />
      <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false" />
      <itemData name="Access" defStyleNum="dsDataType" spellChecking="false" />
      <itemData name="Location" defStyleNum="dsOthers" spellChecking="false" />
      <itemData name="Decimal"  defStyleNum="dsDecVal" spellChecking="false" />
      <itemData name="Float"  defStyleNum="dsFloat" spellChecking="false" />
      <itemData name="String" defStyleNum="dsString" />
      <itemData name="String Char" defStyleNum="dsChar" spellChecking="false" />
      <itemData name="Comment" defStyleNum="dsComment" />
      <itemData name="Symbol" defStyleNum="dsOthers" />
      <itemData name="Code Segment" defStyleNum="dsFunction" />
      <itemData name="Token" defStyleNum="dsKeyword" spellChecking="false" />
      <itemData name="AstNode" defStyleNum="dsFunction" spellChecking="false" />
      <itemData name="Error" defStyleNum="dsError" spellChecking="false" />
      <itemData name="AstMember" defStyleNum="dsNormal" spellChecking="false" />
      <itemData name="AstMemberType" defStyleNum="dsDataType" spellChecking="false" />
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="--" />
    </comments>
    <keywords casesensitive="true" weakDeliminator="/" />
  </general>
</language>