annotate src/syntax.h @ 70:131b0175ea99 r20-0b30

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