comparison src/syntax.h @ 25446:2a2d7ebaa018

(SYNTAX_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_NESTED): Add support for nested comments.
author Richard M. Stallman <rms@gnu.org>
date Sun, 29 Aug 1999 21:33:09 +0000
parents a31bf9d72c56
children 69c2d34eb25c
comparison
equal deleted inserted replaced
25445:d678b229c05a 25446:2a2d7ebaa018
156 (CONSP (syntax_temp) \ 156 (CONSP (syntax_temp) \
157 ? XCONS (syntax_temp)->cdr \ 157 ? XCONS (syntax_temp)->cdr \
158 : Qnil)) 158 : Qnil))
159 #endif 159 #endif
160 160
161 /* Then there are six single-bit flags that have the following meanings: 161 /* Then there are seven single-bit flags that have the following meanings:
162 1. This character is the first of a two-character comment-start sequence. 162 1. This character is the first of a two-character comment-start sequence.
163 2. This character is the second of a two-character comment-start sequence. 163 2. This character is the second of a two-character comment-start sequence.
164 3. This character is the first of a two-character comment-end sequence. 164 3. This character is the first of a two-character comment-end sequence.
165 4. This character is the second of a two-character comment-end sequence. 165 4. This character is the second of a two-character comment-end sequence.
166 5. This character is a prefix, for backward-prefix-chars. 166 5. This character is a prefix, for backward-prefix-chars.
167 6. see below
168 7. This character is part of a nestable comment sequence.
167 Note that any two-character sequence whose first character has flag 1 169 Note that any two-character sequence whose first character has flag 1
168 and whose second character has flag 2 will be interpreted as a comment start. 170 and whose second character has flag 2 will be interpreted as a comment start.
169 171
170 bit 6 is used to discriminate between two different comment styles. 172 bit 6 is used to discriminate between two different comment styles.
171 Languages such as C++ allow two orthogonal syntax start/end pairs 173 Languages such as C++ allow two orthogonal syntax start/end pairs
186 188
187 #define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1) 189 #define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
188 190
189 #define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1) 191 #define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
190 192
193 #define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1)
194
191 /* These macros extract specific flags from an integer 195 /* These macros extract specific flags from an integer
192 that holds the syntax code and the flags. */ 196 that holds the syntax code and the flags. */
193 197
194 #define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1) 198 #define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
195 199
200 #define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1) 204 #define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
201 205
202 #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) 206 #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
203 207
204 #define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1) 208 #define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1)
209
210 #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
205 211
206 /* This array, indexed by a character, contains the syntax code which that 212 /* This array, indexed by a character, contains the syntax code which that
207 character signifies (as a char). For example, 213 character signifies (as a char). For example,
208 (enum syntaxcode) syntax_spec_code['w'] is Sword. */ 214 (enum syntaxcode) syntax_spec_code['w'] is Sword. */
209 215