1 /* Declarations having to do with XEmacs syntax tables.
2 Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
4 This file is part of SXEmacs
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Synched up with: FSF 19.28. */
22 #ifndef INCLUDED_syntax_h_
23 #define INCLUDED_syntax_h_
27 /* A syntax table is a type of char table.
29 The low 7 bits of the integer is a code, as follows. The 8th bit is
30 used as the prefix bit flag (see below).
32 The values in a syntax table are either integers or conses of
33 integers and chars. The lowest 7 bits of the integer are the syntax
34 class. If this is Sinherit, then the actual syntax value needs to
35 be retrieved from the standard syntax table.
37 Since the logic involved in finding the actual integer isn't very
38 complex, you'd think the time required to retrieve it is not a
39 factor. If you thought that, however, you'd be wrong, due to the
40 high number of times (many per character) that the syntax value is
41 accessed in functions such as scan_lists(). To speed this up,
42 we maintain a mirror syntax table that contains the actual
43 integers. We can do this successfully because syntax tables are
44 now an abstract type, where we control all access.
48 Swhitespace, /* whitespace character */
49 Spunct, /* random punctuation character */
50 Sword, /* word constituent */
51 Ssymbol, /* symbol constituent but not word constituent */
52 Sopen, /* a beginning delimiter */
53 Sclose, /* an ending delimiter */
54 Squote, /* a prefix character like Lisp ' */
55 Sstring, /* a string-grouping character like Lisp " */
56 Smath, /* delimiters like $ in TeX. */
57 Sescape, /* a character that begins a C-style escape */
58 Scharquote, /* a character that quotes the following character */
59 Scomment, /* a comment-starting character */
60 Sendcomment, /* a comment-ending character */
61 Sinherit, /* use the standard syntax table for this character */
62 Scomment_fence, /* Starts/ends comment which is delimited on the
63 other side by a char with the same syntaxcode. */
64 Sstring_fence, /* Starts/ends string which is delimited on the
65 other side by a char with the same syntaxcode. */
66 Smax /* Upper bound on codes that are meaningful */
69 enum syntaxcode charset_syntax(struct buffer *buf, Lisp_Object charset,
72 /* Return the syntax code for a particular character and mirror table. */
74 #define SYNTAX_CODE_UNSAFE(table, c) \
75 ((enum syntaxcode) (int)XINT(CHAR_TABLE_VALUE_UNSAFE (table, c)))
77 extern_inline enum syntaxcode SYNTAX_CODE(Lisp_Char_Table * table, Emchar c);
78 extern_inline enum syntaxcode SYNTAX_CODE(Lisp_Char_Table * table, Emchar c)
80 return SYNTAX_CODE_UNSAFE(table, c);
83 #define SYNTAX_UNSAFE(table, c) \
84 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177))
86 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
87 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
89 extern_inline int WORD_SYNTAX_P(Lisp_Char_Table * table, Emchar c);
90 extern_inline int WORD_SYNTAX_P(Lisp_Char_Table * table, Emchar c)
92 return SYNTAX(table, c) == Sword;
95 /* OK, here's a graphic diagram of the format of the syntax values:
99 [ 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 ]
100 [ 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 ]
102 <-----> <-----> <-------------> <-------------> ^ <----------->
103 ELisp unused |comment bits | unused | syntax code
104 tag | | | | | | | | |
105 stuff | | | | | | | | |
107 | | | | | | | | `--> prefix flag
109 | | | | | | | `--> comment end style B, second char
110 | | | | | | `----> comment end style A, second char
111 | | | | | `------> comment end style B, first char
112 | | | | `--------> comment end style A, first char
113 | | | `----------> comment start style B, second char
114 | | `------------> comment start style A, second char
115 | `--------------> comment start style B, first char
116 `----------------> comment start style A, first char
118 In a 64-bit integer, there would be 32 more unused bits between
119 the tag and the comment bits.
121 Clearly, such a scheme will not work for Mule, because the matching
122 paren could be any character and as such requires 19 bits, which
125 Remember that under Mule we use char tables instead of vectors.
126 So what we do is use another char table for the matching paren
127 and store a pointer to it in the first char table. (This frees
128 code from having to worry about passing two tables around.)
131 /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */
133 #define SYNTAX_PREFIX_UNSAFE(table, c) \
134 ((SYNTAX_CODE_UNSAFE (table, c) >> 7) & 1)
135 #define SYNTAX_PREFIX(table, c) \
136 ((SYNTAX_CODE (table, c) >> 7) & 1)
138 /* Bits 23-16 are used to implement up to two comment styles
139 in a single buffer. They have the following meanings:
141 1. first of a one or two character comment-start sequence of style a.
142 2. first of a one or two character comment-start sequence of style b.
143 3. second of a two-character comment-start sequence of style a.
144 4. second of a two-character comment-start sequence of style b.
145 5. first of a one or two character comment-end sequence of style a.
146 6. first of a one or two character comment-end sequence of style b.
147 7. second of a two-character comment-end sequence of style a.
148 8. second of a two-character comment-end sequence of style b.
150 From the internals manual:
152 Syntax codes are implemented as bitfields in an int. Bits 0-6 contain
153 the syntax code itself, bit 7 is a special prefix flag used for Lisp,
154 and bits 16-23 contain comment syntax flags. From the Lisp programmer's
155 point of view, there are 11 flags: 2 styles X 2 characters X @{start,
156 end@} flags for two-character comment delimiters, 2 style flags for
157 one-character comment delimiters, and the prefix flag.
159 Internally, however, the characters used in multi-character delimiters
160 will have non-comment-character syntax classes (@emph{e.g.}, the
161 @samp{/} in C's @samp{/}@samp{*} comment-start delimiter has ``punctuation''
162 \(here meaning ``operator-like'') class in C modes). Thus in a mixed
163 comment style, such as C++'s @samp{//} to end of line, is represented by
164 giving @samp{/} the ``punctuation'' class and the ``style b first
165 character of start sequence'' and ``style b second character of start
166 sequence'' flags. The fact that class is @emph{not} punctuation allows
167 the syntax scanner to recognize that this is a multi-character
168 delimiter. The @samp{newline} character is given (single-character)
169 ``comment-end'' @emph{class} and the ``style b first character of end
170 sequence'' @emph{flag}. The ``comment-end'' class allows the scanner to
171 determine that no second character is needed to terminate the comment.
174 #define SYNTAX_COMMENT_BITS(c) \
175 ((SYNTAX_CODE (mirrortab, c) >> 16) &0xff)
177 #define SYNTAX_FIRST_OF_START_A 0x80
178 #define SYNTAX_FIRST_OF_START_B 0x40
179 #define SYNTAX_SECOND_OF_START_A 0x20
180 #define SYNTAX_SECOND_OF_START_B 0x10
181 #define SYNTAX_FIRST_OF_END_A 0x08
182 #define SYNTAX_FIRST_OF_END_B 0x04
183 #define SYNTAX_SECOND_OF_END_A 0x02
184 #define SYNTAX_SECOND_OF_END_B 0x01
186 #define SYNTAX_COMMENT_STYLE_A 0xaa
187 #define SYNTAX_COMMENT_STYLE_B 0x55
188 #define SYNTAX_FIRST_CHAR_START 0xc0
189 #define SYNTAX_FIRST_CHAR_END 0x0c
190 #define SYNTAX_FIRST_CHAR 0xcc
191 #define SYNTAX_SECOND_CHAR_START 0x30
192 #define SYNTAX_SECOND_CHAR_END 0x03
193 #define SYNTAX_SECOND_CHAR 0x33
195 /* #### These are now more or less equivalent to
196 SYNTAX_COMMENT_MATCH_START ...*/
197 /* a and b must be first and second start chars for a common type */
198 #define SYNTAX_START_P(a, b) \
199 (((SYNTAX_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START) >> 2) \
200 & (SYNTAX_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START))
202 /* ... and SYNTAX_COMMENT_MATCH_END */
203 /* a and b must be first and second end chars for a common type */
204 #define SYNTAX_END_P(a, b) \
205 (((SYNTAX_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END) >> 2) \
206 & (SYNTAX_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END))
208 #define SYNTAX_STYLES_MATCH_START_P(a, b, mask) \
209 ((SYNTAX_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START & (mask)) \
210 && (SYNTAX_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START & (mask)))
212 #define SYNTAX_STYLES_MATCH_END_P(a, b, mask) \
213 ((SYNTAX_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END & (mask)) \
214 && (SYNTAX_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END & (mask)))
216 #define SYNTAX_STYLES_MATCH_1CHAR_P(a, mask) \
217 ((SYNTAX_COMMENT_BITS (a) & (mask)))
219 #define STYLE_FOUND_P(a, b, startp, style) \
220 ((SYNTAX_COMMENT_BITS (a) & \
221 ((startp) ? SYNTAX_FIRST_CHAR_START : \
222 SYNTAX_FIRST_CHAR_END) & (style)) \
223 && (SYNTAX_COMMENT_BITS (b) & \
224 ((startp) ? SYNTAX_SECOND_CHAR_START : \
225 SYNTAX_SECOND_CHAR_END) & (style)))
227 #define SYNTAX_COMMENT_MASK_START(a, b) \
228 ((STYLE_FOUND_P (a, b, 1, SYNTAX_COMMENT_STYLE_A) \
229 ? SYNTAX_COMMENT_STYLE_A \
230 : (STYLE_FOUND_P (a, b, 1, SYNTAX_COMMENT_STYLE_B) \
231 ? SYNTAX_COMMENT_STYLE_B \
234 #define SYNTAX_COMMENT_MASK_END(a, b) \
235 ((STYLE_FOUND_P (a, b, 0, SYNTAX_COMMENT_STYLE_A) \
236 ? SYNTAX_COMMENT_STYLE_A \
237 : (STYLE_FOUND_P (a, b, 0, SYNTAX_COMMENT_STYLE_B) \
238 ? SYNTAX_COMMENT_STYLE_B \
241 #define STYLE_FOUND_1CHAR_P(a, style) \
242 ((SYNTAX_COMMENT_BITS (a) & (style)))
244 #define SYNTAX_COMMENT_1CHAR_MASK(a) \
245 ((STYLE_FOUND_1CHAR_P (a, SYNTAX_COMMENT_STYLE_A) \
246 ? SYNTAX_COMMENT_STYLE_A \
247 : (STYLE_FOUND_1CHAR_P (a, SYNTAX_COMMENT_STYLE_B) \
248 ? SYNTAX_COMMENT_STYLE_B \
251 EXFUN(Fchar_syntax, 2);
252 EXFUN(Fforward_word, 2);
254 /* The standard syntax table is stored where it will automatically
255 be used in all new buffers. */
256 extern Lisp_Object Vstandard_syntax_table;
258 /* This array, indexed by a character, contains the syntax code which
259 that character signifies (as a char).
260 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
262 extern const unsigned char syntax_spec_code[0400];
264 /* Indexed by syntax code, give the letter that describes it. */
266 extern unsigned char syntax_code_spec[];
268 Lisp_Object scan_lists(struct buffer *buf, Bufpos from, int count,
269 int depth, int sexpflag, int no_error);
270 int char_quoted(struct buffer *buf, Bufpos pos);
272 /* NOTE: This does not refer to the mirror table, but to the
273 syntax table itself. */
274 Lisp_Object syntax_match(Lisp_Object table, Emchar ch);
276 extern int no_quit_in_re_search;
277 extern struct buffer *regex_emacs_buffer;
279 /* Target text (string or buffer), used for syntax-table properties. */
280 extern Lisp_Object regex_match_object;
282 void update_syntax_table(Lisp_Char_Table * ct);
284 /* The syntax table cache */
287 The *-single-property-change versions turn out to be unbearably slow.
288 Do not enable them in a production or distribution version.
290 #define NEXT_SINGLE_PROPERTY_CHANGE 0
291 #define PREVIOUS_SINGLE_PROPERTY_CHANGE 0
293 /* Test instruments, used in macros below.
294 Define SYNTAX_CACHE_STATISTICS to enable them. */
295 /* #undef SYNTAX_CACHE_STATISTICS */
297 #ifdef SYNTAX_CACHE_STATISTICS
298 #define SYNTAX_CACHE_STATISTICS_REPORT_INTERVAL 100000
300 enum syntax_cache_statistics_functions {
301 scs_no_function = -1,
302 scs_find_context = 0,
303 scs_find_defun_start,
305 scs_Fforward_comment,
307 scs_Fbackward_prefix_characters,
308 scs_scan_sexps_forward,
309 scs_number_of_functions
312 /* keep this in synch with syntax.c */
313 extern char *syntax_cache_statistics_function_names[scs_number_of_functions];
315 struct syntax_cache_statistics {
316 /* inits + misses_hi + misses_lo + #HITS = total_updates */
324 double mean_length_on_miss;
325 enum syntax_cache_statistics_functions this_function;
326 int functions[scs_number_of_functions];
329 extern struct syntax_cache_statistics scs_statistics;
331 #define SCS_STATISTICS_SET_FUNCTION(fndx) scs_statistics.this_function = fndx
332 /* used in macros below */
333 #define SYNTAX_CACHE_STATISTICS_COUNT_INIT scs_statistics.inits++
337 #define SCS_STATISTICS_SET_FUNCTION(fndx)
338 #define SYNTAX_CACHE_STATISTICS_COUNT_INIT
340 #endif /* SYNTAX_CACHE_STATISTICS */
342 /* Theory of the syntax table cache
344 This cache cooperates with but is conceptually different from the
345 mirror table. The mirror table precomputes (and caches, if you like)
346 the syntax codes for characters in a given syntax table, taking into
347 account possible inheritance from a table given by a parent text object.
348 The syntax table cache checks for overriding tables defined by
351 This implementation defines the "subobjects" by _extent properties_.
352 We may restrict them to _text_ properties. There are two lookup
353 styles for the cache, "single code" and "full table". In the "single
354 code" style, a given syntax code, kept in the `syntax_code' member, is
355 applied to the entire range (#### check this). In the "full table"
356 style, a syntax table kept in the `current_syntax_table' member is
357 checked for each character in the range. If the flag `use_code' is
358 non-zero, the "single code" is used, otherwise the "full table".
360 The cache is valid for the range `[prev_change, next_change)' in the
361 text object (buffer or string) `object'.
363 If the current position is outside the range valid for the cache, the
364 cache is updated by checking for the text property `syntax-table'. If
365 present, its value is either a syntax code or a syntax table, and the
366 appropriate member and `use_code' are updated accordingly. If absent
367 or nil, the default syntax table from the `buffer' member is used. The
368 extent of the property is used to reinitialize the cache's validity
369 range. (We would like to improve this by checking the property value
370 against `old_prop', and if the same, extend the validity range of the
371 cache by the extent of the property.)
373 Note: the values Qt and Qnil for `object' are not supported in this
374 implementation. GNU Emacs uses them for reasons not yet (####) clear.
377 extern int lookup_syntax_properties;
379 struct syntax_cache {
380 int use_code; /* Whether to use syntax_code
381 or current_syntax_table. */
382 struct buffer *buffer; /* The buffer providing the default
383 syntax table to the cache. */
384 Lisp_Object object; /* The buffer or string the current
385 syntax cache applies to. */
386 enum syntaxcode syntax_code; /* Syntax code of current char. */
387 Lisp_Object current_syntax_table; /* Syntax table for current pos. */
388 Lisp_Object old_prop; /* Syntax-table prop at prev pos. */
390 Bufpos next_change; /* Position of the next extent
392 Bufpos prev_change; /* Position of the previous
395 extern struct syntax_cache syntax_cache;
398 The macros below handle the internal structure of the cache.
399 ALWAYS USE THE MACROS TO MANIPULATE THE CACHE.
401 o Use the SETUP_SYNTAX_CACHE* macros to set the object and buffer members.
403 OBJECT is either a Lisp buffer or a Lisp string. BUFFER is a
404 pointer to struct buffer. If OBJECT is a buffer, it must refer to
405 BUFFER. If OBJECT is a string, then BUFFER will supply the default
406 syntax table when the `syntax-table' property is nil.
408 For convenience and backward compatibility, the values Qt and Qnil are
409 accepted for OBJECT. These are taken to refer to the current buffer,
410 and that substitution is made immediately. The value Qt is treated
411 specially in the *BYTE_TO_CHAR macros below. This appears (####) to
412 be a GNU kludge related to `enable-multibyte-characters' and was used
415 FROM is the starting character position in OBJECT.
416 COUNT is currently used only as a flag. If positive, we are proceeding
417 forward through OBJECT, otherwise in reverse.
419 o All other members are updated using the update_syntax_cache
420 function, normally wrapped in the UPDATE_SYNTAX_CACHE* macros.
423 void update_syntax_cache(int pos, int count);
425 /* in one example the high misses vastly outweigh the low ones
426 seems plausible, since we typically are moving forward through the buffer */
427 #define UPDATE_SYNTAX_CACHE_INTERNAL(pos, dir) \
428 ((lookup_syntax_properties && \
429 (pos >= syntax_cache.next_change || \
430 pos < syntax_cache.prev_change)) \
431 ? (update_syntax_cache ((pos), dir), 1) \
434 /* In the current implementation, all of the following are identical. */
435 /* Make syntax cache state good for CHARPOS, assuming it is
436 currently good for a position before CHARPOS. */
437 #define UPDATE_SYNTAX_CACHE_FORWARD(pos) UPDATE_SYNTAX_CACHE_INTERNAL(pos, 1)
439 /* Make syntax cache state good for CHARPOS, assuming it is
440 currently good for a position after CHARPOS. */
441 #define UPDATE_SYNTAX_CACHE_BACKWARD(pos) UPDATE_SYNTAX_CACHE_INTERNAL(pos, -1)
443 /* Make syntax cache state good for CHARPOS */
444 #define UPDATE_SYNTAX_CACHE(pos) UPDATE_SYNTAX_CACHE_INTERNAL(pos, 0)
446 #define SYNTAX_FROM_CACHE(table, c) \
447 SYNTAX_FROM_CODE (SYNTAX_CODE_FROM_CACHE (table, c))
449 #define SYNTAX_CODE_FROM_CACHE(table, c) \
450 ( syntax_cache.use_code \
451 ? syntax_cache.syntax_code \
452 : SYNTAX_CODE (XCHAR_TABLE (syntax_cache.current_syntax_table), \
456 /* Convert the byte offset BYTEPOS into a character position,
457 for the object recorded in syntax_cache with SETUP_SYNTAX_CACHE*.
459 The value is meant for use in the UPDATE_SYNTAX_CACHE... macros.
460 These macros do nothing when lookup_syntax_properties is 0,
461 so we return 0 in that case, for speed.
463 The default case does no conversion; this seems (####) to be an
464 evil hangover from GNU Emacs. */
465 #define SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR(obj, buf, bytepos) \
466 (! lookup_syntax_properties \
469 ? bytecount_to_charcount (XSTRING_DATA (obj), bytepos) \
470 : (BUFFERP (obj) || NILP (obj)) \
471 ? bytind_to_bufpos (buf, bytepos + BI_BUF_BEGV (buf)) \
474 #define SYNTAX_CACHE_BYTE_TO_CHAR(bytepos) \
475 SYNTAX_CACHE_OBJECT_BYTE_TO_CHAR (syntax_cache.object, syntax_cache.buffer, \
478 #define SETUP_SYNTAX_CACHE(FROM, COUNT) \
479 SETUP_SYNTAX_CACHE_FOR_BUFFER (current_buffer, (FROM), (COUNT))
481 #define SETUP_SYNTAX_CACHE_FOR_BUFFER(BUFFER, FROM, COUNT) \
482 SETUP_SYNTAX_CACHE_FOR_OBJECT (Qnil, (BUFFER), (FROM), (COUNT))
484 #define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT) \
486 syntax_cache.buffer = (BUFFER); \
487 syntax_cache.object = (OBJECT); \
488 if (NILP (syntax_cache.object)) \
490 XSETBUFFER (syntax_cache.object, syntax_cache.buffer); \
492 else if (EQ (syntax_cache.object, Qt)) \
494 XSETBUFFER (syntax_cache.object, syntax_cache.buffer); \
496 else if (STRINGP (syntax_cache.object)) \
500 else if (BUFFERP (syntax_cache.object)) \
502 syntax_cache.buffer = XBUFFER (syntax_cache.object); \
506 /* OBJECT must be buffer/string/t/nil */ \
509 syntax_cache.current_syntax_table \
510 = syntax_cache.buffer->mirror_syntax_table; \
511 syntax_cache.use_code = 0; \
512 if (lookup_syntax_properties) \
514 SYNTAX_CACHE_STATISTICS_COUNT_INIT; \
515 update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), (COUNT)); \
519 #define SYNTAX_CODE_PREFIX(c) \
522 #define SYNTAX_CODE_COMMENT_BITS(c) \
525 #define SYNTAX_CODES_START_P(a, b) \
526 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START) >> 2) \
527 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START))
529 #define SYNTAX_CODES_END_P(a, b) \
530 (((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END) >> 2) \
531 & (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END))
533 #define SYNTAX_CODES_COMMENT_MASK_START(a, b) \
534 (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_A) \
535 ? SYNTAX_COMMENT_STYLE_A \
536 : (SYNTAX_CODES_MATCH_START_P (a, b, SYNTAX_COMMENT_STYLE_B) \
537 ? SYNTAX_COMMENT_STYLE_B \
539 #define SYNTAX_CODES_COMMENT_MASK_END(a, b) \
540 (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_A) \
541 ? SYNTAX_COMMENT_STYLE_A \
542 : (SYNTAX_CODES_MATCH_END_P (a, b, SYNTAX_COMMENT_STYLE_B) \
543 ? SYNTAX_COMMENT_STYLE_B \
546 #define SYNTAX_CODE_START_FIRST_P(a) \
547 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START)
549 #define SYNTAX_CODE_START_SECOND_P(a) \
550 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_START)
552 #define SYNTAX_CODE_END_FIRST_P(a) \
553 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END)
555 #define SYNTAX_CODE_END_SECOND_P(a) \
556 (SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_SECOND_CHAR_END)
558 #define SYNTAX_CODES_MATCH_START_P(a, b, mask) \
559 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_START & (mask)) \
560 && (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_START & (mask)))
562 #define SYNTAX_CODES_MATCH_END_P(a, b, mask) \
563 ((SYNTAX_CODE_COMMENT_BITS (a) & SYNTAX_FIRST_CHAR_END & (mask)) \
564 && (SYNTAX_CODE_COMMENT_BITS (b) & SYNTAX_SECOND_CHAR_END & (mask)))
566 #define SYNTAX_CODE_MATCHES_1CHAR_P(a, mask) \
567 ((SYNTAX_CODE_COMMENT_BITS (a) & (mask)))
569 #define SYNTAX_CODE_COMMENT_1CHAR_MASK(a) \
570 ((SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_A) \
571 ? SYNTAX_COMMENT_STYLE_A \
572 : (SYNTAX_CODE_MATCHES_1CHAR_P (a, SYNTAX_COMMENT_STYLE_B) \
573 ? SYNTAX_COMMENT_STYLE_B \
577 /* These are the things that need to be #defined away to create a
578 no syntax-table property version. */
580 /* This should be entirely encapsulated in macros
581 #define update_syntax_cache(pos, count)
583 #define lookup_syntax_properties 0
585 #define SETUP_SYNTAX_CACHE(FROM, COUNT)
586 #define SETUP_SYNTAX_CACHE_FOR_BUFFER(BUFFER, FROM, COUNT)
587 #define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT)
588 #define UPDATE_SYNTAX_CACHE_FORWARD(pos)
589 #define UPDATE_SYNTAX_CACHE_BACKWARD(pos)
590 #define UPDATE_SYNTAX_CACHE(pos)
592 #define SYNTAX_FROM_CACHE SYNTAX
593 #define SYNTAX_CODE_FROM_CACHE SYNTAX_CODE
595 #define SYNTAX_CACHE_BYTE_TO_CHAR(x) 0
597 /* cache statistics */
598 #define SCS_STATISTICS_SET_FUNCTION(fndx)
599 #define SYNTAX_CACHE_STATISTICS_COUNT_INIT
602 #endif /* INCLUDED_syntax_h_ */