428
|
1 /* Declarations having to do with XEmacs syntax tables.
|
|
2 Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
|
793
|
3 Copyright (C) 2002 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
|
|
75 /* Return the syntax code for a particular character and mirror table. */
|
|
76
|
|
77 #define SYNTAX_CODE_UNSAFE(table, c) \
|
|
78 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c))
|
|
79
|
442
|
80 INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c);
|
|
81 INLINE_HEADER int
|
440
|
82 SYNTAX_CODE (Lisp_Char_Table *table, Emchar c)
|
428
|
83 {
|
|
84 return SYNTAX_CODE_UNSAFE (table, c);
|
|
85 }
|
|
86
|
|
87 #define SYNTAX_UNSAFE(table, c) \
|
|
88 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177))
|
|
89
|
|
90 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
|
|
91 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
|
|
92
|
442
|
93 INLINE_HEADER int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c);
|
|
94 INLINE_HEADER int
|
440
|
95 WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c)
|
428
|
96 {
|
|
97 return SYNTAX (table, c) == Sword;
|
|
98 }
|
|
99
|
|
100 /* OK, here's a graphic diagram of the format of the syntax values:
|
|
101
|
|
102 Bit number:
|
|
103
|
|
104 [ 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 ]
|
|
105 [ 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 ]
|
|
106
|
|
107 <-----> <-----> <-------------> <-------------> ^ <----------->
|
|
108 ELisp unused |comment bits | unused | syntax code
|
|
109 tag | | | | | | | | |
|
|
110 stuff | | | | | | | | |
|
|
111 | | | | | | | | |
|
|
112 | | | | | | | | `--> prefix flag
|
|
113 | | | | | | | |
|
|
114 | | | | | | | `--> comment end style B, second char
|
|
115 | | | | | | `----> comment end style A, second char
|
|
116 | | | | | `------> comment end style B, first char
|
|
117 | | | | `--------> comment end style A, first char
|
|
118 | | | `----------> comment start style B, second char
|
|
119 | | `------------> comment start style A, second char
|
|
120 | `--------------> comment start style B, first char
|
|
121 `----------------> comment start style A, first char
|
|
122
|
|
123 In a 64-bit integer, there would be 32 more unused bits between
|
|
124 the tag and the comment bits.
|
|
125
|
|
126 Clearly, such a scheme will not work for Mule, because the matching
|
|
127 paren could be any character and as such requires 19 bits, which
|
|
128 we don't got.
|
|
129
|
|
130 Remember that under Mule we use char tables instead of vectors.
|
|
131 So what we do is use another char table for the matching paren
|
|
132 and store a pointer to it in the first char table. (This frees
|
|
133 code from having to worry about passing two tables around.)
|
|
134 */
|
|
135
|
|
136
|
|
137 /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */
|
|
138
|
|
139 #define SYNTAX_PREFIX_UNSAFE(table, c) \
|
|
140 ((SYNTAX_CODE_UNSAFE (table, c) >> 7) & 1)
|
|
141 #define SYNTAX_PREFIX(table, c) \
|
|
142 ((SYNTAX_CODE (table, c) >> 7) & 1)
|
|
143
|
|
144 /* Bits 23-16 are used to implement up to two comment styles
|
|
145 in a single buffer. They have the following meanings:
|
|
146
|
|
147 1. first of a one or two character comment-start sequence of style a.
|
|
148 2. first of a one or two character comment-start sequence of style b.
|
|
149 3. second of a two-character comment-start sequence of style a.
|
|
150 4. second of a two-character comment-start sequence of style b.
|
|
151 5. first of a one or two character comment-end sequence of style a.
|
|
152 6. first of a one or two character comment-end sequence of style b.
|
|
153 7. second of a two-character comment-end sequence of style a.
|
|
154 8. second of a two-character comment-end sequence of style b.
|
|
155 */
|
|
156
|
|
157 #define SYNTAX_COMMENT_BITS(table, c) \
|
|
158 ((SYNTAX_CODE (table, c) >> 16) &0xff)
|
|
159
|
|
160 #define SYNTAX_FIRST_OF_START_A 0x80
|
|
161 #define SYNTAX_FIRST_OF_START_B 0x40
|
|
162 #define SYNTAX_SECOND_OF_START_A 0x20
|
|
163 #define SYNTAX_SECOND_OF_START_B 0x10
|
|
164 #define SYNTAX_FIRST_OF_END_A 0x08
|
|
165 #define SYNTAX_FIRST_OF_END_B 0x04
|
|
166 #define SYNTAX_SECOND_OF_END_A 0x02
|
|
167 #define SYNTAX_SECOND_OF_END_B 0x01
|
|
168
|
|
169 #define SYNTAX_COMMENT_STYLE_A 0xaa
|
|
170 #define SYNTAX_COMMENT_STYLE_B 0x55
|
|
171 #define SYNTAX_FIRST_CHAR_START 0xc0
|
|
172 #define SYNTAX_FIRST_CHAR_END 0x0c
|
|
173 #define SYNTAX_FIRST_CHAR 0xcc
|
|
174 #define SYNTAX_SECOND_CHAR_START 0x30
|
|
175 #define SYNTAX_SECOND_CHAR_END 0x03
|
|
176 #define SYNTAX_SECOND_CHAR 0x33
|
|
177
|
|
178
|
442
|
179 /* #### These are now more or less equivalent to
|
|
180 SYNTAX_COMMENT_MATCH_START ...*/
|
|
181 /* a and b must be first and second start chars for a common type */
|
|
182 #define SYNTAX_START_P(table, a, b) \
|
|
183 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \
|
|
184 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
|
|
185
|
|
186 /* ... and SYNTAX_COMMENT_MATCH_END */
|
|
187 /* a and b must be first and second end chars for a common type */
|
|
188 #define SYNTAX_END_P(table, a, b) \
|
|
189 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \
|
|
190 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
|
428
|
191
|
|
192 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \
|
|
193 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \
|
|
194 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask)))
|
|
195
|
|
196 #define SYNTAX_STYLES_MATCH_END_P(table, a, b, mask) \
|
|
197 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END & (mask)) \
|
|
198 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END & (mask)))
|
|
199
|
|
200 #define SYNTAX_STYLES_MATCH_1CHAR_P(table, a, mask) \
|
|
201 ((SYNTAX_COMMENT_BITS (table, a) & (mask)))
|
|
202
|
|
203 #define STYLE_FOUND_P(table, a, b, startp, style) \
|
|
204 ((SYNTAX_COMMENT_BITS (table, a) & \
|
|
205 ((startp) ? SYNTAX_FIRST_CHAR_START : \
|
|
206 SYNTAX_FIRST_CHAR_END) & (style)) \
|
|
207 && (SYNTAX_COMMENT_BITS (table, b) & \
|
|
208 ((startp) ? SYNTAX_SECOND_CHAR_START : \
|
|
209 SYNTAX_SECOND_CHAR_END) & (style)))
|
|
210
|
|
211 #define SYNTAX_COMMENT_MASK_START(table, a, b) \
|
|
212 ((STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_A) \
|
|
213 ? SYNTAX_COMMENT_STYLE_A \
|
|
214 : (STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_B) \
|
|
215 ? SYNTAX_COMMENT_STYLE_B \
|
|
216 : 0)))
|
|
217
|
|
218 #define SYNTAX_COMMENT_MASK_END(table, a, b) \
|
|
219 ((STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_A) \
|
|
220 ? SYNTAX_COMMENT_STYLE_A \
|
|
221 : (STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_B) \
|
|
222 ? SYNTAX_COMMENT_STYLE_B \
|
|
223 : 0)))
|
|
224
|
|
225 #define STYLE_FOUND_1CHAR_P(table, a, style) \
|
|
226 ((SYNTAX_COMMENT_BITS (table, a) & (style)))
|
|
227
|
|
228 #define SYNTAX_COMMENT_1CHAR_MASK(table, a) \
|
|
229 ((STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_A) \
|
|
230 ? SYNTAX_COMMENT_STYLE_A \
|
|
231 : (STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_B) \
|
|
232 ? SYNTAX_COMMENT_STYLE_B \
|
|
233 : 0)))
|
|
234
|
|
235 EXFUN (Fchar_syntax, 2);
|
|
236 EXFUN (Fforward_word, 2);
|
|
237
|
|
238 /* The standard syntax table is stored where it will automatically
|
|
239 be used in all new buffers. */
|
|
240 extern Lisp_Object Vstandard_syntax_table;
|
|
241
|
|
242 /* This array, indexed by a character, contains the syntax code which
|
|
243 that character signifies (as a char).
|
|
244 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
|
|
245
|
442
|
246 extern const unsigned char syntax_spec_code[0400];
|
428
|
247
|
|
248 /* Indexed by syntax code, give the letter that describes it. */
|
|
249
|
442
|
250 extern const unsigned char syntax_code_spec[];
|
428
|
251
|
665
|
252 Lisp_Object scan_lists (struct buffer *buf, Charbpos from, int count,
|
428
|
253 int depth, int sexpflag, int no_error);
|
665
|
254 int char_quoted (struct buffer *buf, Charbpos pos);
|
428
|
255
|
|
256 /* NOTE: This does not refer to the mirror table, but to the
|
|
257 syntax table itself. */
|
|
258 Lisp_Object syntax_match (Lisp_Object table, Emchar ch);
|
|
259
|
|
260 extern int no_quit_in_re_search;
|
|
261 extern struct buffer *regex_emacs_buffer;
|
460
|
262
|
|
263 /* This is the string or buffer in which we are matching. It is used
|
|
264 for looking up syntax properties. */
|
|
265 extern Lisp_Object regex_match_object;
|
428
|
266
|
440
|
267 void update_syntax_table (Lisp_Char_Table *ct);
|
428
|
268
|
460
|
269 #ifdef emacs
|
|
270
|
|
271 extern int lookup_syntax_properties;
|
|
272
|
|
273 struct syntax_cache
|
|
274 {
|
|
275 int use_code; /* Whether to use syntax_code
|
|
276 or current_syntax_table. */
|
|
277 struct buffer* buffer; /* The buffer the current syntax cache
|
|
278 applies to. */
|
|
279 Lisp_Object object; /* The buffer or string the current
|
|
280 syntax cache applies to. */
|
|
281 int syntax_code; /* Syntax code of current char. */
|
|
282 Lisp_Object current_syntax_table; /* Syntax table for current pos. */
|
|
283 Lisp_Object old_prop; /* Syntax-table prop at prev pos. */
|
|
284
|
665
|
285 Charbpos next_change; /* Position of the next extent
|
460
|
286 change. */
|
665
|
287 Charbpos prev_change; /* Position of the previous
|
460
|
288 extent change. */
|
|
289 };
|
|
290 extern struct syntax_cache syntax_cache;
|
|
291
|
|
292 void update_syntax_cache (int pos, int count, int init);
|
|
293
|
|
294 /* Make syntax cache state good for CHARPOS, assuming it is
|
|
295 currently good for a position before CHARPOS. */
|
|
296 #define UPDATE_SYNTAX_CACHE_FORWARD(pos) \
|
|
297 (lookup_syntax_properties \
|
|
298 ? (update_syntax_cache ((pos), 1, 0), 1) \
|
|
299 : 0)
|
|
300
|
|
301 /* Make syntax cache state good for CHARPOS, assuming it is
|
|
302 currently good for a position after CHARPOS. */
|
|
303 #define UPDATE_SYNTAX_CACHE_BACKWARD(pos) \
|
|
304 (lookup_syntax_properties \
|
|
305 ? (update_syntax_cache ((pos), -1, 0), 1) \
|
|
306 : 0)
|
|
307
|
|
308 /* Make syntax cache state good for CHARPOS */
|
|
309 #define UPDATE_SYNTAX_CACHE(pos) \
|
|
310 (lookup_syntax_properties \
|
|
311 ? (update_syntax_cache ((pos), 0, 0), 1) \
|
|
312 : 0)
|
|
313
|
|
314 #define SYNTAX_FROM_CACHE(table, c) \
|
|
315 SYNTAX_FROM_CODE (SYNTAX_CODE_FROM_CACHE (table, c))
|
|
316
|
|
317 #define SYNTAX_CODE_FROM_CACHE(table, c) \
|
|
318 ( syntax_cache.use_code \
|
|
319 ? syntax_cache.syntax_code \
|
|
320 : SYNTAX_CODE (XCHAR_TABLE (syntax_cache.current_syntax_table), \
|
|
321 c) \
|
|
322 )
|
|
323
|
|
324 /* Convert the byte offset BYTEPOS into a character position,
|
|
325 for the object recorded in syntax_cache with SETUP_SYNTAX_TABLE_FOR_OBJECT.
|
|
326
|
|
327 The value is meant for use in the UPDATE_SYNTAX_TABLE... macros.
|
|
328 These macros do nothing when parse_sexp_lookup_properties is 0,
|
|
329 so we return 0 in that case, for speed. */
|
771
|
330 #define SYNTAX_CACHE_BYTE_TO_CHAR(bytepos) \
|
|
331 (! lookup_syntax_properties \
|
|
332 ? 0 \
|
|
333 : STRINGP (syntax_cache.object) \
|
793
|
334 ? string_index_byte_to_char (syntax_cache.object, bytepos) \
|
771
|
335 : (BUFFERP (syntax_cache.object) || NILP (syntax_cache.object)) \
|
|
336 ? bytebpos_to_charbpos (syntax_cache.buffer, \
|
|
337 bytepos + BI_BUF_BEGV (syntax_cache.buffer)) \
|
460
|
338 : (bytepos))
|
|
339
|
|
340 #define SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR(obj, buf, bytepos) \
|
|
341 (! lookup_syntax_properties \
|
|
342 ? 0 \
|
|
343 : STRINGP (obj) \
|
793
|
344 ? string_index_byte_to_char (obj, bytepos) \
|
460
|
345 : (BUFFERP (obj) || NILP (obj)) \
|
665
|
346 ? bytebpos_to_charbpos (buf, bytepos + BI_BUF_BEGV (buf)) \
|
460
|
347 : (bytepos))
|
|
348
|
|
349 #else /* not emacs */
|
|
350
|
|
351 #define update_syntax_cache(pos, count, init)
|
|
352 #define UPDATE_SYNTAX_CACHE_FORWARD(pos)
|
|
353 #define UPDATE_SYNTAX_CACHE_BACKWARD(pos)
|
|
354 #define UPDATE_SYNTAX_CACHE(pos)
|
|
355 #define SYNTAX_FROM_CACHE SYNTAX
|
|
356 #define SYNTAX_CODE_FROM_CACHE SYNTAX_CODE
|
|
357
|
|
358 #endif /* emacs */
|
|
359
|
|
360 #define SETUP_SYNTAX_CACHE(FROM, COUNT) \
|
|
361 do { \
|
|
362 syntax_cache.buffer = current_buffer; \
|
|
363 syntax_cache.object = Qnil; \
|
|
364 syntax_cache.current_syntax_table \
|
|
365 = current_buffer->mirror_syntax_table; \
|
|
366 syntax_cache.use_code = 0; \
|
|
367 if (lookup_syntax_properties) \
|
|
368 update_syntax_cache ((COUNT) > 0 ? (FROM) : (FROM) - 1, \
|
|
369 (COUNT), 1); \
|
|
370 } while (0)
|
|
371
|
|
372 #define SETUP_SYNTAX_CACHE_FOR_BUFFER(BUFFER, FROM, COUNT) \
|
|
373 do { \
|
|
374 syntax_cache.buffer = (BUFFER); \
|
|
375 syntax_cache.object = Qnil; \
|
|
376 syntax_cache.current_syntax_table = \
|
|
377 syntax_cache.buffer->mirror_syntax_table; \
|
|
378 syntax_cache.use_code = 0; \
|
|
379 if (lookup_syntax_properties) \
|
|
380 update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), \
|
|
381 (COUNT), 1); \
|
|
382 } while (0)
|
|
383
|
|
384 #define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT) \
|
|
385 do { \
|
|
386 syntax_cache.buffer = (BUFFER); \
|
|
387 syntax_cache.object = (OBJECT); \
|
|
388 if (NILP (syntax_cache.object)) \
|
|
389 { \
|
|
390 /* do nothing */; \
|
|
391 } \
|
|
392 else if (EQ (syntax_cache.object, Qt)) \
|
|
393 { \
|
|
394 /* do nothing */; \
|
|
395 } \
|
|
396 else if (STRINGP (syntax_cache.object)) \
|
|
397 { \
|
|
398 /* do nothing */; \
|
|
399 } \
|
|
400 else if (BUFFERP (syntax_cache.object)) \
|
|
401 { \
|
|
402 syntax_cache.buffer = XBUFFER (syntax_cache.object); \
|
|
403 } \
|
|
404 else \
|
|
405 { \
|
|
406 /* OBJECT must be buffer/string/t/nil */ \
|
|
407 assert(0); \
|
|
408 } \
|
|
409 syntax_cache.current_syntax_table \
|
|
410 = syntax_cache.buffer->mirror_syntax_table; \
|
|
411 syntax_cache.use_code = 0; \
|
|
412 if (lookup_syntax_properties) \
|
|
413 update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), \
|
|
414 (COUNT), 1); \
|
|
415 } while (0)
|
|
416
|
|
417 #define SYNTAX_CODE_PREFIX(c) \
|
|
418 ((c >> 7) & 1)
|
|
419
|
|
420 #define SYNTAX_CODE_COMMENT_BITS(c) \
|
|
421 ((c >> 16) &0xff)
|
|
422
|
|
423 #define SYNTAX_CODES_START_P(a, b) \
|
|
424 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START) >> 2) \
|
|
425 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START))
|
|
426
|
|
427 #define SYNTAX_CODES_END_P(a, b) \
|
|
428 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END) >> 2) \
|
|
429 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END))
|
|
430
|
|
431 #define SYNTAX_CODES_COMMENT_MASK_START(a, b) \
|
|
432 (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_A) \
|
|
433 ? SYNTAX_COMMENT_STYLE_A \
|
|
434 : (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_B) \
|
|
435 ? SYNTAX_COMMENT_STYLE_B \
|
|
436 : 0))
|
|
437 #define SYNTAX_CODES_COMMENT_MASK_END(a, b) \
|
|
438 (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_A) \
|
|
439 ? SYNTAX_COMMENT_STYLE_A \
|
|
440 : (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_B) \
|
|
441 ? SYNTAX_COMMENT_STYLE_B \
|
|
442 : 0))
|
|
443
|
|
444 #define SYNTAX_CODE_START_FIRST_P(a) \
|
|
445 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START)
|
|
446
|
|
447 #define SYNTAX_CODE_START_SECOND_P(a) \
|
|
448 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_START)
|
|
449
|
|
450 #define SYNTAX_CODE_END_FIRST_P(a) \
|
|
451 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END)
|
|
452
|
|
453 #define SYNTAX_CODE_END_SECOND_P(a) \
|
|
454 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_END)
|
|
455
|
|
456
|
|
457 #define SYNTAX_CODES_MATCH_START_P(a, b, mask) \
|
|
458 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START & (mask)) \
|
|
459 && (SYNTAX_CODE_COMMENT_BITS (b) \
|
|
460 & SYNTAX_SECOND_CHAR_START & (mask)))
|
|
461
|
|
462 #define SYNTAX_CODES_MATCH_END_P(a, b, mask) \
|
|
463 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END & (mask)) \
|
|
464 && (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END & (mask)))
|
|
465
|
|
466 #define SYNTAX_CODE_MATCHES_1CHAR_P(a, mask) \
|
|
467 ((SYNTAX_CODE_COMMENT_BITS (a) & (mask)))
|
|
468
|
|
469 #define SYNTAX_CODE_COMMENT_1CHAR_MASK(a) \
|
|
470 ((SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_A) \
|
|
471 ? SYNTAX_COMMENT_STYLE_A \
|
|
472 : (SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_B) \
|
|
473 ? SYNTAX_COMMENT_STYLE_B \
|
|
474 : 0)))
|
|
475
|
|
476
|
440
|
477 #endif /* INCLUDED_syntax_h_ */
|