Mercurial > emacs
annotate src/syntax.h @ 20845:2fd9f2883ad4
Customized.
author | Stephen Eglen <stephen@gnu.org> |
---|---|
date | Wed, 04 Feb 1998 19:24:34 +0000 |
parents | ed9ed828415e |
children | 25bb3da85d05 |
rev | line source |
---|---|
486 | 1 /* Declarations having to do with GNU Emacs syntax tables. |
20708 | 2 Copyright (C) 1985, 93, 94, 97, 1998 Free Software Foundation, Inc. |
486 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
12244 | 8 the Free Software Foundation; either version 2, or (at your option) |
486 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
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 | 20 |
21 | |
22 extern Lisp_Object Qsyntax_table_p; | |
20349 | 23 extern void update_syntax_table P_ ((int, int, int, Lisp_Object)); |
486 | 24 |
25 /* The standard syntax table is stored where it will automatically | |
26 be used in all new buffers. */ | |
27 #define Vstandard_syntax_table buffer_defaults.syntax_table | |
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 | 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 | 34 |
35 enum syntaxcode | |
36 { | |
37 Swhitespace, /* for a whitespace character */ | |
38 Spunct, /* for random punctuation characters */ | |
39 Sword, /* for a word constituent */ | |
40 Ssymbol, /* symbol constituent but not word constituent */ | |
41 Sopen, /* for a beginning delimiter */ | |
42 Sclose, /* for an ending delimiter */ | |
43 Squote, /* for a prefix character like Lisp ' */ | |
44 Sstring, /* for a string-grouping character like Lisp " */ | |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
45 Smath, /* for delimiters like $ in Tex. */ |
486 | 46 Sescape, /* for a character that begins a C-style escape */ |
47 Scharquote, /* for a character that quotes the following character */ | |
48 Scomment, /* for a comment-starting character */ | |
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 */ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
51 Scomment_fence, /* Starts/ends comment which is delimited on the |
20487 | 52 other side by any char with the same syntaxcode. */ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
53 Sstring_fence, /* Starts/ends string which is delimited on the |
20487 | 54 other side by any char with the same syntaxcode. */ |
486 | 55 Smax /* Upper bound on codes that are meaningful */ |
56 }; | |
57 | |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
58 /* 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
|
59 |
17127
ab43d13fdfd5
(SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents:
17045
diff
changeset
|
60 #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
|
61 ((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
|
62 ? (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
|
63 : Faset ((table), make_number (c), (val))) |
486 | 64 |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
65 /* 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
|
66 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
|
67 Do inheritance. */ |
5441
0af9674da850
(enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
68 |
0af9674da850
(enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
69 #ifdef __GNUC__ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
70 #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
|
71 ({ Lisp_Object tbl = table; \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
72 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
|
73 while (NILP (temp)) \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
74 { \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
75 tbl = XCHAR_TABLE (tbl)->parent; \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
76 if (NILP (tbl)) \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
77 break; \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
78 temp = XCHAR_TABLE (tbl)->contents[(c)]; \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
79 } \ |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
80 temp; }) |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
81 #else |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
82 extern Lisp_Object syntax_temp; |
20349 | 83 extern Lisp_Object syntax_parent_lookup P_ ((Lisp_Object, int)); |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
84 |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
85 #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
|
86 (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
|
87 (NILP (syntax_temp) \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
88 ? syntax_parent_lookup (table, (c)) \ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
89 : syntax_temp)) |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
90 #endif |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
91 |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
92 /* SYNTAX_ENTRY fetches the information from the entry for character C |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
93 in syntax table TABLE, or from globally kept data (gl_state). |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
94 Does inheritance. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
95 /* CURRENT_SYNTAX_TABLE gives the syntax table valid for current |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
96 position, it is either the buffer's syntax table, or syntax table |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
97 found in text properties. */ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
98 |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
99 #ifdef SYNTAX_ENTRY_VIA_PROPERTY |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
100 # define SYNTAX_ENTRY(c) \ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
101 (gl_state.use_global ? gl_state.global_code : SYNTAX_ENTRY_INT (c)) |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
102 # define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
103 #else |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
104 # define SYNTAX_ENTRY SYNTAX_ENTRY_INT |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
105 # define CURRENT_SYNTAX_TABLE current_buffer->syntax_table |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
106 #endif |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
107 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
108 #define SYNTAX_ENTRY_INT(c) \ |
17181
156896ccc86e
(SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
17127
diff
changeset
|
109 ((c) < CHAR_TABLE_SINGLE_BYTE_SLOTS \ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
110 ? SYNTAX_ENTRY_FOLLOW_PARENT (CURRENT_SYNTAX_TABLE, \ |
17127
ab43d13fdfd5
(SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY): Cast arg C to
Kenichi Handa <handa@m17n.org>
parents:
17045
diff
changeset
|
111 (unsigned char) (c)) \ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
112 : Faref (CURRENT_SYNTAX_TABLE, make_number ((c)))) |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
113 |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
114 /* 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
|
115 in the current syntax table. */ |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
116 |
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
117 #ifdef __GNUC__ |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
118 #define SYNTAX(c) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
119 ({ Lisp_Object temp; \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
120 temp = SYNTAX_ENTRY (c); \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
121 (CONSP (temp) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
122 ? (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
|
123 : Swhitespace); }) |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
124 |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
125 #define SYNTAX_WITH_FLAGS(c) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
126 ({ Lisp_Object temp; \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
127 temp = SYNTAX_ENTRY (c); \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
128 (CONSP (temp) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
129 ? XINT (XCONS (temp)->car) \ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
130 : (int) Swhitespace); }) |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
131 |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
132 #define SYNTAX_MATCH(c) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
133 ({ Lisp_Object temp; \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
134 temp = SYNTAX_ENTRY (c); \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
135 (CONSP (temp) \ |
18613
614b916ff5bf
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
17465
diff
changeset
|
136 ? XCONS (temp)->cdr \ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
137 : Qnil); }) |
5441
0af9674da850
(enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
138 #else |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
139 #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
|
140 (syntax_temp = SYNTAX_ENTRY ((c)), \ |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
141 (CONSP (syntax_temp) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
142 ? (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
|
143 : Swhitespace)) |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
144 |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
145 #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
|
146 (syntax_temp = SYNTAX_ENTRY ((c)), \ |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
147 (CONSP (syntax_temp) \ |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
148 ? XINT (XCONS (syntax_temp)->car) \ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
149 : (int) Swhitespace)) |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
150 |
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
151 #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
|
152 (syntax_temp = SYNTAX_ENTRY ((c)), \ |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
153 (CONSP (syntax_temp) \ |
18613
614b916ff5bf
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
17465
diff
changeset
|
154 ? XCONS (syntax_temp)->cdr \ |
17045
1dfa84b25d3b
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
155 : Qnil)) |
5441
0af9674da850
(enum syntaxcode): Add Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
156 #endif |
486 | 157 |
1073 | 158 /* Then there are six single-bit flags that have the following meanings: |
486 | 159 1. This character is the first of a two-character comment-start sequence. |
160 2. This character is the second of a two-character comment-start sequence. | |
161 3. This character is the first of a two-character comment-end sequence. | |
162 4. This character is the second of a two-character comment-end sequence. | |
163 5. This character is a prefix, for backward-prefix-chars. | |
1073 | 164 Note that any two-character sequence whose first character has flag 1 |
165 and whose second character has flag 2 will be interpreted as a comment start. | |
166 | |
167 bit 6 is used to discriminate between two different comment styles. | |
168 Languages such as C++ allow two orthogonal syntax start/end pairs | |
169 and bit 6 is used to determine whether a comment-end or Scommentend | |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
170 ends style a or b. Comment start sequences can start style a or b. |
1073 | 171 Style a is always the default. |
172 */ | |
486 | 173 |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
174 #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
|
175 |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
176 #define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1) |
486 | 177 |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
178 #define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1) |
486 | 179 |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
180 #define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1) |
486 | 181 |
13143
ba670977cceb
Use char tables as syntax tables.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
182 #define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1) |
486 | 183 |
1073 | 184 /* 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
|
185 #define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1) |
1073 | 186 |
486 | 187 /* This array, indexed by a character, contains the syntax code which that |
188 character signifies (as a char). For example, | |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
189 (enum syntaxcode) syntax_spec_code['w'] is Sword. */ |
486 | 190 |
191 extern unsigned char syntax_spec_code[0400]; | |
192 | |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
193 /* Indexed by syntax code, give the letter that describes it. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
194 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
195 extern char syntax_code_spec[16]; |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
196 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
197 /* Convert the byte offset BYTEPOS into a character position, |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
198 for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. */ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
199 |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
200 #define SYNTAX_TABLE_BYTE_TO_CHAR(bytepos) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
201 (STRINGP (gl_state.object) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
202 ? string_byte_to_char (gl_state.object, (bytepos)) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
203 : BUFFERP (gl_state.object) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
204 ? buf_bytepos_to_charpos (XBUFFER (gl_state.object), (bytepos)) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
205 : NILP (gl_state.object) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
206 ? BYTE_TO_CHAR ((bytepos)) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
207 : (bytepos)) |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
208 |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
209 /* Make syntax table state (gl_state) good for POS, assuming it is |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
210 currently good for a position before POS. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
211 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
212 #define UPDATE_SYNTAX_TABLE_FORWARD(pos) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
213 ((pos) >= gl_state.e_property - gl_state.offset \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
214 ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
215 gl_state.object), \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
216 1) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
217 : 0) |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
218 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
219 /* Make syntax table state (gl_state) good for POS, assuming it is |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
220 currently good for a position after POS. */ |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
221 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
222 #define UPDATE_SYNTAX_TABLE_BACKWARD(pos) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
223 ((pos) <= gl_state.b_property - gl_state.offset \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
224 ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
225 gl_state.object), \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
226 1) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
227 : 0) |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
228 |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
229 /* Make syntax table good for POS. */ |
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
230 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
231 #define UPDATE_SYNTAX_TABLE(pos) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
232 ((pos) <= gl_state.b_property - gl_state.offset \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
233 ? (update_syntax_table ((pos) + gl_state.offset, -1, 0, \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
234 gl_state.object), \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
235 1) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
236 : ((pos) >= gl_state.e_property - gl_state.offset \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
237 ? (update_syntax_table ((pos) + gl_state.offset, 1, 0, \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
238 gl_state.object), \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
239 1) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
240 : 0)) |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
241 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
242 /* This macro should be called with FROM at the start of forward |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
243 search, or after the last position of the backward search. It |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
244 makes sure that the first char is picked up with correct table, so |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
245 one does not need to call UPDATE_SYNTAX_TABLE immediately after the |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
246 call. |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
247 Sign of COUNT gives the direction of the search. |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
248 */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
249 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
250 #define SETUP_SYNTAX_TABLE(FROM, COUNT) \ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
251 gl_state.b_property = BEGV - 1; \ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
252 gl_state.e_property = ZV + 1; \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
253 gl_state.object = Qnil; \ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
254 gl_state.use_global = 0; \ |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
255 gl_state.offset = 0; \ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
256 gl_state.current_syntax_table = current_buffer->syntax_table; \ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
257 if (parse_sexp_lookup_properties) \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
258 update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT), \ |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
259 1, Qnil); |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
260 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
261 /* Same as above, but in OBJECT. If OBJECT is nil, use current buffer. |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
262 If it is t, ignore properties altogether. |
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
263 |
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
264 This is meant for regex.c to use. For buffers, regex.c passes arguments |
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
265 to the UPDATE_SYNTAX_TABLE macros which are relative to BEGV. |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
266 So if it is a buffer, we set the offset field to BEGV. */ |
486 | 267 |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
268 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \ |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
269 if (1) \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
270 { \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
271 gl_state.object = (OBJECT); \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
272 if (BUFFERP (gl_state.object)) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
273 { \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
274 struct buffer *buf = XBUFFER (gl_state.object); \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
275 gl_state.b_property = BUF_BEGV (buf) - 1; \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
276 gl_state.e_property = BUF_ZV (buf); \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
277 gl_state.offset = BUF_BEGV (buf) - 1; \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
278 } \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
279 else if (NILP (gl_state.object)) \ |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
280 { \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
281 gl_state.b_property = BEGV - 1; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
282 gl_state.e_property = ZV; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
283 gl_state.offset = BEGV - 1; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
284 } \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
285 else if (EQ (gl_state.object, Qt)) \ |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
286 { \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
287 gl_state.b_property = - 1; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
288 gl_state.e_property = 1500000000; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
289 gl_state.offset = 0; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
290 } \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
291 else \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
292 { \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
293 gl_state.b_property = -1; \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
294 gl_state.e_property = 1 + XSTRING (gl_state.object)->size; \ |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
295 gl_state.offset = 0; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
296 } \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
297 gl_state.use_global = 0; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
298 gl_state.current_syntax_table = current_buffer->syntax_table; \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
299 if (parse_sexp_lookup_properties) \ |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
300 update_syntax_table ((BYTE_TO_CHAR ((FROM) + gl_state.offset) \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
301 + (COUNT > 0 ? 0 : -1)), \ |
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
302 COUNT, 1, gl_state.object); \ |
20544
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
303 } \ |
a884f0426ab9
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Call bytepos_to_charpos.
Richard M. Stallman <rms@gnu.org>
parents:
20487
diff
changeset
|
304 else |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
305 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
306 struct gl_state_s |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
307 { |
20649
388cedeebb88
(SYNTAX_TABLE_BYTE_TO_CHAR): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
20544
diff
changeset
|
308 Lisp_Object object; /* The object we are scanning. */ |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
309 int start; /* Where to stop. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
310 int stop; /* Where to stop. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
311 int use_global; /* Whether to use global_code |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
312 or c_s_t. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
313 Lisp_Object global_code; /* Syntax code of current char. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
314 Lisp_Object current_syntax_table; /* Syntax table for current pos. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
315 Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
316 int b_property; /* Last index where c_s_t is |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
317 not valid. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
318 int e_property; /* First index where c_s_t is |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
319 not valid. */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
320 INTERVAL forward_i; /* Where to start lookup on forward */ |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
321 INTERVAL backward_i; /* or backward movement. The |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
322 data in c_s_t is valid |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
323 between these intervals, |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
324 and possibly at the |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
325 intervals too, depending |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
326 on: */ |
18678
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
327 /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ |
d26f9720e55f
(struct gl_state_s): New field `offset'.
Richard M. Stallman <rms@gnu.org>
parents:
18625
diff
changeset
|
328 int offset; |
17465
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
329 char left_ok; |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
330 char right_ok; |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
331 }; |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
332 |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
333 extern struct gl_state_s gl_state; |
8a008f65c8d4
(enum syntaxcode): New members Scomment_fence, Sstring_fence.
Richard M. Stallman <rms@gnu.org>
parents:
17181
diff
changeset
|
334 extern int parse_sexp_lookup_properties; |
20349 | 335 extern INTERVAL interval_of P_ ((int, Lisp_Object)); |
336 | |
337 extern int scan_words P_ ((int, int)); |