You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two fundamental notions in QCE syntax files : contexts and "regular" matches.<p>
241
-
The concept of context is extremely powerful while remaining extremely simple. The syntax engine enters a context when a given start token is matched and it leaves it when a stop token is matched. Within a context there can be any number of contexts and "regular" matches. contexts are typically used to match comments, strings or other special blocks of code.<p>
242
-
"Regular" matches are what one would expect them to be : simple tokens. They can be matched from either regular expressions or plain strings. Start and stop tokens of context are "regular" matches in a way, except that they also trigger the context enter/leave event.<p>
241
+
The concept of context is extremely powerful while remaining extremely simple. The syntax engine enters a context when a given start token is matched and it leaves it when a stop token is matched. Within a context there can be any number of contexts and "regular" matches. Contexts are typically used to match comments, strings or other special blocks of code.<p>
242
+
"Regular" matches are what one would expect them to be : simple tokens. They can be matched from either regular expressions or plain strings. Start and stop tokens of a context are "regular" matches in a way, except that they also trigger the context enter/leave event.<p>
243
243
<h3>Syntax file structure</h3>
244
244
<p>
245
245
Now, on to the analysis of the structure of a syntax file.<p>
246
-
The root element of the document is a <QNFA> tag. It provides various informations in its attributes.<p>
246
+
The root element of the document is a <QNFA> tag. It provides various information in its attributes.<p>
247
247
<ul>
248
248
<li>
249
249
<b>language</b> : this attribute specifies the name of the language supported by the syntax file. </li>
The QNFA tag represents the root context of the language. It can contain any number of the following tags :<p>
257
257
<ul>
258
258
<li>
259
-
<b>context</b> : defines a context. To be valid, requires children tags of type <b>start</b> and <b>stop</b>.<p>
259
+
<b>context</b> : defines a context. To be valid, requires child tags of type <b>start</b> and <b>stop</b>.<p>
260
260
</li>
261
261
<li>
262
-
<b>sequence</b> : defines a "regular" match. The value of this element is always assumed to be a regexp (no internal optimizations attempt for plain strings).<p>
262
+
<b>sequence</b> : defines a "regular" match. The value of this element is always assumed to be a regexp (no internal optimizations attempts for plain strings).<p>
263
263
</li>
264
264
<li>
265
265
<b>word</b> : defines a "regular" match. The value of this element is checked to determine whether it can be matched as a plain string (internal optimizations). Additionally, this element will ONLY be matched at word boundaries. For instance, if the value of a word element is for, it will not be matched in "foreach" while it would have been, if declared using a <b>sequence</b> tag.<p>
266
266
</li>
267
267
<li>
268
-
<b>list</b> : this is a "meta-element" used to group regular matches and give them the same attributes as they are propagated from the this element to its children. Subrouping (nesting <b>list</b> elements) is NOT supported.<p>
268
+
<b>list</b> : this is a "meta-element" used to group regular matches and give them the same attributes as they are propagated from the this element to its children. Subgrouping (nesting <b>list</b> elements) is NOT supported.<p>
269
269
</li>
270
270
<li>
271
-
<b>embed</b> : this is a "meta-element" which allows embedding of other languages or contexts to help reducing duplication of content and make maintenance of syntax files easier. The embedding target is specified through the <em>target</em> attribute. </li>
271
+
<b>embed</b> : this is a "meta-element" which allows embedding of other languages or contexts to help reduce duplication of content and make maintenance of syntax files easier. The embedding target is specified through the <em>target</em> attribute. </li>
272
272
</ul>
273
273
<p>
274
-
Additionally, the following tags are valid inside a <b>context</b> block (and, again, their number isn't limited). Also note that, while ordering of all tags above within a context DO matter, ordering of the tags below DO NOT matter.<p>
274
+
Additionally, the following tags are valid inside a <b>context</b> block (and, again, their number isn't limited). Also note that, while ordering of all tags above within a context DOES matter, ordering of the tags below DOES NOT matter.<p>
275
275
<ul>
276
276
<li>
277
277
<b>start</b> : defines a context start token as a "regular" match (remarks made about the <b>word</b> tag apply to this one as well).<p>
<b>stop</b> : defines a context stop token as a "regular" match (remarks made about the <b>word</b> tag apply to this one as well).<p>
281
281
</li>
282
282
<li>
283
-
<b>escape</b> : defines a special token as a "regular" match (remarks made about the <b>sequence</b> tag apply to this one as well). This element is used for the very common case of escape sequences which may prevent a stop token from being one. In most case it is however recommended to favor explicit escape match through a <b>sequence</b>, for instance in C-like strings the following construct is used : <divclass="fragment"><preclass="fragment"> <sequence <spanclass="keywordtype">id</span>=<spanclass="stringliteral">"escape"</span> format=<spanclass="stringliteral">"escapeseq"</span> >\\[nrtvf\\<spanclass="stringliteral">"'\n\n]</sequence> </span>
283
+
<b>escape</b> : defines a special token as a "regular" match (remarks made about the <b>sequence</b> tag apply to this one as well). This element is used for the very common case of escape sequences which may prevent a stop token from being one. In most cases it is however recommended to favor explicit escape match through a <b>sequence</b>, for instance in C-like strings the following construct is used : <divclass="fragment"><preclass="fragment"> <sequence <spanclass="keywordtype">id</span>=<spanclass="stringliteral">"escape"</span> format=<spanclass="stringliteral">"escapeseq"</span> >\\[nrtvf\\<spanclass="stringliteral">"'\n\n]</sequence> </span>
<b>format</b> : specifies the format to be applied to the matches (highlighting). This property is propagated.<p>
291
291
</li>
292
292
<li>
293
-
<b>id</b> : assign an identifier to the element. This is only used for contexts at the moment however and the only "external" use of it occurs in the <b>embed</b> tag. </li>
293
+
<b>id</b> : assigns an identifier to the element. This is only used for contexts at the moment however and the only "external" use of it occurs in the <b>embed</b> tag. </li>
294
294
</ul>
295
295
<p>
296
296
Additionally all tags, except <b>context</b> and <b>list</b>, support the following extra attributes :<p>
0 commit comments