Mercurial > hg > xemacs-beta
comparison src/syntax.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 2f8bb876ab1d |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 Boston, MA 02111-1307, USA. */ | 19 Boston, MA 02111-1307, USA. */ |
20 | 20 |
21 /* Synched up with: FSF 19.28. */ | 21 /* Synched up with: FSF 19.28. */ |
22 | 22 |
23 #ifndef INCLUDED_syntax_h_ | 23 #ifndef _XEMACS_SYNTAX_H_ |
24 #define INCLUDED_syntax_h_ | 24 #define _XEMACS_SYNTAX_H_ |
25 | 25 |
26 #include "chartab.h" | 26 #include "chartab.h" |
27 | 27 |
28 /* A syntax table is a type of char table. | 28 /* A syntax table is a type of char table. |
29 | 29 |
70 /* Return the syntax code for a particular character and mirror table. */ | 70 /* Return the syntax code for a particular character and mirror table. */ |
71 | 71 |
72 #define SYNTAX_CODE_UNSAFE(table, c) \ | 72 #define SYNTAX_CODE_UNSAFE(table, c) \ |
73 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c)) | 73 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c)) |
74 | 74 |
75 INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c); | 75 INLINE int SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c); |
76 INLINE_HEADER int | 76 INLINE int |
77 SYNTAX_CODE (Lisp_Char_Table *table, Emchar c) | 77 SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c) |
78 { | 78 { |
79 return SYNTAX_CODE_UNSAFE (table, c); | 79 return SYNTAX_CODE_UNSAFE (table, c); |
80 } | 80 } |
81 | 81 |
82 #define SYNTAX_UNSAFE(table, c) \ | 82 #define SYNTAX_UNSAFE(table, c) \ |
83 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177)) | 83 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177)) |
84 | 84 |
85 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177)) | 85 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177)) |
86 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c)) | 86 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c)) |
87 | 87 |
88 INLINE_HEADER int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c); | 88 INLINE int WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c); |
89 INLINE_HEADER int | 89 INLINE int |
90 WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c) | 90 WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c) |
91 { | 91 { |
92 return SYNTAX (table, c) == Sword; | 92 return SYNTAX (table, c) == Sword; |
93 } | 93 } |
94 | 94 |
95 /* OK, here's a graphic diagram of the format of the syntax values: | 95 /* OK, here's a graphic diagram of the format of the syntax values: |
168 #define SYNTAX_FIRST_CHAR 0xcc | 168 #define SYNTAX_FIRST_CHAR 0xcc |
169 #define SYNTAX_SECOND_CHAR_START 0x30 | 169 #define SYNTAX_SECOND_CHAR_START 0x30 |
170 #define SYNTAX_SECOND_CHAR_END 0x03 | 170 #define SYNTAX_SECOND_CHAR_END 0x03 |
171 #define SYNTAX_SECOND_CHAR 0x33 | 171 #define SYNTAX_SECOND_CHAR 0x33 |
172 | 172 |
173 | 173 #define SYNTAX_START_P(table, a, b) \ |
174 /* #### These are now more or less equivalent to | 174 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) \ |
175 SYNTAX_COMMENT_MATCH_START ...*/ | 175 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START)) |
176 /* a and b must be first and second start chars for a common type */ | 176 |
177 #define SYNTAX_START_P(table, a, b) \ | 177 #define SYNTAX_END_P(table, a, b) \ |
178 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \ | 178 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) \ |
179 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START)) | 179 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END)) |
180 | |
181 /* ... and SYNTAX_COMMENT_MATCH_END */ | |
182 /* a and b must be first and second end chars for a common type */ | |
183 #define SYNTAX_END_P(table, a, b) \ | |
184 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \ | |
185 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END)) | |
186 | 180 |
187 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \ | 181 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \ |
188 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \ | 182 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \ |
189 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask))) | 183 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask))) |
190 | 184 |
236 | 230 |
237 /* This array, indexed by a character, contains the syntax code which | 231 /* This array, indexed by a character, contains the syntax code which |
238 that character signifies (as a char). | 232 that character signifies (as a char). |
239 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */ | 233 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */ |
240 | 234 |
241 extern const unsigned char syntax_spec_code[0400]; | 235 extern CONST unsigned char syntax_spec_code[0400]; |
242 | 236 |
243 /* Indexed by syntax code, give the letter that describes it. */ | 237 /* Indexed by syntax code, give the letter that describes it. */ |
244 | 238 |
245 extern const unsigned char syntax_code_spec[]; | 239 extern CONST unsigned char syntax_code_spec[]; |
246 | 240 |
247 Lisp_Object scan_lists (struct buffer *buf, Bufpos from, int count, | 241 Lisp_Object scan_lists (struct buffer *buf, int from, int count, |
248 int depth, int sexpflag, int no_error); | 242 int depth, int sexpflag, int no_error); |
249 int char_quoted (struct buffer *buf, Bufpos pos); | 243 int char_quoted (struct buffer *buf, int pos); |
250 | 244 |
251 /* NOTE: This does not refer to the mirror table, but to the | 245 /* NOTE: This does not refer to the mirror table, but to the |
252 syntax table itself. */ | 246 syntax table itself. */ |
253 Lisp_Object syntax_match (Lisp_Object table, Emchar ch); | 247 Lisp_Object syntax_match (Lisp_Object table, Emchar ch); |
254 | 248 |
255 extern int no_quit_in_re_search; | 249 extern int no_quit_in_re_search; |
256 extern struct buffer *regex_emacs_buffer; | 250 extern struct buffer *regex_emacs_buffer; |
257 | 251 |
258 void update_syntax_table (Lisp_Char_Table *ct); | 252 void update_syntax_table (struct Lisp_Char_Table *ct); |
259 | 253 |
260 #endif /* INCLUDED_syntax_h_ */ | 254 #endif /* _XEMACS_SYNTAX_H_ */ |