annotate src/syntax.h @ 8275:4fdf77f4e45c

type-break-mode: New variable and function. type-break-interval: Increase default to 1 hour. type-break-query-interval: Variable renamed from type-break-delay-interval. type-break-keystroke-interval: Variable deleted. type-break-keystroke-threshold: New variable. type-break-demo-life: Function renamed from type-break-life. type-break-demo-hanoi: Function renamed from type-break-hanoi. type-break-alarm-p: Variable renamed from type-break-p. type-break: Don't query. type-break-query: (New function) query here. type-break-check: Call type-break-query, not type-break. Do nothing if type-break-mode is nil. Increment type-break-keystroke-count with the length of this-command-keys, not just 1. Query for break when keystroke count exceeds cdr of keystroke threshold variable. Query for break after an alarm only if keystroke count exceeds car of keystroke threshold variable. type-break-select: Function deleted. type-break: Move that code here. type-break-cancel-schedule: Function renamed from cancel-type-break. Reset type-break-alarm-p. type-break-alarm: Function renamed from type-break-soon. (top level): Call type-break-mode; don't set up hook explicitly.
author Noah Friedman <friedman@splode.com>
date Mon, 18 Jul 1994 07:37:18 +0000
parents 82a5362b244f
children ac7375e60931
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
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
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
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 extern Lisp_Object Qsyntax_table_p;
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 extern Lisp_Object Fsyntax_table_p (), Fsyntax_table (), Fset_syntax_table ();
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 /* The standard syntax table is stored where it will automatically
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 be used in all new buffers. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 #define Vstandard_syntax_table buffer_defaults.syntax_table
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 /* A syntax table is a Lisp vector of length 0400, whose elements are integers.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 The low 8 bits of the integer is a code, as follows:
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 enum syntaxcode
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 {
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 Swhitespace, /* for a whitespace character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 Spunct, /* for random punctuation characters */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 Sword, /* for a word constituent */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 Ssymbol, /* symbol constituent but not word constituent */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 Sopen, /* for a beginning delimiter */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 Sclose, /* for an ending delimiter */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 Squote, /* for a prefix character like Lisp ' */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 Sstring, /* for a string-grouping character like Lisp " */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 Smath, /* for delimiters like $ in Tex. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 Sescape, /* for a character that begins a C-style escape */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 Scharquote, /* for a character that quotes the following character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 Scomment, /* for a comment-starting character */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 Sendcomment, /* for a comment-ending character */
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
48 Sinherit, /* use the standard syntax table for this character */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 Smax /* Upper bound on codes that are meaningful */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 };
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
52 #define RAW_SYNTAX(table, c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
53 ((enum syntaxcode) (XINT (XVECTOR (table)->contents[(unsigned char) (c)]) & 0377))
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
54
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
55 #ifdef __GNUC__
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
56 #define SYNTAX(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
57 ({ unsigned char character = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
58 enum syntaxcode syntax \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
59 = RAW_SYNTAX (current_buffer->syntax_table, character); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
60 if (syntax == Sinherit) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
61 syntax = RAW_SYNTAX (Vstandard_syntax_table, character); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
62 syntax; })
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
63 #else
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
64 #define SYNTAX(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
65 (RAW_SYNTAX (current_buffer->syntax_table, c) == Sinherit \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
66 ? RAW_SYNTAX (Vstandard_syntax_table, c) \
5725
45d91f2b3810 (SYNTAX_MATCH, SYNTAX): Fix non-GNUC definitions.
Richard M. Stallman <rms@gnu.org>
parents: 5441
diff changeset
67 : RAW_SYNTAX (current_buffer->syntax_table, c))
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
68 #endif
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 /* The next 8 bits of the number is a character,
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 the matching delimiter in the case of Sopen or Sclose. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
73 #define RAW_SYNTAX_MATCH(table, c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
74 ((XINT (XVECTOR (table)->contents[(unsigned char) (c)]) >> 8) & 0377)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
75
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
76 #ifdef __GNUC__
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
77 #define SYNTAX_MATCH(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
78 ({ unsigned char character = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
79 enum syntaxcode syntax \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
80 = RAW_SYNTAX (current_buffer->syntax_table, character); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
81 int matcher; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
82 if (syntax == Sinherit) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
83 matcher = RAW_SYNTAX_MATCH (Vstandard_syntax_table, character); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
84 else \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
85 matcher = RAW_SYNTAX_MATCH (current_buffer->syntax_table, character); \
7967
82a5362b244f (SYNTAX_MATCH): Fix typo (syntax -> matcher).
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
86 matcher; })
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
87 #else
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
88 #define SYNTAX_MATCH(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
89 (RAW_SYNTAX (current_buffer->syntax_table, c) == Sinherit \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
90 ? RAW_SYNTAX_MATCH (Vstandard_syntax_table, c) \
5725
45d91f2b3810 (SYNTAX_MATCH, SYNTAX): Fix non-GNUC definitions.
Richard M. Stallman <rms@gnu.org>
parents: 5441
diff changeset
91 : RAW_SYNTAX_MATCH (current_buffer->syntax_table, c))
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
92 #endif
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
94 /* Then there are six single-bit flags that have the following meanings:
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 1. This character is the first of a two-character comment-start sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 2. This character is the second of a two-character comment-start sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 3. This character is the first of a two-character comment-end sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 4. This character is the second of a two-character comment-end sequence.
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 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
100 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
101 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
102
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
103 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
104 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
105 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
106 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
107 Style a is always the default.
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
108 */
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
110 #define SYNTAX_CHOOSE_TABLE(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
111 (RAW_SYNTAX (current_buffer->syntax_table, c) == Sinherit \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
112 ? Vstandard_syntax_table : current_buffer->syntax_table)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
113
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
114 #ifdef __GNUC__
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
115
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
116 #define SYNTAX_COMSTART_FIRST(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
117 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
118 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
119 (XINT (XVECTOR (table)->contents[ch]) >> 16) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
120 })
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 #define SYNTAX_COMSTART_SECOND(c) \
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
123 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
124 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
125 (XINT (XVECTOR (table)->contents[ch]) >> 17) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
126 })
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 #define SYNTAX_COMEND_FIRST(c) \
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
129 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
130 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
131 (XINT (XVECTOR (table)->contents[ch]) >> 18) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
132 })
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 #define SYNTAX_COMEND_SECOND(c) \
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
135 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
136 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
137 (XINT (XVECTOR (table)->contents[ch]) >> 19) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
138 })
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 #define SYNTAX_PREFIX(c) \
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
141 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
142 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
143 (XINT (XVECTOR (table)->contents[ch]) >> 20) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
144 })
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
146 /* extract the comment style bit from the syntax table entry */
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
147 #define SYNTAX_COMMENT_STYLE(c) \
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
148 ({ unsigned char ch = c; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
149 Lisp_Object table = SYNTAX_CHOOSE_TABLE (ch); \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
150 (XINT (XVECTOR (table)->contents[ch]) >> 21) & 1; \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
151 })
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
152
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
153 #else
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
154
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
155 #define SYNTAX_COMSTART_FIRST(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
156 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 16) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
157
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
158 #define SYNTAX_COMSTART_SECOND(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
159 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 17) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
160
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
161 #define SYNTAX_COMEND_FIRST(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
162 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 18) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
163
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
164 #define SYNTAX_COMEND_SECOND(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
165 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 19) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
166
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
167 #define SYNTAX_PREFIX(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
168 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 20) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
169
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
170 /* extract the comment style bit from the syntax table entry */
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
171 #define SYNTAX_COMMENT_STYLE(c) \
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
172 ((XINT (XVECTOR (SYNTAX_CHOOSE_TABLE (c))->contents[(unsigned char) (c)]) >> 21) & 1)
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
173
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
174 #endif
1073
721e4f57c8b0 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 720
diff changeset
175
486
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 /* This array, indexed by a character, contains the syntax code which that
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 character signifies (as a char). For example,
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (enum syntaxcode) syntax_spec_code['w'] is Sword. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 extern unsigned char syntax_spec_code[0400];
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 /* Indexed by syntax code, give the letter that describes it. */
80cdb2387043 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183
5441
0af9674da850 (enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
184 extern char syntax_code_spec[14];