annotate src/syntax.h @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 223736d75acb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Declarations having to do with XEmacs syntax tables.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.28. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
23 #ifndef INCLUDED_syntax_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
24 #define INCLUDED_syntax_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include "chartab.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 /* A syntax table is a type of char table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 The low 7 bits of the integer is a code, as follows. The 8th bit is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 used as the prefix bit flag (see below).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 The values in a syntax table are either integers or conses of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 integers and chars. The lowest 7 bits of the integer are the syntax
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 class. If this is Sinherit, then the actual syntax value needs to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 be retrieved from the standard syntax table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 Since the logic involved in finding the actual integer isn't very
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 complex, you'd think the time required to retrieve it is not a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 factor. If you thought that, however, you'd be wrong, due to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 high number of times (many per character) that the syntax value is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 accessed in functions such as scan_lists(). To speed this up,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 we maintain a mirror syntax table that contains the actual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 integers. We can do this successfully because syntax tables are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 now an abstract type, where we control all access.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 enum syntaxcode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Swhitespace, /* whitespace character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 Spunct, /* random punctuation character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 Sword, /* word constituent */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 Ssymbol, /* symbol constituent but not word constituent */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Sopen, /* a beginning delimiter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Sclose, /* an ending delimiter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 Squote, /* a prefix character like Lisp ' */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Sstring, /* a string-grouping character like Lisp " */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 Smath, /* delimiters like $ in TeX. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Sescape, /* a character that begins a C-style escape */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 Scharquote, /* a character that quotes the following character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 Scomment, /* a comment-starting character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 Sendcomment, /* a comment-ending character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 Sinherit, /* use the standard syntax table for this character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 Smax /* Upper bound on codes that are meaningful */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 enum syntaxcode charset_syntax (struct buffer *buf, Lisp_Object charset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 int *multi_p_out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 /* Return the syntax code for a particular character and mirror table. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #define SYNTAX_CODE_UNSAFE(table, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 XINT (CHAR_TABLE_VALUE_UNSAFE (table, c))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
75 INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
76 INLINE_HEADER int
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
77 SYNTAX_CODE (Lisp_Char_Table *table, Emchar c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 return SYNTAX_CODE_UNSAFE (table, c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 #define SYNTAX_UNSAFE(table, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ((enum syntaxcode) (SYNTAX_CODE_UNSAFE (table, c) & 0177))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
88 INLINE_HEADER int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
89 INLINE_HEADER int
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
90 WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 return SYNTAX (table, c) == Sword;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 /* OK, here's a graphic diagram of the format of the syntax values:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Bit number:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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 ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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 ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 <-----> <-----> <-------------> <-------------> ^ <----------->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ELisp unused |comment bits | unused | syntax code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 tag | | | | | | | | |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 stuff | | | | | | | | |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 | | | | | | | | |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 | | | | | | | | `--> prefix flag
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 | | | | | | | |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 | | | | | | | `--> comment end style B, second char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 | | | | | | `----> comment end style A, second char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 | | | | | `------> comment end style B, first char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 | | | | `--------> comment end style A, first char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 | | | `----------> comment start style B, second char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 | | `------------> comment start style A, second char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 | `--------------> comment start style B, first char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 `----------------> comment start style A, first char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 In a 64-bit integer, there would be 32 more unused bits between
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 the tag and the comment bits.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 Clearly, such a scheme will not work for Mule, because the matching
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 paren could be any character and as such requires 19 bits, which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 we don't got.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 Remember that under Mule we use char tables instead of vectors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 So what we do is use another char table for the matching paren
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 and store a pointer to it in the first char table. (This frees
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 code from having to worry about passing two tables around.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 /* The prefix flag bit for backward-prefix-chars is now put into bit 7. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #define SYNTAX_PREFIX_UNSAFE(table, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 ((SYNTAX_CODE_UNSAFE (table, c) >> 7) & 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 #define SYNTAX_PREFIX(table, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 ((SYNTAX_CODE (table, c) >> 7) & 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 /* Bits 23-16 are used to implement up to two comment styles
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 in a single buffer. They have the following meanings:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 1. first of a one or two character comment-start sequence of style a.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 2. first of a one or two character comment-start sequence of style b.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 3. second of a two-character comment-start sequence of style a.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 4. second of a two-character comment-start sequence of style b.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 5. first of a one or two character comment-end sequence of style a.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 6. first of a one or two character comment-end sequence of style b.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 7. second of a two-character comment-end sequence of style a.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 8. second of a two-character comment-end sequence of style b.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 #define SYNTAX_COMMENT_BITS(table, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 ((SYNTAX_CODE (table, c) >> 16) &0xff)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #define SYNTAX_FIRST_OF_START_A 0x80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 #define SYNTAX_FIRST_OF_START_B 0x40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 #define SYNTAX_SECOND_OF_START_A 0x20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 #define SYNTAX_SECOND_OF_START_B 0x10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #define SYNTAX_FIRST_OF_END_A 0x08
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 #define SYNTAX_FIRST_OF_END_B 0x04
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 #define SYNTAX_SECOND_OF_END_A 0x02
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #define SYNTAX_SECOND_OF_END_B 0x01
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 #define SYNTAX_COMMENT_STYLE_A 0xaa
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #define SYNTAX_COMMENT_STYLE_B 0x55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 #define SYNTAX_FIRST_CHAR_START 0xc0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 #define SYNTAX_FIRST_CHAR_END 0x0c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 #define SYNTAX_FIRST_CHAR 0xcc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 #define SYNTAX_SECOND_CHAR_START 0x30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #define SYNTAX_SECOND_CHAR_END 0x03
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 #define SYNTAX_SECOND_CHAR 0x33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
174 /* #### These are now more or less equivalent to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
175 SYNTAX_COMMENT_MATCH_START ...*/
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
176 /* a and b must be first and second start chars for a common type */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
177 #define SYNTAX_START_P(table, a, b) \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
178 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2) \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
179 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
180
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
181 /* ... and SYNTAX_COMMENT_MATCH_END */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
182 /* a and b must be first and second end chars for a common type */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
183 #define SYNTAX_END_P(table, a, b) \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
184 (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2) \
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
185 & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START & (mask)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 #define SYNTAX_STYLES_MATCH_END_P(table, a, b, mask) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END & (mask)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END & (mask)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 #define SYNTAX_STYLES_MATCH_1CHAR_P(table, a, mask) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 ((SYNTAX_COMMENT_BITS (table, a) & (mask)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #define STYLE_FOUND_P(table, a, b, startp, style) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 ((SYNTAX_COMMENT_BITS (table, a) & \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 ((startp) ? SYNTAX_FIRST_CHAR_START : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 SYNTAX_FIRST_CHAR_END) & (style)) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 && (SYNTAX_COMMENT_BITS (table, b) & \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 ((startp) ? SYNTAX_SECOND_CHAR_START : \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 SYNTAX_SECOND_CHAR_END) & (style)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 #define SYNTAX_COMMENT_MASK_START(table, a, b) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 ((STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_A) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 ? SYNTAX_COMMENT_STYLE_A \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 : (STYLE_FOUND_P (table, a, b, 1, SYNTAX_COMMENT_STYLE_B) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 ? SYNTAX_COMMENT_STYLE_B \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 : 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #define SYNTAX_COMMENT_MASK_END(table, a, b) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 ((STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_A) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ? SYNTAX_COMMENT_STYLE_A \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 : (STYLE_FOUND_P (table, a, b, 0, SYNTAX_COMMENT_STYLE_B) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 ? SYNTAX_COMMENT_STYLE_B \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 : 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 #define STYLE_FOUND_1CHAR_P(table, a, style) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ((SYNTAX_COMMENT_BITS (table, a) & (style)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #define SYNTAX_COMMENT_1CHAR_MASK(table, a) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 ((STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_A) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 ? SYNTAX_COMMENT_STYLE_A \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 : (STYLE_FOUND_1CHAR_P (table, a, SYNTAX_COMMENT_STYLE_B) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 ? SYNTAX_COMMENT_STYLE_B \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 : 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 EXFUN (Fchar_syntax, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 EXFUN (Fforward_word, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 /* The standard syntax table is stored where it will automatically
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 be used in all new buffers. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 extern Lisp_Object Vstandard_syntax_table;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 /* This array, indexed by a character, contains the syntax code which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 that character signifies (as a char).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 For example, (enum syntaxcode) syntax_spec_code['w'] is Sword. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
241 extern const unsigned char syntax_spec_code[0400];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 /* Indexed by syntax code, give the letter that describes it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
245 extern const unsigned char syntax_code_spec[];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 Lisp_Object scan_lists (struct buffer *buf, Bufpos from, int count,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 int depth, int sexpflag, int no_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 int char_quoted (struct buffer *buf, Bufpos pos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 /* NOTE: This does not refer to the mirror table, but to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 syntax table itself. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 Lisp_Object syntax_match (Lisp_Object table, Emchar ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 extern int no_quit_in_re_search;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 extern struct buffer *regex_emacs_buffer;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
257 extern int regex_emacs_buffer_p;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
259 void update_syntax_table (Lisp_Char_Table *ct);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
261 #endif /* INCLUDED_syntax_h_ */