blob: b4ce9600c57548905a2a239b4ba3ace11f4bee6f (
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
========================================================================
YACC.XML supports syntax highlighting for Yacc/Bison source under Kate.
Copyright (C) 2004 - Jan Villat <[email protected]>
This code is released under the LGPL as part of tdelibs/kate.
========================================================================
Updates for YACC.XML can be obtained from http://kate.kde.org/hl/
UPDATE HISTORY:-
2004.05.26 - YACC.XML 1.00 - First released.
TODO:-
- Add a mime type (cannot find it !?)
========================================================================
-->
<language name="Yacc/Bison" version="1.03" kateversion="2.4" section="Sources" extensions="*.y" author="Jan Villat ([email protected])" license="LGPL">
<highlighting>
<contexts>
<context name="Pre Start" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectSpaces />
<Detect2Chars attribute="Content-Type Delimiter" context="C Declarations" char="%" char1="{" beginRegion="cdeclarations" column="0" />
<RegExpr attribute="Normal Text" context="Declarations" String="." beginRegion="declarations" lookAhead="true" />
</context>
<context name="C Declarations" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<Detect2Chars attribute="Content-Type Delimiter" context="#pop" char="%" char1="}" endRegion="cdeclarations" column="0" />
<IncludeRules context="##C++" />
</context>
<context name="Declarations" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<StringDetect attribute="Directive" context="Union Start" String="%union" />
<Detect2Chars attribute="Content-Type Delimiter" context="Rules" char="%" char1="%" beginRegion="rules" endRegion="declarations" />
<!-- not sure that strict yacc allows that ... but it is commonly used -->
<Detect2Chars attribute="Content-Type Delimiter" context="C Declarations" char="%" char1="{" beginRegion="cdeclarations" column="0" />
<DetectChar attribute="Directive" context="Percent Command" char="%" />
</context>
<context name="Union Start" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectSpaces />
<DetectChar attribute="Normal Text" context="Union In" char="{" beginRegion="union" />
<RegExpr attribute="Alert" context="#pop" String="." />
</context>
<context name="Union In" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="Union InIn" char="{" />
<DetectChar attribute="Normal Text" context="#pop#pop" char="}" endRegion="union" />
<IncludeRules context="##C++" />
</context>
<context name="Union InIn" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="Union InIn" char="{" />
<DetectChar attribute="Normal Text" context="#pop" char="}" />
<IncludeRules context="##C++" />
</context>
<context name="Rules" attribute="Rule" lineEndContext="#stay">
<IncludeRules context="Comment" />
<Detect2Chars attribute="Content-Type Delimiter" context="User Code" char="%" char1="%" beginRegion="code" endRegion="rules" />
<DetectChar attribute="Normal Text" context="Rule In" char=":" beginRegion="rule" />
</context>
<context name="Rule In" attribute="Definition" lineEndContext="#stay">
<IncludeRules context="Comment" />
<DetectChar attribute="Normal Text" context="#pop" char=";" endRegion="rule" />
<DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
<DetectChar attribute="Normal Text" context="#stay" char="|" />
<IncludeRules context="StringOrChar" />
</context>
<context name="User Code" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="##C++" />
</context>
<context name="Percent Command" attribute="Directive" lineEndContext="#pop">
<IncludeRules context="Comment" />
<RegExpr attribute="Normal Text" context="Percent Command In" String="\W" lookAhead="true" />
</context>
<context name="Percent Command In" attribute="NormalText" lineEndContext="#pop#pop">
<IncludeRules context="StringOrChar" />
<DetectChar attribute="Data Type" context="PC type" char="<" />
</context>
<context name="PC type" attribute="Data Type" lineEndContext="#pop#pop#pop">
<DetectChar attribute="Data Type" context="#pop" char=">" />
</context>
<context name="Comment" attribute="Comment">
<Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" />
<!-- not sure that strict yacc allows that ... but I saw it in some sources ... -->
<Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" />
</context>
<context name="CommentStar" attribute="Comment" lineEndContext="#stay">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" />
</context>
<context name="CommentSlash" attribute="Comment" lineEndContext="#stay">
<RegExpr attribute="Comment" context="#pop" String="[^\\]$" />
</context>
<context name="StringOrChar" attribute="NormalText">
<DetectChar attribute="String Char" context="Char" char="'" />
<DetectChar attribute="String" context="String" char=""" />
</context>
<context name="String" attribute="String" lineEndContext="#pop">
<RegExpr attribute="Backslash Code" context="#stay" String="\\." />
<DetectChar attribute="String" context="#pop" char=""" />
</context>
<context name="Char" attribute="String Char" lineEndContext="#pop">
<RegExpr attribute="Backslash Code" context="#stay" String="\\." />
<DetectChar attribute="String Char" context="#pop" char="'" />
</context>
<context name="Normal C Bloc" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="Normal Text" context="Normal C Bloc" char="{" beginRegion="bloc" />
<DetectChar attribute="Normal Text" context="#pop" char="}" endRegion="bloc" />
<IncludeRules context="##C++" />
<DetectChar attribute="Directive" context="Dol" char="$" />
</context>
<context name="Dol" attribute="Normal Text" fallthrough="true" fallthroughContext="DolEnd">
<RegExpr attribute="Data Type" context="DolEnd" String="<[^>]+>" />
</context>
<context name="DolEnd" attribute="Normal Text">
<RegExpr attribute="Directive" context="#pop#pop" String="\d+" />
<DetectChar attribute="Directive" context="#pop#pop" char="$" />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Definition" defStyleNum="dsNormal" />
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Content-Type Delimiter" defStyleNum="dsBaseN" bold="1" />
<itemData name="Directive" defStyleNum="dsKeyword"/>
<itemData name="Rule" defStyleNum="dsString" />
<itemData name="Backslash Code" defStyleNum="dsString" bold="1" />
<itemData name="Alert" defStyleNum="dsAlert" />
<itemData name="String" defStyleNum="dsString"/>
<itemData name="String Char" defStyleNum="dsChar"/>
<itemData name="Data Type" defStyleNum="dsDataType"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="multiLine" start="/*" end="*/" />
</comments>
</general>
</language>
<!-- kate: space-indent on; indent-width 2; replace-tabs on; -->
|