File: pweave.qnfa

package info (click to toggle)
texstudio 2.8.4%2Bdebian-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 39,108 kB
  • ctags: 13,390
  • sloc: cpp: 84,770; xml: 10,109; ansic: 6,865; sh: 150; makefile: 82
file content (270 lines) | stat: -rw-r--r-- 17,891 bytes parent folder | download
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE QNFA>
<QNFA language="Pweave" extensions="Pnw" defaultLineMark="">
<!-- Note: languages name is used to determine on-line checking. If changed also sources have to be adapted (latexeditorview.cpp) -->

	<context id="pweave" format="pweave-block" transparency="true">	
		<start parenthesis="pweave:open@nocomplete" parenthesisWeight="50" fold="1" format="pweave-delimiter">&lt;%</start>
		<stop parenthesis="pweave:close@nocomplete" parenthesisWeight="50" fold="1" format="pweave-delimiter">%&gt;</stop>
	</context>
	
	<context id="pweave" format="pweave-block" transparency="true">	
		<start parenthesis="sweave:open@nocomplete" parenthesisWeight="30" fold="1" format="pweave-delimiter">&lt;&lt;[^>]*>>=</start>
		<stop parenthesis="sweave:close@nocomplete" parenthesisWeight="30" fold="1" format="pweave-delimiter">@</stop>
	</context>


	<!-- *********************************************************************************************************************
	     TODO: everything below is just copied from tex.qnfa. So it would be better to use <embed target="(La)TeX">
	     However there seems to be a bug that the pweave context is not propagated into other contexts when they are embedded.
		 This results in  $sqrt{2} = <%= sqrt(2) %>$ partly being highlighted as comment.
		 Temporary workaround: It works correctly if we copy the the code.
		 *********************************************************************************************************************-->
	
	<sequence parenthesis="round:open" parenthesisWeight="00">\(</sequence>
	<sequence parenthesis="round:close" parenthesisWeight="00">\)</sequence>
	<sequence parenthesis="texcurly:open" parenthesisWeight="00">\\{</sequence>
	<sequence parenthesis="texcurly:close" parenthesisWeight="00">\\}</sequence>
	<sequence parenthesis="square:open" parenthesisWeight="00">\[</sequence>
	<sequence parenthesis="square:close" parenthesisWeight="00">\]</sequence>

	<sequence parenthesis="foldcomment:open" parenthesisWeight="00" format="magicComment">%[\ \t]*BEGIN_FOLD</sequence>
	<sequence parenthesis="foldcomment:close" parenthesisWeight="00" format="magicComment">%[\ \t]*END_FOLD</sequence>
	
	<!-- ========================= VERBATIM ====================== -->
	
	<foreach loopVar="$v">
		<e>verbatim</e> <e>verbatim\*</e> <e>lstlisting</e> <e>Verbatim</e> <e>BVerbatim</e> <e>Verbatim\*</e> <e>BVerbatim\*</e>
		<body>
			<context id="$v" format="verbatim" transparency="true">
				<start parenthesis="$v:open@nocomplete" parenthesisWeight="30" fold="true" format="extra-keyword">\\begin{$v}</start>
				<stop parenthesis="$v:close@nocomplete" parenthesisWeight="30" fold="true" format="extra-keyword">\\end{$v}</stop>

				<sequence parenthesis="curly:open" parenthesisWeight="10">\{</sequence>
		 		<sequence parenthesis="curly:close" parenthesisWeight="10">\}</sequence>
			</context>
		</body>
	</foreach>

	<!-- ========================= LUA ====================== -->

	<context id="directlua" format="lua" transparency="true">	
		<start parenthesis="directlua:open" parenthesisWeight="30" fold="1" format="keyword">\\directlua{</start>
		<stop parenthesis="directlua:close" parenthesisWeight="30" fold="1" format="keyword">}</stop>
		<embed target="Lua" />
	</context>
	<context id="latelua" format="lua" transparency="true">	
		<start parenthesis="latelua:open" parenthesisWeight="30" fold="1" format="keyword">\\latelua{</start>
		<stop parenthesis="latelua:close" parenthesisWeight="30" fold="1" format="keyword">}</stop>
		<embed target="Lua" />
	</context>
	<!--                           (keywords)                      -->

	<word id="keywords/single" ambiguous="true" format="keyword">\\[\\%&amp;\$]</word>
	<sequence parenthesis="curly:open" parenthesisWeight="10" indent="1" fold="1">\{</sequence>
	<sequence parenthesis="curly:close" parenthesisWeight="10" indent="1" fold="1">\}</sequence>

	<foreach loopVar="$i">
		<e>$</e> <e>+</e> <e>-</e> <e>1</e> <e>!</e> <e>.</e> <e>@</e> <e>#</e> <e>|</e> <e>/</e> <e>\</e> <e>_</e> <e>=</e> <e>x</e>
		<body>
	  	<context id="verb$i" format="verbatim">
			<start parenthesis="verb$i:open" parenthesisWeight="20" format="keyword">\\verb\$i</start>
			<stop parenthesis="verb$i:close" parenthesisWeight="20" format="keyword">\$i</stop>
		</context>
		<context id="verb*$i" format="verbatim">
			<start parenthesis="verb*$i:open" parenthesisWeight="20" format="keyword">\\verb\*\$i</start>
			<stop parenthesis="verb*$i:close" parenthesisWeight="20" format="keyword">\$i</stop>
		</context>
		<context id="lstinline$i" format="verbatim">
			<start parenthesis="lstinline$i:open" parenthesisWeight="20" format="keyword">\\lstinline\$i</start>
			<stop parenthesis="lstinline$i:close" parenthesisWeight="20" format="keyword">\$i</stop>
		</context>
		<context id="lstinlineOption$i" format="verbatim">
			<start parenthesis="lstinlineOption$i:open" parenthesisWeight="20" format="keyword">\\lstinline\[[^\]]*\]\$i</start>
			<stop parenthesis="lstinlineOption$i:close" parenthesisWeight="20" format="keyword">\$i</stop>
		</context>
		</body>
	</foreach>

	<word id="keywords/single" format="align-ampersand">&amp;</word>

	<!-- ========================= COMMAND ====================== -->

	<context id="comment/todo" format="commentTodo" stayOnLine="true" >
		<start>%TODO</start>
		<start>%todo</start>
		<stop exclusive="false">\n</stop>
	</context>
	<context id="comment/todocmd" format="commentTodo" >
		<start>\\todo</start>
		<start>\\missingfigure</start>
		<stop exclusive="false">[^\\]}</stop>
	</context>

	<context id="comment/magic" format="magicComment" stayOnLine="true" >
		<start>% !TeX</start>
		<stop exclusive="false">\n</stop>
	</context>
	
	<context id="comment/single" format="comment" stayOnLine="true" ambiguous="true">
		<start>%</start>
		<stop exclusive="false">\n</stop>
	</context>
	
	<context id="comment/env" format="comment">
		<start parenthesis="commentenv:open@nocomplete" parenthesisWeight="40" fold="1" format="extra-keyword" >\\begin{comment}</start>
		<stop parenthesis="commentenv:close@nocomplete" parenthesisWeight="40" fold="1" format="extra-keyword" >\\end{comment}</stop>
	</context>
	
	<!-- ========================= MATH MODE ====================== -->
	
	<context id="mathmode$$" format="numbers" transparency="true">
		<start parenthesis="math:open$$" parenthesisWeight="50" fold="1" format="math-delimiter" >\$\$</start>
		<stop parenthesis="math:close$$" parenthesisWeight="50" fold="1" format="math-delimiter" >\$\$</stop>

		<sequence parenthesis="leftright(:open" parenthesisWeight="0" format="math-keyword">\\left\(</sequence>
		<sequence parenthesis="leftright(:close" parenthesisWeight="0" format="math-keyword">\\right\)</sequence>
		<sequence parenthesis="leftright[:open" parenthesisWeight="0" format="math-keyword">\\left\[</sequence>
		<sequence parenthesis="leftright[:close" parenthesisWeight="0" format="math-keyword">\\right\]</sequence>
		<sequence parenthesis="leftright{:open" parenthesisWeight="0" format="math-keyword">\\left\\\{</sequence>
		<sequence parenthesis="leftright{:close" parenthesisWeight="0" format="math-keyword">\\right\\\}</sequence>
		<sequence parenthesis="leftright&lt;:open" parenthesisWeight="0" format="math-keyword">\\left\&lt;</sequence>
		<sequence parenthesis="leftright&lt;:close" parenthesisWeight="0" format="math-keyword">\\right\&gt;</sequence>
		<sequence parenthesis="leftright|:open" parenthesisWeight="0" format="math-keyword">\\left|</sequence>
		<sequence parenthesis="leftright|:close" parenthesisWeight="0" format="math-keyword">\\right|</sequence>
		<sequence parenthesis="leftright||:open" parenthesisWeight="0" format="math-keyword">\\left\|</sequence>
		<sequence parenthesis="leftright||:close" parenthesisWeight="0" format="math-keyword">\\right\|</sequence>
		<sequence parenthesis="ceil:open" parenthesisWeight="0" format="math-keyword">\\lceil</sequence>
		<sequence parenthesis="ceil:close" parenthesisWeight="0" format="math-keyword">\\rceil</sequence>
		<sequence parenthesis="floor:open" parenthesisWeight="0" format="math-keyword">\\lfloor</sequence>
		<sequence parenthesis="floor:close" parenthesisWeight="0" format="math-keyword">\\rfloor</sequence>
		<sequence parenthesis="angle:open" parenthesisWeight="0" format="math-keyword">\\langle</sequence>
		<sequence parenthesis="angle:close" parenthesisWeight="0" format="math-keyword">\\rangle</sequence>

		<sequence id="keywords/single" format="math-keyword">\\[a-zA-Z]+</sequence>
	</context>

	<context id="mathmode$" format="numbers" transparency="true">
		<start parenthesis="math:open" parenthesisWeight="40" fold="1" format="math-delimiter" >\$</start>
		<stop parenthesis="math:close" parenthesisWeight="40" fold="1" format="math-delimiter" >\$</stop>

		<sequence parenthesis="leftright(:open" parenthesisWeight="0" format="math-keyword">\\left\(</sequence>
		<sequence parenthesis="leftright(:close" parenthesisWeight="0" format="math-keyword">\\right\)</sequence>
		<sequence parenthesis="leftright[:open" parenthesisWeight="0" format="math-keyword">\\left\[</sequence>
		<sequence parenthesis="leftright[:close" parenthesisWeight="0" format="math-keyword">\\right\]</sequence>
		<sequence parenthesis="leftright{:open" parenthesisWeight="0" format="math-keyword">\\left\\\{</sequence>
		<sequence parenthesis="leftright{:close" parenthesisWeight="0" format="math-keyword">\\right\\\}</sequence>
		<sequence parenthesis="leftright&lt;:open" parenthesisWeight="0" format="math-keyword">\\left\&lt;</sequence>
		<sequence parenthesis="leftright&lt;:close" parenthesisWeight="0" format="math-keyword">\\right\&gt;</sequence>
		<sequence parenthesis="leftright|:open" parenthesisWeight="0" format="math-keyword">\\left|</sequence>
		<sequence parenthesis="leftright|:close" parenthesisWeight="0" format="math-keyword">\\right|</sequence>
		<sequence parenthesis="leftright||:open" parenthesisWeight="0" format="math-keyword">\\left\|</sequence>
		<sequence parenthesis="leftright||:close" parenthesisWeight="0" format="math-keyword">\\right\|</sequence>
		<sequence parenthesis="ceil:open" parenthesisWeight="0" format="math-keyword">\\lceil</sequence>
		<sequence parenthesis="ceil:close" parenthesisWeight="0" format="math-keyword">\\rceil</sequence>
		<sequence parenthesis="floor:open" parenthesisWeight="0" format="math-keyword">\\lfloor</sequence>
		<sequence parenthesis="floor:close" parenthesisWeight="0" format="math-keyword">\\rfloor</sequence>
		<sequence parenthesis="angle:open" parenthesisWeight="0" format="math-keyword">\\langle</sequence>
		<sequence parenthesis="angle:close" parenthesisWeight="0" format="math-keyword">\\rangle</sequence>

		<sequence id="keywords/single" format="math-keyword">\\[a-zA-Z]+</sequence>
	</context>

	<context id="mathmodeNormal" format="numbers" transparency="true">
		<start parenthesis="mathN2:open" parenthesisWeight="40" fold="1" format="math-delimiter" >\\\(</start>
		<stop parenthesis="mathN2:close" parenthesisWeight="40" fold="1" format="math-delimiter" >\\\)</stop>

		<sequence parenthesis="leftright(:open" parenthesisWeight="0" format="math-keyword">\\left\(</sequence>
		<sequence parenthesis="leftright(:close" parenthesisWeight="0" format="math-keyword">\\right\)</sequence>
		<sequence parenthesis="leftright[:open" parenthesisWeight="0" format="math-keyword">\\left\[</sequence>
		<sequence parenthesis="leftright[:close" parenthesisWeight="0" format="math-keyword">\\right\]</sequence>
		<sequence parenthesis="leftright{:open" parenthesisWeight="0" format="math-keyword">\\left\\\{</sequence>
		<sequence parenthesis="leftright{:close" parenthesisWeight="0" format="math-keyword">\\right\\\}</sequence>
		<sequence parenthesis="leftright&lt;:open" parenthesisWeight="0" format="math-keyword">\\left\&lt;</sequence>
		<sequence parenthesis="leftright&lt;:close" parenthesisWeight="0" format="math-keyword">\\right\&gt;</sequence>
		<sequence parenthesis="leftright|:open" parenthesisWeight="0" format="math-keyword">\\left|</sequence>
		<sequence parenthesis="leftright|:close" parenthesisWeight="0" format="math-keyword">\\right|</sequence>
		<sequence parenthesis="leftright||:open" parenthesisWeight="0" format="math-keyword">\\left\|</sequence>
		<sequence parenthesis="leftright||:close" parenthesisWeight="0" format="math-keyword">\\right\|</sequence>
		<sequence parenthesis="ceil:open" parenthesisWeight="0" format="math-keyword">\\lceil</sequence>
		<sequence parenthesis="ceil:close" parenthesisWeight="0" format="math-keyword">\\rceil</sequence>
		<sequence parenthesis="floor:open" parenthesisWeight="0" format="math-keyword">\\lfloor</sequence>
		<sequence parenthesis="floor:close" parenthesisWeight="0" format="math-keyword">\\rfloor</sequence>
		<sequence parenthesis="angle:open" parenthesisWeight="0" format="math-keyword">\\langle</sequence>
		<sequence parenthesis="angle:close" parenthesisWeight="0" format="math-keyword">\\rangle</sequence>

		<sequence id="keywords/single" format="math-keyword">\\[a-zA-Z]+</sequence>

	</context>
	
	<context id="mathmodeDisplay" format="numbers" transparency="true">
		<start parenthesis="mathD2:open" parenthesisWeight="40" fold="1" format="math-delimiter" >\\\[</start>
		<stop parenthesis="mathD2:close" parenthesisWeight="40" fold="1" format="math-delimiter" >\\\]</stop>

		<sequence parenthesis="leftright(:open" parenthesisWeight="0" format="math-keyword">\\left\(</sequence>
		<sequence parenthesis="leftright(:close" parenthesisWeight="0" format="math-keyword">\\right\)</sequence>
		<sequence parenthesis="leftright[:open" parenthesisWeight="0" format="math-keyword">\\left\[</sequence>
		<sequence parenthesis="leftright[:close" parenthesisWeight="0" format="math-keyword">\\right\]</sequence>
		<sequence parenthesis="leftright{:open" parenthesisWeight="0" format="math-keyword">\\left\\\{</sequence>
		<sequence parenthesis="leftright{:close" parenthesisWeight="0" format="math-keyword">\\right\\\}</sequence>
		<sequence parenthesis="leftright&lt;:open" parenthesisWeight="0" format="math-keyword">\\left\&lt;</sequence>
		<sequence parenthesis="leftright&lt;:close" parenthesisWeight="0" format="math-keyword">\\right\&gt;</sequence>
		<sequence parenthesis="leftright|:open" parenthesisWeight="0" format="math-keyword">\\left|</sequence>
		<sequence parenthesis="leftright|:close" parenthesisWeight="0" format="math-keyword">\\right|</sequence>
		<sequence parenthesis="leftright||:open" parenthesisWeight="0" format="math-keyword">\\left\|</sequence>
		<sequence parenthesis="leftright||:close" parenthesisWeight="0" format="math-keyword">\\right\|</sequence>
		<sequence parenthesis="ceil:open" parenthesisWeight="0" format="math-keyword">\\lceil</sequence>
		<sequence parenthesis="ceil:close" parenthesisWeight="0" format="math-keyword">\\rceil</sequence>
		<sequence parenthesis="floor:open" parenthesisWeight="0" format="math-keyword">\\lfloor</sequence>
		<sequence parenthesis="floor:close" parenthesisWeight="0" format="math-keyword">\\rfloor</sequence>
		<sequence parenthesis="angle:open" parenthesisWeight="0" format="math-keyword">\\langle</sequence>
		<sequence parenthesis="angle:close" parenthesisWeight="0" format="math-keyword">\\rangle</sequence>

		<sequence id="keywords/single" format="math-keyword">\\[a-zA-Z]+</sequence>
	</context>


	<!-- ========================= PICTURES ====================== -->
	<foreach loopVar="$env">
		<e>tikzpicture</e> <e>pspicture</e> <e>pspicture\*</e> <e>picture</e> <e>picture\*</e> <e>asy</e>
		<body>
		<context id="$env" format="picture" transparency="true">	
			<start parenthesis="$env:open@nocomplete" parenthesisWeight="30" fold="1" format="extra-keyword">\\begin{$env}</start>
			<stop parenthesis="$env:close@nocomplete" parenthesisWeight="30" fold="1" format="extra-keyword">\\end{$env}</stop>
		</context>        
		</body>
	</foreach>
        
	<!-- ========================= GENERAL BLOCKS ====================== -->

	<word parenthesis="block:open@nocomplete" parenthesisWeight="30" fold="1" indent="1" ambiguous="true" format="extra-keyword">\\begin{[^}]*}</word>
	<word parenthesis="block:close@nocomplete" parenthesisWeight="30" fold="1" indent="1" format="extra-keyword" >\\end{[^}]*}</word>
