annotate src/syntax.h @ 17344:0178aa2a41e9

If malloc_{get,set}_state exist, set DOUG_LEA_MALLOC.
author Richard M. Stallman <rms@gnu.org>
date Wed, 09 Apr 1997 03:52:47 +0000
parents 156896ccc86e
children 8a008f65c8d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Declarations having to do with GNU Emacs syntax tables.
7307
cd81dba38a49 Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 5725
diff changeset
2 Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
12244
ac7375e60931 Update GPL to version 2.
Karl Heuer <kwzh@gnu.org>
parents: 7967
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13827
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13827
diff changeset
19 Boston, MA 02111-1307, USA. */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 extern Lisp_Object Qsyntax_table_p;
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 extern Lisp_Object Fsyntax_table_p (), Fsyntax_table (), Fset_syntax_table ();
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 /* The standard syntax table is stored where it will automatically
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 be used in all new buffers. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 #define Vstandard_syntax_table buffer_defaults.syntax_table
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
29 /* A syntax table is a chartable whose elements are cons cells
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
30 (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
31 is not a kind of parenthesis.
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
33 The low 8 bits of CODE+FLAGS is a code, as follows: */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 enum syntaxcode
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 {
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 Swhitespace, /* for a whitespace character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 Spunct, /* for random punctuation characters */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 Sword, /* for a word constituent */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 Ssymbol, /* symbol constituent but not word constituent */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 Sopen, /* for a beginning delimiter */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 Sclose, /* for an ending delimiter */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 Squote, /* for a prefix character like Lisp ' */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 Sstring, /* for a string-grouping character like Lisp " */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 Smath, /* for delimiters like $ in Tex. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 Sescape, /* for a character that begins a C-style escape */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 Scharquote, /* for a character that quotes the following character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 Scomment, /* for a comment-starting character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 Sendcomment, /* for a comment-ending character */
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
50 Sinherit, /* use the standard syntax table for this character */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 Smax /* Upper bound on codes that are meaningful */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 };
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
54 /* Set the syntax entry VAL for char C in table TABLE. */
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
55
17127
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
56 #define SET_RAW_SYNTAX_ENTRY(table, c, val) \
17181
156896ccc86e (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 17127
diff changeset
57 ((c) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
17127
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
58 ? (XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val)) \
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
59 : Faset ((table), make_number (c), (val)))
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
61 /* Fetch the syntax entry for char C in syntax table TABLE.
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
62 This macro is called only when C is less than CHAR_TABLE_ORDINARY_SLOTS.
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
63 Do inheritance. */
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
64
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
65 #ifdef __GNUC__
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
66 #define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
67 ({ Lisp_Object tbl = table; \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
68 Lisp_Object temp = XCHAR_TABLE (tbl)->contents[(c)]; \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
69 while (NILP (temp)) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
70 { \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
71 tbl = XCHAR_TABLE (tbl)->parent; \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
72 if (NILP (tbl)) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
73 break; \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
74 temp = XCHAR_TABLE (tbl)->contents[(c)]; \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
75 } \
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
76 temp; })
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
77 #else
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
78 extern Lisp_Object syntax_temp;
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
79 extern Lisp_Object syntax_parent_lookup ();
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
80
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
81 #define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
82 (syntax_temp = XCHAR_TABLE (table)->contents[(c)], \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
83 (NILP (syntax_temp) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
84 ? syntax_parent_lookup (table, (c)) \
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
85 : syntax_temp))
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
86 #endif
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
87
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
88 /* Fetch the syntax entry for char C in the current syntax table.
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
89 This returns the whole entry (normally a cons cell).
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
90 Do Inheritance. */
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
91
17127
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
92 #define SYNTAX_ENTRY(c) \
17181
156896ccc86e (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 17127
diff changeset
93 ((c) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
17127
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
94 ? SYNTAX_ENTRY_FOLLOW_PARENT (current_buffer->syntax_table, \
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
95 (unsigned char) (c)) \
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
96 : Faref (current_buffer->syntax_table, make_number ((c))))
ab43d13fdfd5 (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents: 17045
diff changeset
97
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
98
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
99 /* Extract the information from the entry for character C
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
100 in the current syntax table. */
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
101
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
102 #ifdef __GNUC__
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
103 #define SYNTAX(c) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
104 ({ Lisp_Object temp; \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
105 temp = SYNTAX_ENTRY (c); \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
106 (CONSP (temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
107 ? (enum syntaxcode) (XINT (XCONS (temp)->car) & 0xff) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
108 : Swhitespace); })
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
109
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
110 #define SYNTAX_WITH_FLAGS(c) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
111 ({ Lisp_Object temp; \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
112 temp = SYNTAX_ENTRY (c); \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
113 (CONSP (temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
114 ? XINT (XCONS (temp)->car) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
115 : (int) Swhitespace); })
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
116
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
117 #define SYNTAX_MATCH(c) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
118 ({ Lisp_Object temp; \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
119 temp = SYNTAX_ENTRY (c); \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
120 (CONSP (temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
121 ? XINT (XCONS (temp)->cdr) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
122 : Qnil); })
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
123 #else
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
124 #define SYNTAX(c) \
13318
94a4b6e9d310 (SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH): Fix the non-GCC definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13143
diff changeset
125 (syntax_temp = SYNTAX_ENTRY ((c)), \
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
126 (CONSP (syntax_temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
127 ? (enum syntaxcode) (XINT (XCONS (syntax_temp)->car) & 0xff) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
128 : Swhitespace))
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
129
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
130 #define SYNTAX_WITH_FLAGS(c) \
13318
94a4b6e9d310 (SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH): Fix the non-GCC definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13143
diff changeset
131 (syntax_temp = SYNTAX_ENTRY ((c)), \
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
132 (CONSP (syntax_temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
133 ? XINT (XCONS (syntax_temp)->car) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
134 : (int) Swhitespace))
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
135
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
136 #define SYNTAX_MATCH(c) \
13318
94a4b6e9d310 (SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH): Fix the non-GCC definitions.
Richard M. Stallman <rms@gnu.org>
parents: 13143
diff changeset
137 (syntax_temp = SYNTAX_ENTRY ((c)), \
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
138 (CONSP (syntax_temp) \
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
139 ? XINT (XCONS (syntax_temp)->cdr) \
17045
1dfa84b25d3b (SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
140 : Qnil))
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
141 #endif
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
143 /* Then there are six single-bit flags that have the following meanings:
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 1. This character is the first of a two-character comment-start sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 2. This character is the second of a two-character comment-start sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 3. This character is the first of a two-character comment-end sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 4. This character is the second of a two-character comment-end sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 5. This character is a prefix, for backward-prefix-chars.
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
149 Note that any two-character sequence whose first character has flag 1
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
150 and whose second character has flag 2 will be interpreted as a comment start.
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
151
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
152 bit 6 is used to discriminate between two different comment styles.
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
153 Languages such as C++ allow two orthogonal syntax start/end pairs
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
154 and bit 6 is used to determine whether a comment-end or Scommentend
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
155 ends style a or b. Comment start sequences can start style a or b.
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
156 Style a is always the default.
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
157 */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
159 #define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1)
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
160
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
161 #define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1)
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
163 #define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1)
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
165 #define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1)
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
167 #define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
169 /* extract the comment style bit from the syntax table entry */
13143
ba670977cceb Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
170 #define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
171
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 /* This array, indexed by a character, contains the syntax code which that
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 character signifies (as a char). For example,
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (enum syntaxcode) syntax_spec_code['w'] is Sword. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 extern unsigned char syntax_spec_code[0400];
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 /* Indexed by syntax code, give the letter that describes it. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
180 extern char syntax_code_spec[14];