annotate src/syntax.h @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Declarations having to do with XEmacs syntax tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.28. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #ifndef _XEMACS_SYNTAX_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #define _XEMACS_SYNTAX_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* The standard syntax table is stored where it will automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 be used in all new buffers. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 extern Lisp_Object Vstandard_syntax_table;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* A syntax table is a Lisp vector of length 0400, whose elements are integers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 The low 7 bits of the integer is a code, as follows. The 8th bit is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 used as the prefix bit flag (see below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 enum syntaxcode
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
37 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
38 Swhitespace, /* whitespace character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
39 Spunct, /* random punctuation character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
40 Sword, /* word constituent */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
41 Ssymbol, /* symbol constituent but not word constituent */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
42 Sopen, /* a beginning delimiter */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
43 Sclose, /* an ending delimiter */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
44 Squote, /* a prefix character like Lisp ' */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
45 Sstring, /* a string-grouping character like Lisp " */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
46 Smath, /* delimiters like $ in TeX. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
47 Sescape, /* a character that begins a C-style escape */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
48 Scharquote, /* a character that quotes the following character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
49 Scomment, /* a comment-starting character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
50 Sendcomment, /* a comment-ending character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
51 Sinherit, /* use the standard syntax table for this character */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
52 Sextword, /* extended word; works mostly like a word constituent.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
53 See the comment in syntax.c. */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
54 Smax /* Upper bound on codes that are meaningful */
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
55 };
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 extern Lisp_Object Qsyntax_table_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Lisp_Object Fsyntax_table_p (Lisp_Object);
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
59 Lisp_Object Fsyntax_table (Lisp_Object);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Lisp_Object Fset_syntax_table (Lisp_Object, Lisp_Object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 /* Return the raw syntax code for a particular character and table */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #define RAW_SYNTAX_CODE_UNSAFE(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (XINT (vector_data (XVECTOR (table))[(unsigned char) (c)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 /* Return the syntax code for a particular character and table, taking
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 into account inheritance. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 /* Unfortunately, we cannot write SYNTAX_CODE() as a safe macro in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 general. I tried just using an inline function but that causes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 significant slowdown (esp. in regex routines) because this macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 is called so many millions of times. So instead we resort to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 SYNTAX_CODE_UNSAFE(), which is used most of the time. Under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 GCC we can actually write this as a safe macro, and we do because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 it's likely to lead to speedups. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #ifdef __GNUC__
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 #define SYNTAX_CODE_UNSAFE(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ({ Emchar _ch_ = (c); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 int _rawcode_ = RAW_SYNTAX_CODE_UNSAFE (table, _ch_); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 if ((enum syntaxcode) (_rawcode_ & 0177) == Sinherit) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 _rawcode_ = RAW_SYNTAX_CODE_UNSAFE (Vstandard_syntax_table, _ch_); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 _rawcode_; })
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 #define SYNTAX_CODE_UNSAFE(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (RAW_SYNTAX_CODE_UNSAFE (table, c) == Sinherit \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ? RAW_SYNTAX_CODE_UNSAFE (Vstandard_syntax_table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 : RAW_SYNTAX_CODE_UNSAFE (table, c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 INLINE int SYNTAX_CODE (Lisp_Object table, Emchar c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 INLINE int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 SYNTAX_CODE (Lisp_Object table, Emchar c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 return SYNTAX_CODE_UNSAFE (table, c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 #define SYNTAX_UNSAFE(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 INLINE int WORD_SYNTAX_P (Lisp_Object table, Emchar c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 INLINE int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 WORD_SYNTAX_P (Lisp_Object table, Emchar c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 int syncode = SYNTAX (table, c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 return syncode == Sword || syncode == Sextword;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 #define SYNTAX_PREFIX_UNSAFE(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ((SYNTAX_CODE_UNSAFE (table, c) >> 7) & 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 #define SYNTAX_PREFIX(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ((SYNTAX_CODE (table, c) >> 7) & 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 /* The next 8 bits of the number is a character,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 the matching delimiter in the case of Sopen or Sclose. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 #define SYNTAX_MATCH(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ((SYNTAX_CODE (table, c) >> 8) & 0377)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 /* The next 8 bits are used to implement up to two comment styles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 in a single buffer. They have the following meanings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 1. first of a one or two character comment-start sequence of style a.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 2. first of a one or two character comment-start sequence of style b.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 3. second of a two-character comment-start sequence of style a.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 4. second of a two-character comment-start sequence of style b.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 5. first of a one or two character comment-end sequence of style a.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 6. first of a one or two character comment-end sequence of style b.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 7. second of a two-character comment-end sequence of style a.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 8. second of a two-character comment-end sequence of style b.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 #define SYNTAX_COMMENT_BITS(table, c) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ((SYNTAX_CODE (table, c) >> 16) &0xff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 #define SYNTAX_FIRST_OF_START_A 0x80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 #define SYNTAX_FIRST_OF_START_B 0x40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 #define SYNTAX_SECOND_OF_START_A 0x20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 #define SYNTAX_SECOND_OF_START_B 0x10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 #define SYNTAX_FIRST_OF_END_A 0x08
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #define SYNTAX_FIRST_OF_END_B 0x04
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 #define SYNTAX_SECOND_OF_END_A 0x02
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 #define SYNTAX_SECOND_OF_END_B 0x01
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 #define SYNTAX_COMMENT_STYLE_A 0xaa
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 #define SYNTAX_COMMENT_STYLE_B 0x55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #define SYNTAX_FIRST_CHAR_START 0xc0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 #define SYNTAX_FIRST_CHAR_END 0x0c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 #define SYNTAX_FIRST_CHAR 0xcc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #define SYNTAX_SECOND_CHAR_START 0x30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #define SYNTAX_SECOND_CHAR_END 0x03
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 #define SYNTAX_SECOND_CHAR 0x33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 #define SYNTAX_START_P(table, a, b) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 #define SYNTAX_END_P(table, a, b) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 #define SYNTAX_STYLES_MATCH_END_P(table, a, b, mask) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END & (mask)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END & (mask)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 #define SYNTAX_STYLES_MATCH_1CHAR_P(table, a, mask) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ((SYNTAX_COMMENT_BITS (table, a) & (mask)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #define STYLE_FOUND_P(table, a, b, startp, style) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ((SYNTAX_COMMENT_BITS (table, a) & \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ((startp) ? SYNTAX_FIRST_CHAR_START : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 SYNTAX_FIRST_CHAR_END) & (style)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 && (SYNTAX_COMMENT_BITS (table, b) & \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ((startp) ? SYNTAX_SECOND_CHAR_START : \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 SYNTAX_SECOND_CHAR_END) & (style)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 #define SYNTAX_COMMENT_MASK_START(table, a, b) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ((STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_A) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ? SYNTAX_COMMENT_STYLE_A \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 : (STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_B) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ? SYNTAX_COMMENT_STYLE_B \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 : 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 #define SYNTAX_COMMENT_MASK_END(table, a, b) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ((STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_A) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ? SYNTAX_COMMENT_STYLE_A \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 : (STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_B) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ? SYNTAX_COMMENT_STYLE_B \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 : 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 #define STYLE_FOUND_1CHAR_P(table, a, style) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ((SYNTAX_COMMENT_BITS (table, a) & (style)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 #define SYNTAX_COMMENT_1CHAR_MASK(table, a) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ((STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_A) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ? SYNTAX_COMMENT_STYLE_A \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 : (STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_B) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ? SYNTAX_COMMENT_STYLE_B \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 : 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
210 /* This array, indexed by a character, contains the syntax code which
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
211 that character signifies (as a char).
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
212 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 extern CONST unsigned char syntax_spec_code[0400];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 /* Indexed by syntax code, give the letter that describes it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 extern CONST unsigned char syntax_code_spec[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 Lisp_Object scan_lists (struct buffer *buf, int from, int count,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 int depth, int sexpflag, int no_error);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 int char_quoted (struct buffer *buf, int pos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 /* NOTE: This does not refer to the mirror table, but to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 syntax table itself. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 Lisp_Object syntax_match (Lisp_Object table, Emchar ch);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 extern int no_quit_in_re_search;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 extern struct buffer *regex_emacs_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 #endif /* _XEMACS_SYNTAX_H_ */