Mercurial > hg > xemacs-beta
annotate src/syntax.h @ 5313:5ed261fd2bd9
Unrool a load-time loop at macro expansion time, cl-macs.el
2010-12-29 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
Unroll a loop here at macro-expansion time, so these compiler
macros are compiled. Use #'eql instead of #'eq in a couple of
places for better style.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 29 Dec 2010 23:43:10 +0000 |
parents | a9c41067dd88 |
children | 308d34e9f07d |
rev | line source |
---|---|
428 | 1 /* Declarations having to do with XEmacs syntax tables. |
2 Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc. | |
1296 | 3 Copyright (C) 2002, 2003 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: FSF 19.28. */ | |
23 | |
440 | 24 #ifndef INCLUDED_syntax_h_ |
25 #define INCLUDED_syntax_h_ | |
428 | 26 |
27 #include "chartab.h" | |
28 | |
29 /* A syntax table is a type of char table. | |
30 | |
31 The low 7 bits of the integer is a code, as follows. The 8th bit is | |
32 used as the prefix bit flag (see below). | |
33 | |
34 The values in a syntax table are either integers or conses of | |
35 integers and chars. The lowest 7 bits of the integer are the syntax | |
36 class. If this is Sinherit, then the actual syntax value needs to | |
37 be retrieved from the standard syntax table. | |
38 | |
39 Since the logic involved in finding the actual integer isn't very | |
40 complex, you'd think the time required to retrieve it is not a | |
41 factor. If you thought that, however, you'd be wrong, due to the | |
42 high number of times (many per character) that the syntax value is | |
43 accessed in functions such as scan_lists(). To speed this up, | |
44 we maintain a mirror syntax table that contains the actual | |
45 integers. We can do this successfully because syntax tables are | |
46 now an abstract type, where we control all access. | |
47 */ | |
48 | |
49 enum syntaxcode | |
50 { | |
51 Swhitespace, /* whitespace character */ | |
52 Spunct, /* random punctuation character */ | |
53 Sword, /* word constituent */ | |
54 Ssymbol, /* symbol constituent but not word constituent */ | |
55 Sopen, /* a beginning delimiter */ | |
56 Sclose, /* an ending delimiter */ | |
57 Squote, /* a prefix character like Lisp ' */ | |
58 Sstring, /* a string-grouping character like Lisp " */ | |
59 Smath, /* delimiters like $ in TeX. */ | |
60 Sescape, /* a character that begins a C-style escape */ | |
61 Scharquote, /* a character that quotes the following character */ | |
62 Scomment, /* a comment-starting character */ | |
63 Sendcomment, /* a comment-ending character */ | |
64 Sinherit, /* use the standard syntax table for this character */ | |
460 | 65 Scomment_fence, /* Starts/ends comment which is delimited on the |
66 other side by a char with the same syntaxcode. */ | |
67 Sstring_fence, /* Starts/ends string which is delimited on the | |
68 other side by a char with the same syntaxcode. */ | |
428 | 69 Smax /* Upper bound on codes that are meaningful */ |
70 }; | |
71 | |
72 enum syntaxcode charset_syntax (struct buffer *buf, Lisp_Object charset, | |
73 int *multi_p_out); | |
74 | |
1296 | 75 void update_syntax_table (Lisp_Object table); |
76 | |
77 DECLARE_INLINE_HEADER ( | |
78 void | |
79 update_mirror_syntax_if_dirty (Lisp_Object table) | |
80 ) | |
81 { | |
82 if (XCHAR_TABLE (table)->dirty) | |
83 update_syntax_table (table); | |
84 } | |
85 | |
428 | 86 /* Return the syntax code for a particular character and mirror table. */ |
87 | |
1296 | 88 DECLARE_INLINE_HEADER ( |
1315 | 89 int |
1296 | 90 SYNTAX_CODE (Lisp_Object table, Ichar c) |
91 ) | |
92 { | |
93 type_checking_assert (XCHAR_TABLE (table)->mirror_table_p); | |
94 update_mirror_syntax_if_dirty (table); | |
1315 | 95 return XINT (get_char_table_1 (c, table)); |
1296 | 96 } |
97 | |
98 #ifdef NOT_WORTH_THE_EFFORT | |
99 | |
100 /* Same but skip the dirty check. */ | |
101 | |
102 DECLARE_INLINE_HEADER ( | |
1315 | 103 int |
1296 | 104 SYNTAX_CODE_1 (Lisp_Object table, Ichar c) |
105 ) | |
106 { | |
107 type_checking_assert (XCHAR_TABLE (table)->mirror_table_p); | |
108 return (enum syntaxcode) XINT (get_char_table_1 (c, table)); | |
109 } | |
110 | |
111 #endif /* NOT_WORTH_THE_EFFORT */ | |
428 | 112 |
113 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177)) | |
826 | 114 |
428 | 115 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c)) |
116 | |
826 | 117 DECLARE_INLINE_HEADER ( |
118 int | |
867 | 119 WORD_SYNTAX_P (Lisp_Object table, Ichar c) |
826 | 120 ) |
428 | 121 { |
122 return SYNTAX (table, c) == Sword; | |
123 } | |
124 | |
125 /* OK, here's a graphic diagram of the format of the syntax values: | |
126 | |
127 Bit number: | |
128 | |
129 [ 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ] | |
130 [ 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ] | |
131 | |
132 <-----> <-----> <-------------> <-------------> ^ <-----------> | |
133 ELisp unused |comment bits | unused | syntax code | |
134 tag | | | | | | | | | | |
135 stuff | | | | | | | | | | |
136 | | | | | | | | | | |
137 | | | | | | | | `--> prefix flag | |
138 | | | | | | | | | |
139 | | | | | | | `--> comment end style B, second char | |
140 | | | | | | `----> comment end style A, second char | |
141 | | | | | `------> comment end style B, first char | |
142 | | | | `--------> comment end style A, first char | |
143 | | | `----------> comment start style B, second char | |
144 | | `------------> comment start style A, second char | |
145 | `--------------> comment start style B, first char | |
146 `----------------> comment start style A, first char | |
147 | |
148 In a 64-bit integer, there would be 32 more unused bits between | |
149 the tag and the comment bits. | |
150 | |
151 Clearly, such a scheme will not work for Mule, because the matching | |
3498 | 152 paren could be any character and as such requires 21 bits, which |
428 | 153 we don't got. |
154 | |
155 Remember that under Mule we use char tables instead of vectors. | |
156 So what we do is use another char table for the matching paren | |
157 and store a pointer to it in the first char table. (This frees | |
158 code from having to worry about passing two tables around.) | |
159 */ | |
160 | |
161 | |
162 /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */ | |
163 | |
164 #define SYNTAX_PREFIX(table, c) \ | |
165 ((SYNTAX_CODE (table, c) >> 7) & 1) | |
166 | |
167 /* Bits 23-16 are used to implement up to two comment styles | |
168 in a single buffer. They have the following meanings: | |
169 | |
170 1. first of a one or two character comment-start sequence of style a. | |
171 2. first of a one or two character comment-start sequence of style b. | |
172 3. second of a two-character comment-start sequence of style a. | |
173 4. second of a two-character comment-start sequence of style b. | |
174 5. first of a one or two character comment-end sequence of style a. | |
175 6. first of a one or two character comment-end sequence of style b. | |
176 7. second of a two-character comment-end sequence of style a. | |
177 8. second of a two-character comment-end sequence of style b. | |
178 */ | |
179 | |
180 #define SYNTAX_COMMENT_BITS(table, c) \ | |
181 ((SYNTAX_CODE (table, c) >> 16) &0xff) | |
182 | |
183 #define SYNTAX_FIRST_OF_START_A 0x80 | |
184 #define SYNTAX_FIRST_OF_START_B 0x40 | |
185 #define SYNTAX_SECOND_OF_START_A 0x20 | |
186 #define SYNTAX_SECOND_OF_START_B 0x10 | |
187 #define SYNTAX_FIRST_OF_END_A 0x08 | |
188 #define SYNTAX_FIRST_OF_END_B 0x04 | |
189 #define SYNTAX_SECOND_OF_END_A 0x02 | |
190 #define SYNTAX_SECOND_OF_END_B 0x01 | |
191 | |
192 #define SYNTAX_COMMENT_STYLE_A 0xaa | |
193 #define SYNTAX_COMMENT_STYLE_B 0x55 | |
194 #define SYNTAX_FIRST_CHAR_START 0xc0 | |
195 #define SYNTAX_FIRST_CHAR_END 0x0c | |
196 #define SYNTAX_FIRST_CHAR 0xcc | |
197 #define SYNTAX_SECOND_CHAR_START 0x30 | |
198 #define SYNTAX_SECOND_CHAR_END 0x03 | |
199 #define SYNTAX_SECOND_CHAR 0x33 | |
200 | |
826 | 201 #if 0 |
202 | |
203 /* #### Entirely unused. Should they be deleted? */ | |
428 | 204 |
442 | 205 /* #### These are now more or less equivalent to |
206 SYNTAX_COMMENT_MATCH_START ...*/ | |
207 /* a and b must be first and second start chars for a common type */ | |
208 #define SYNTAX_START_P(table, a, b) \ | |
209 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \ | |
210 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START)) | |
211 | |
212 /* ... and SYNTAX_COMMENT_MATCH_END */ | |
213 /* a and b must be first and second end chars for a common type */ | |
214 #define SYNTAX_END_P(table, a, b) \ | |
215 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \ | |
216 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END)) | |
428 | 217 |
218 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \ | |
219 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \ | |
220 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask))) | |
221 | |
222 #define SYNTAX_STYLES_MATCH_END_P(table, a, b, mask) \ | |
223 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END & (mask)) \ | |
224 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END & (mask))) | |
225 | |
226 #define SYNTAX_STYLES_MATCH_1CHAR_P(table, a, mask) \ | |
227 ((SYNTAX_COMMENT_BITS (table, a) & (mask))) | |
228 | |
229 #define STYLE_FOUND_P(table, a, b, startp, style) \ | |
230 ((SYNTAX_COMMENT_BITS (table, a) & \ | |
231 ((startp) ? SYNTAX_FIRST_CHAR_START : \ | |
232 SYNTAX_FIRST_CHAR_END) & (style)) \ | |
233 && (SYNTAX_COMMENT_BITS (table, b) & \ | |
234 ((startp) ? SYNTAX_SECOND_CHAR_START : \ | |
235 SYNTAX_SECOND_CHAR_END) & (style))) | |
236 | |
237 #define SYNTAX_COMMENT_MASK_START(table, a, b) \ | |
238 ((STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_A) \ | |
239 ? SYNTAX_COMMENT_STYLE_A \ | |
240 : (STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_B) \ | |
241 ? SYNTAX_COMMENT_STYLE_B \ | |
242 : 0))) | |
243 | |
244 #define SYNTAX_COMMENT_MASK_END(table, a, b) \ | |
245 ((STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_A) \ | |
246 ? SYNTAX_COMMENT_STYLE_A \ | |
247 : (STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_B) \ | |
248 ? SYNTAX_COMMENT_STYLE_B \ | |
249 : 0))) | |
250 | |
251 #define STYLE_FOUND_1CHAR_P(table, a, style) \ | |
252 ((SYNTAX_COMMENT_BITS (table, a) & (style))) | |
253 | |
254 #define SYNTAX_COMMENT_1CHAR_MASK(table, a) \ | |
255 ((STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_A) \ | |
256 ? SYNTAX_COMMENT_STYLE_A \ | |
257 : (STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_B) \ | |
258 ? SYNTAX_COMMENT_STYLE_B \ | |
259 : 0))) | |
260 | |
826 | 261 #endif /* 0 */ |
428 | 262 |
263 /* This array, indexed by a character, contains the syntax code which | |
264 that character signifies (as a char). | |
265 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */ | |
266 | |
442 | 267 extern const unsigned char syntax_spec_code[0400]; |
428 | 268 |
269 /* Indexed by syntax code, give the letter that describes it. */ | |
270 | |
442 | 271 extern const unsigned char syntax_code_spec[]; |
428 | 272 |
665 | 273 Lisp_Object scan_lists (struct buffer *buf, Charbpos from, int count, |
428 | 274 int depth, int sexpflag, int no_error); |
665 | 275 int char_quoted (struct buffer *buf, Charbpos pos); |
428 | 276 |
277 /* NOTE: This does not refer to the mirror table, but to the | |
278 syntax table itself. */ | |
867 | 279 Lisp_Object syntax_match (Lisp_Object table, Ichar ch); |
428 | 280 |
281 extern int no_quit_in_re_search; | |
826 | 282 |
283 | |
284 /****************************** syntax caches ********************************/ | |
460 | 285 |
286 extern int lookup_syntax_properties; | |
287 | |
826 | 288 /* Now that the `syntax-table' property exists, and can override the syntax |
289 table or directly specify the syntax, we cache the last place we | |
290 retrieved the syntax-table property. This is because, when moving | |
291 linearly through text (e.g. in the regex routines or the scanning | |
292 routines in syntax.c), we only need to recalculate at the next place the | |
293 syntax-table property changes (i.e. not every position), and when we do | |
294 need to recalculate, we can update the info from the previous info | |
295 faster than if we did the whole calculation from scratch. */ | |
460 | 296 struct syntax_cache |
297 { | |
3092 | 298 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
299 NORMAL_LISP_OBJECT_HEADER header; |
3092 | 300 #endif /* NEW_GC */ |
826 | 301 int use_code; /* Whether to use syntax_code or |
1296 | 302 syntax_table. This is set |
303 depending on whether the | |
826 | 304 syntax-table property is a |
305 syntax table or a syntax | |
306 code. */ | |
307 int no_syntax_table_prop; /* If non-zero, there was no | |
308 `syntax-table' property on the | |
309 current range, and so we're | |
310 using the buffer's syntax table. | |
311 This is important to note because | |
312 sometimes the buffer's syntax | |
313 table can be changed. */ | |
460 | 314 Lisp_Object object; /* The buffer or string the current |
826 | 315 syntax cache applies to, or |
316 Qnil for a string of text not | |
317 coming from a buffer or string. */ | |
318 struct buffer *buffer; /* The buffer that supplies the | |
319 syntax tables, or 0 for the | |
320 standard syntax table. If | |
321 OBJECT is a buffer, this will | |
322 always be the same buffer. */ | |
460 | 323 int syntax_code; /* Syntax code of current char. */ |
1296 | 324 Lisp_Object syntax_table; /* Syntax table for current pos. */ |
325 Lisp_Object mirror_table; /* Mirror table for this table. */ | |
826 | 326 Lisp_Object start, end; /* Markers to keep track of the |
327 known region in a buffer. | |
328 Formerly we used an internal | |
329 extent, but it seems that having | |
330 an extent over the entire buffer | |
331 causes serious slowdowns in | |
332 extent operations! Yuck! */ | |
333 Charxpos next_change; /* Position of the next extent | |
460 | 334 change. */ |
826 | 335 Charxpos prev_change; /* Position of the previous extent |
336 change. */ | |
460 | 337 }; |
826 | 338 |
3092 | 339 #ifdef NEW_GC |
340 typedef struct syntax_cache Lisp_Syntax_Cache; | |
341 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3498
diff
changeset
|
342 DECLARE_LISP_OBJECT (syntax_cache, Lisp_Syntax_Cache); |
3092 | 343 |
344 #define XSYNTAX_CACHE(x) \ | |
345 XRECORD (x, syntax_cache, Lisp_Syntax_Cache) | |
346 #define wrap_syntax_cache(p) wrap_record (p, syntax_cache) | |
347 #define SYNTAX_CACHE_P(x) RECORDP (x, syntax_cache) | |
348 #define CHECK_SYNTAX_CACHE(x) CHECK_RECORD (x, syntax_cache) | |
349 #define CONCHECK_SYNTAX_CACHE(x) CONCHECK_RECORD (x, syntax_cache) | |
350 #endif /* NEW_GC */ | |
351 | |
352 | |
353 | |
1296 | 354 extern const struct sized_memory_description syntax_cache_description; |
355 | |
826 | 356 /* Note that the external interface to the syntax-cache uses charpos's, but |
3250 | 357 internally we use bytepos's, for speed. */ |
460 | 358 |
826 | 359 void update_syntax_cache (struct syntax_cache *cache, Charxpos pos, int count); |
360 struct syntax_cache *setup_syntax_cache (struct syntax_cache *cache, | |
361 Lisp_Object object, | |
362 struct buffer *buffer, | |
363 Charxpos from, int count); | |
364 struct syntax_cache *setup_buffer_syntax_cache (struct buffer *buffer, | |
365 Charxpos from, int count); | |
460 | 366 |
367 /* Make syntax cache state good for CHARPOS, assuming it is | |
368 currently good for a position before CHARPOS. */ | |
826 | 369 DECLARE_INLINE_HEADER ( |
370 void | |
371 UPDATE_SYNTAX_CACHE_FORWARD (struct syntax_cache *cache, Charxpos pos) | |
372 ) | |
373 { | |
1315 | 374 /* #### Formerly this function, and the next one, had |
375 | |
376 if (pos < cache->prev_change || pos >= cache->next_change) | |
377 | |
378 just like for plain UPDATE_SYNTAX_CACHE. However, sometimes the | |
379 value of POS may be invalid (particularly, it may be 0 for a buffer). | |
380 FSF has the check at only one end, so let's try the same. */ | |
381 if (pos >= cache->next_change) | |
826 | 382 update_syntax_cache (cache, pos, 1); |
383 } | |
460 | 384 |
385 /* Make syntax cache state good for CHARPOS, assuming it is | |
386 currently good for a position after CHARPOS. */ | |
826 | 387 DECLARE_INLINE_HEADER ( |
388 void | |
389 UPDATE_SYNTAX_CACHE_BACKWARD (struct syntax_cache *cache, Charxpos pos) | |
390 ) | |
391 { | |
1315 | 392 if (pos < cache->prev_change) |
826 | 393 update_syntax_cache (cache, pos, -1); |
394 } | |
460 | 395 |
396 /* Make syntax cache state good for CHARPOS */ | |
826 | 397 DECLARE_INLINE_HEADER ( |
398 void | |
399 UPDATE_SYNTAX_CACHE (struct syntax_cache *cache, Charxpos pos) | |
400 ) | |
401 { | |
1315 | 402 if (pos < cache->prev_change || pos >= cache->next_change) |
826 | 403 update_syntax_cache (cache, pos, 0); |
404 } | |
460 | 405 |
826 | 406 #define SYNTAX_FROM_CACHE(cache, c) \ |
407 SYNTAX_FROM_CODE (SYNTAX_CODE_FROM_CACHE (cache, c)) | |
460 | 408 |
826 | 409 #define SYNTAX_CODE_FROM_CACHE(cache, c) \ |
410 ((cache)->use_code ? (cache)->syntax_code \ | |
1296 | 411 : SYNTAX_CODE ((cache)->mirror_table, c)) |
412 | |
413 #ifdef NOT_WORTH_THE_EFFORT | |
414 /* If we really cared about the theoretical performance hit of the dirty | |
415 check in SYNTAX_CODE, we could use SYNTAX_CODE_1 and endeavor to always | |
416 keep the mirror table clean, e.g. by checking for dirtiness at the time | |
417 we set up the syntax cache. There are lots of potential problems, of | |
418 course -- incomplete understanding of the possible pathways into the | |
419 code, with some that are bypassing the setups, Lisp code being executed | |
420 in the meantime that could change things (e.g. QUIT is called in many | |
421 functions and could execute arbitrary Lisp very easily), etc. The QUIT | |
422 problem is the biggest one, probably, and one of the main reasons it's | |
423 probably just not worth it. */ | |
424 #define SYNTAX_CODE_FROM_CACHE(cache, c) \ | |
425 ((cache)->use_code ? (cache)->syntax_code \ | |
426 : SYNTAX_CODE_1 ((cache)->mirror_table, c)) | |
427 #endif | |
826 | 428 |
429 | |
430 /***************************** syntax code macros ****************************/ | |
460 | 431 |
432 #define SYNTAX_CODE_PREFIX(c) \ | |
433 ((c >> 7) & 1) | |
434 | |
435 #define SYNTAX_CODE_COMMENT_BITS(c) \ | |
436 ((c >> 16) &0xff) | |
437 | |
438 #define SYNTAX_CODES_START_P(a, b) \ | |
439 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START) >> 2) \ | |
440 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START)) | |
441 | |
442 #define SYNTAX_CODES_END_P(a, b) \ | |
443 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END) >> 2) \ | |
444 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END)) | |
445 | |
446 #define SYNTAX_CODES_COMMENT_MASK_START(a, b) \ | |
447 (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_A) \ | |
448 ? SYNTAX_COMMENT_STYLE_A \ | |
449 : (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_B) \ | |
450 ? SYNTAX_COMMENT_STYLE_B \ | |
451 : 0)) | |
452 #define SYNTAX_CODES_COMMENT_MASK_END(a, b) \ | |
453 (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_A) \ | |
454 ? SYNTAX_COMMENT_STYLE_A \ | |
455 : (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_B) \ | |
456 ? SYNTAX_COMMENT_STYLE_B \ | |
457 : 0)) | |
458 | |
459 #define SYNTAX_CODE_START_FIRST_P(a) \ | |
460 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START) | |
461 | |
462 #define SYNTAX_CODE_START_SECOND_P(a) \ | |
463 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_START) | |
464 | |
465 #define SYNTAX_CODE_END_FIRST_P(a) \ | |
466 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END) | |
467 | |
468 #define SYNTAX_CODE_END_SECOND_P(a) \ | |
469 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_END) | |
470 | |
471 | |
472 #define SYNTAX_CODES_MATCH_START_P(a, b, mask) \ | |
473 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START & (mask)) \ | |
474 && (SYNTAX_CODE_COMMENT_BITS (b) \ | |
475 & SYNTAX_SECOND_CHAR_START & (mask))) | |
476 | |
477 #define SYNTAX_CODES_MATCH_END_P(a, b, mask) \ | |
478 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END & (mask)) \ | |
479 && (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END & (mask))) | |
480 | |
481 #define SYNTAX_CODE_MATCHES_1CHAR_P(a, mask) \ | |
482 ((SYNTAX_CODE_COMMENT_BITS (a) & (mask))) | |
483 | |
484 #define SYNTAX_CODE_COMMENT_1CHAR_MASK(a) \ | |
485 ((SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_A) \ | |
486 ? SYNTAX_COMMENT_STYLE_A \ | |
487 : (SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_B) \ | |
488 ? SYNTAX_COMMENT_STYLE_B \ | |
489 : 0))) | |
490 | |
491 | |
440 | 492 #endif /* INCLUDED_syntax_h_ */ |