<!--
        <context id="env" format="normal" transparency="true">
                <start parenthesis="env:open@nocomplete" parenthesisWeight="30" fold="true" format="extra-keyword">\\begin{[^}]*}</start>
                <stop parenthesis="env:close@nocomplete" parenthesisWeight="30" fold="true" format="extra-keyword">\\end{[^}]*}</stop>

                <sequence parenthesis="curly:open" parenthesisWeight="10">\{</sequence>
                <sequence parenthesis="curly:close" parenthesisWeight="10">\}</sequence>
        </context>
-->

	<!-- ========================= SECTIONS ====================== -->

	<list id="keywords/block" format="extra-keyword">
		<word parenthesis="part:boundary@nomatch" parenthesisWeight="8" fold="true">\\part</word>
		<word parenthesis="chapter:boundary@nomatch" parenthesisWeight="7" fold="true">\\chapter</word>
		<word parenthesis="section:boundary@nomatch" parenthesisWeight="6" fold="true">\\section</word>
		<word parenthesis="subsection:boundary@nomatch" parenthesisWeight="5" fold="true">\\subsection</word>
		<word parenthesis="subsubsection:boundary@nomatch" parenthesisWeight="4" fold="true">\\subsubsection</word>
		<word parenthesis="paragraph:boundary@nomatch" parenthesisWeight="3" fold="true" >\\paragraph</word>
		<word parenthesis="subparagraph:boundary@nomatch" parenthesisWeight="2" fold="true" >\\subparagraph</word>
	</list>
	
	<!-- ========================= GENERAL COMMANDS ====================== -->

	<!--sequence instead of word so things like \abc434 are correctly highlighted -->
	<sequence id="keywords/single" ambiguous="true" format="keyword">\\[a-zA-Z@]+</sequence>

</QNFA>