Mercurial > emacs
annotate src/syntax.c @ 96675:d45acf0c8d23
merging Emacs.app (NeXTstep port)
| author | Adrian Robert <Adrian.B.Robert@gmail.com> |
|---|---|
| date | Tue, 15 Jul 2008 18:15:18 +0000 |
| parents | f13a77e0e34f |
| children | 9697a5f0281d |
| rev | line source |
|---|---|
|
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
1 #include <stdio.h> |
| 163 | 2 /* GNU Emacs routines to deal with syntax tables; also word and list parsing. |
|
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
74563
diff
changeset
|
3 Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001, |
| 79759 | 4 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
|
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
74563
diff
changeset
|
5 Free Software Foundation, Inc. |
| 163 | 6 |
| 7 This file is part of GNU Emacs. | |
| 8 | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93546
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
| 163 | 10 it under the terms of the GNU General Public License as published by |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93546
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
|
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93546
diff
changeset
|
12 (at your option) any later version. |
| 163 | 13 |
| 14 GNU Emacs is distributed in the hope that it will be useful, | |
| 15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 GNU General Public License for more details. | |
| 18 | |
| 19 You should have received a copy of the GNU General Public License | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93546
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 163 | 21 |
| 22 | |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4458
diff
changeset
|
23 #include <config.h> |
| 163 | 24 #include <ctype.h> |
| 25 #include "lisp.h" | |
| 26 #include "commands.h" | |
| 27 #include "buffer.h" | |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
28 #include "character.h" |
|
39748
42b7a798ff79
Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39195
diff
changeset
|
29 #include "keymap.h" |
| 56088 | 30 #include "regex.h" |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
31 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
32 /* Make syntax table lookup grant data in gl_state. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
33 #define SYNTAX_ENTRY_VIA_PROPERTY |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
34 |
| 163 | 35 #include "syntax.h" |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
36 #include "intervals.h" |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
37 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
38 /* We use these constants in place for comment-style and |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
39 string-ender-char to distinguish comments/strings started by |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
40 comment_fence and string_fence codes. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
41 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
42 #define ST_COMMENT_STYLE (256 + 1) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
43 #define ST_STRING_STYLE (256 + 2) |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
44 #include "category.h" |
| 163 | 45 |
|
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
46 Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error; |
| 163 | 47 |
| 48 int words_include_escapes; | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
49 int parse_sexp_lookup_properties; |
| 163 | 50 |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
51 /* Nonzero means `scan-sexps' treat all multibyte characters as symbol. */ |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
52 int multibyte_syntax_as_symbol; |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
53 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
54 /* Used as a temporary in SYNTAX_ENTRY and other macros in syntax.h, |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
55 if not compiled with GCC. No need to mark it, since it is used |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
56 only very temporarily. */ |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
57 Lisp_Object syntax_temp; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
58 |
|
28302
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
59 /* Non-zero means an open parenthesis in column 0 is always considered |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
60 to be the start of a defun. Zero means an open parenthesis in |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
61 column 0 has no special meaning. */ |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
62 |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
63 int open_paren_in_column_0_is_defun_start; |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
64 |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
65 /* This is the internal form of the parse state used in parse-partial-sexp. */ |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
66 |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
67 struct lisp_parse_state |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
68 { |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
69 int depth; /* Depth at end of parsing. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
70 int instring; /* -1 if not within string, else desired terminator. */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
71 int incomment; /* -1 if in unnestable comment else comment nesting */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
72 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
73 int quoted; /* Nonzero if just after an escape char at end of parsing */ |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
74 int thislevelstart; /* Char number of most recent start-of-expression at current level */ |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
75 int prevlevelstart; /* Char number of start of containing expression */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
76 int location; /* Char number at which parsing stopped. */ |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
77 int mindepth; /* Minimum depth seen while scanning. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
78 int comstr_start; /* Position just after last comment/string starter. */ |
|
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
79 Lisp_Object levelstarts; /* Char numbers of starts-of-expression |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
80 of levels (starting from outermost). */ |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
81 }; |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
82 |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
83 /* These variables are a cache for finding the start of a defun. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
84 find_start_pos is the place for which the defun start was found. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
85 find_start_value is the defun start position found for it. |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
86 find_start_value_byte is the corresponding byte position. |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
87 find_start_buffer is the buffer it was found in. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
88 find_start_begv is the BEGV value when it was found. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
89 find_start_modiff is the value of MODIFF when it was found. */ |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
90 |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
91 static int find_start_pos; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
92 static int find_start_value; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
93 static int find_start_value_byte; |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
94 static struct buffer *find_start_buffer; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
95 static int find_start_begv; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
96 static int find_start_modiff; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
97 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
98 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
99 static int find_defun_start P_ ((int, int)); |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
100 static int back_comment P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int, int, |
|
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
101 EMACS_INT *, EMACS_INT *)); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
102 static int char_quoted P_ ((int, int)); |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
103 static Lisp_Object skip_chars P_ ((int, Lisp_Object, Lisp_Object, int)); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
104 static Lisp_Object skip_syntaxes P_ ((int, Lisp_Object, Lisp_Object)); |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
105 static Lisp_Object scan_lists P_ ((EMACS_INT, EMACS_INT, EMACS_INT, int)); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
106 static void scan_sexps_forward P_ ((struct lisp_parse_state *, |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
107 int, int, int, int, |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
108 int, Lisp_Object, int)); |
| 56088 | 109 static int in_classes P_ ((int, Lisp_Object)); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
110 |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
111 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
112 struct gl_state_s gl_state; /* Global state of syntax parser. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
113 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
114 INTERVAL interval_of (); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
115 #define INTERVALS_AT_ONCE 10 /* 1 + max-number of intervals |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
116 to scan to property-change. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
117 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
118 /* Update gl_state to an appropriate interval which contains CHARPOS. The |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
119 sign of COUNT give the relative position of CHARPOS wrt the previously |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
120 valid interval. If INIT, only [be]_property fields of gl_state are |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
121 valid at start, the rest is filled basing on OBJECT. |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
122 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
123 `gl_state.*_i' are the intervals, and CHARPOS is further in the search |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
124 direction than the intervals - or in an interval. We update the |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
125 current syntax-table basing on the property of this interval, and |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
126 update the interval to start further than CHARPOS - or be |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
127 NULL_INTERVAL. We also update lim_property to be the next value of |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
128 charpos to call this subroutine again - or be before/after the |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
129 start/end of OBJECT. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
130 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
131 void |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
132 update_syntax_table (charpos, count, init, object) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
133 int charpos, count, init; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
134 Lisp_Object object; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
135 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
136 Lisp_Object tmp_table; |
|
25771
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
137 int cnt = 0, invalidate = 1; |
|
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
138 INTERVAL i; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
139 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
140 if (init) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
141 { |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
142 gl_state.old_prop = Qnil; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
143 gl_state.start = gl_state.b_property; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
144 gl_state.stop = gl_state.e_property; |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
145 i = interval_of (charpos, object); |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
146 gl_state.backward_i = gl_state.forward_i = i; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
147 invalidate = 0; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
148 if (NULL_INTERVAL_P (i)) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
149 return; |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
150 /* interval_of updates only ->position of the return value, so |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
151 update the parents manually to speed up update_interval. */ |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
152 while (!NULL_PARENT (i)) |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
153 { |
|
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
154 if (AM_RIGHT_CHILD (i)) |
|
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
155 INTERVAL_PARENT (i)->position = i->position |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
156 - LEFT_TOTAL_LENGTH (i) + TOTAL_LENGTH (i) /* right end */ |
|
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
157 - TOTAL_LENGTH (INTERVAL_PARENT (i)) |
|
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
158 + LEFT_TOTAL_LENGTH (INTERVAL_PARENT (i)); |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
159 else |
|
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
160 INTERVAL_PARENT (i)->position = i->position - LEFT_TOTAL_LENGTH (i) |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
161 + TOTAL_LENGTH (i); |
|
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
162 i = INTERVAL_PARENT (i); |
|
21011
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
163 } |
|
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
164 i = gl_state.forward_i; |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
165 gl_state.b_property = i->position - gl_state.offset; |
|
20956
15d1b7bf1cd7
(update_syntax_table): Fix calculations using offset.
Karl Heuer <kwzh@gnu.org>
parents:
20905
diff
changeset
|
166 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
167 goto update; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
168 } |
|
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
169 i = count > 0 ? gl_state.forward_i : gl_state.backward_i; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
170 |
|
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
171 /* We are guaranteed to be called with CHARPOS either in i, |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
172 or further off. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
173 if (NULL_INTERVAL_P (i)) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
174 error ("Error in syntax_table logic for to-the-end intervals"); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
175 else if (charpos < i->position) /* Move left. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
176 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
177 if (count > 0) |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
178 error ("Error in syntax_table logic for intervals <-"); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
179 /* Update the interval. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
180 i = update_interval (i, charpos); |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
181 if (INTERVAL_LAST_POS (i) != gl_state.b_property) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
182 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
183 invalidate = 0; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
184 gl_state.forward_i = i; |
|
20956
15d1b7bf1cd7
(update_syntax_table): Fix calculations using offset.
Karl Heuer <kwzh@gnu.org>
parents:
20905
diff
changeset
|
185 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
186 } |
|
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
187 } |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
188 else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
189 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
190 if (count < 0) |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
191 error ("Error in syntax_table logic for intervals ->"); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
192 /* Update the interval. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
193 i = update_interval (i, charpos); |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
194 if (i->position != gl_state.e_property) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
195 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
196 invalidate = 0; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
197 gl_state.backward_i = i; |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
198 gl_state.b_property = i->position - gl_state.offset; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
199 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
200 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
201 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
202 update: |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
203 tmp_table = textget (i->plist, Qsyntax_table); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
204 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
205 if (invalidate) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
206 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */ |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
207 |
|
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
208 if (invalidate) /* Did not get to adjacent interval. */ |
|
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
209 { /* with the same table => */ |
|
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
210 /* invalidate the old range. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
211 if (count > 0) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
212 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
213 gl_state.backward_i = i; |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
214 gl_state.b_property = i->position - gl_state.offset; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
215 } |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
216 else |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
217 { |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
218 gl_state.forward_i = i; |
|
20956
15d1b7bf1cd7
(update_syntax_table): Fix calculations using offset.
Karl Heuer <kwzh@gnu.org>
parents:
20905
diff
changeset
|
219 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
220 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
221 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
222 |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
223 if (!EQ (tmp_table, gl_state.old_prop)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
224 { |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
225 gl_state.current_syntax_table = tmp_table; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
226 gl_state.old_prop = tmp_table; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
227 if (EQ (Fsyntax_table_p (tmp_table), Qt)) |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
228 { |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
229 gl_state.use_global = 0; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
230 } |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
231 else if (CONSP (tmp_table)) |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
232 { |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
233 gl_state.use_global = 1; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
234 gl_state.global_code = tmp_table; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
235 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
236 else |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
237 { |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
238 gl_state.use_global = 0; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
239 gl_state.current_syntax_table = current_buffer->syntax_table; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
240 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
241 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
242 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
243 while (!NULL_INTERVAL_P (i)) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
244 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
245 if (cnt && !EQ (tmp_table, textget (i->plist, Qsyntax_table))) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
246 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
247 if (count > 0) |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
248 { |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
249 gl_state.e_property = i->position - gl_state.offset; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
250 gl_state.forward_i = i; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
251 } |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
252 else |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
253 { |
|
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
254 gl_state.b_property |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
255 = i->position + LENGTH (i) - gl_state.offset; |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
256 gl_state.backward_i = i; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
257 } |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
258 return; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
259 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
260 else if (cnt == INTERVALS_AT_ONCE) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
261 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
262 if (count > 0) |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
263 { |
|
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
264 gl_state.e_property |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
265 = i->position + LENGTH (i) - gl_state.offset |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
266 /* e_property at EOB is not set to ZV but to ZV+1, so that |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
267 we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
268 having to check eob between the two. */ |
|
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
269 + (NULL_INTERVAL_P (next_interval (i)) ? 1 : 0); |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
270 gl_state.forward_i = i; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
271 } |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
272 else |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
273 { |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
274 gl_state.b_property = i->position - gl_state.offset; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
275 gl_state.backward_i = i; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
276 } |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
277 return; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
278 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
279 cnt++; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
280 i = count > 0 ? next_interval (i) : previous_interval (i); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
281 } |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
282 eassert (NULL_INTERVAL_P (i)); /* This property goes to the end. */ |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
283 if (count > 0) |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
284 gl_state.e_property = gl_state.stop; |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
285 else |
|
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
286 gl_state.b_property = gl_state.start; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
287 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
288 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
289 /* Returns TRUE if char at CHARPOS is quoted. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
290 Global syntax-table data should be set up already to be good at CHARPOS |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
291 or after. On return global syntax data is good for lookup at CHARPOS. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
292 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
293 static int |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
294 char_quoted (charpos, bytepos) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
295 register int charpos, bytepos; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
296 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
297 register enum syntaxcode code; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
298 register int beg = BEGV; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
299 register int quoted = 0; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
300 int orig = charpos; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
301 |
|
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
302 #ifdef HAVE_NS |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
303 /* For some reason keeps getting called w/both 1, then segfaulting |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
304 due to the definitions of DEC_BOTH and DEC_POS in character.h, |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
305 which lead to decrementing below initial address and then examining |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
306 character there. Need to investigate further.. */ |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
307 if (charpos < 2 || bytepos < 2) |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
308 { |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
309 //fprintf(stderr,"Returning because charpos = %d, bytepos = %d\n",charpos, bytepos); |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
310 return 0; |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
311 } |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
312 #endif |
|
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
95856
diff
changeset
|
313 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
314 DEC_BOTH (charpos, bytepos); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
315 |
|
56719
ba478e06c729
(char_quoted): Mixup byte/char pos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56295
diff
changeset
|
316 while (charpos >= beg) |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
317 { |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
318 int c; |
|
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
319 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
320 UPDATE_SYNTAX_TABLE_BACKWARD (charpos); |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
321 c = FETCH_CHAR_AS_MULTIBYTE (bytepos); |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
322 code = SYNTAX (c); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
323 if (! (code == Scharquote || code == Sescape)) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
324 break; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
325 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
326 DEC_BOTH (charpos, bytepos); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
327 quoted = !quoted; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
328 } |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
329 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
330 UPDATE_SYNTAX_TABLE (orig); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
331 return quoted; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
332 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
333 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
334 /* Return the bytepos one character after BYTEPOS. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
335 We assume that BYTEPOS is not at the end of the buffer. */ |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
336 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
337 INLINE int |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
338 inc_bytepos (bytepos) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
339 int bytepos; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
340 { |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
341 if (NILP (current_buffer->enable_multibyte_characters)) |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
342 return bytepos + 1; |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
343 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
344 INC_POS (bytepos); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
345 return bytepos; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
346 } |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
347 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
348 /* Return the bytepos one character before BYTEPOS. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
349 We assume that BYTEPOS is not at the start of the buffer. */ |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
350 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
351 INLINE int |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
352 dec_bytepos (bytepos) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
353 int bytepos; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
354 { |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
355 if (NILP (current_buffer->enable_multibyte_characters)) |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
356 return bytepos - 1; |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
357 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
358 DEC_POS (bytepos); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
359 return bytepos; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
360 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
361 |
| 39195 | 362 /* Return a defun-start position before before POS and not too far before. |
| 363 It should be the last one before POS, or nearly the last. | |
| 364 | |
| 365 When open_paren_in_column_0_is_defun_start is nonzero, | |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
366 only the beginning of the buffer is treated as a defun-start. |
| 39195 | 367 |
| 368 We record the information about where the scan started | |
| 369 and what its result was, so that another call in the same area | |
| 370 can return the same value very quickly. | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
371 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
372 There is no promise at which position the global syntax data is |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
373 valid on return from the subroutine, so the caller should explicitly |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
374 update the global data. */ |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
375 |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
376 static int |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
377 find_defun_start (pos, pos_byte) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
378 int pos, pos_byte; |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
379 { |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
380 int opoint = PT, opoint_byte = PT_BYTE; |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
381 |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
382 if (!open_paren_in_column_0_is_defun_start) |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
383 { |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
384 find_start_value_byte = BEGV_BYTE; |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
385 return BEGV; |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
386 } |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
387 |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
388 /* Use previous finding, if it's valid and applies to this inquiry. */ |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
389 if (current_buffer == find_start_buffer |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
390 /* Reuse the defun-start even if POS is a little farther on. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
391 POS might be in the next defun, but that's ok. |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
392 Our value may not be the best possible, but will still be usable. */ |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
393 && pos <= find_start_pos + 1000 |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
394 && pos >= find_start_value |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
395 && BEGV == find_start_begv |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
396 && MODIFF == find_start_modiff) |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
397 return find_start_value; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
398 |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
399 /* Back up to start of line. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
400 scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
401 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
402 /* We optimize syntax-table lookup for rare updates. Thus we accept |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
403 only those `^\s(' which are good in global _and_ text-property |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
404 syntax-tables. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
405 gl_state.current_syntax_table = current_buffer->syntax_table; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
406 gl_state.use_global = 0; |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
407 while (PT > BEGV) |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
408 { |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
409 int c; |
|
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
410 |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
411 /* Open-paren at start of line means we may have found our |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
412 defun-start. */ |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
413 c = FETCH_CHAR_AS_MULTIBYTE (PT_BYTE); |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
414 if (SYNTAX (c) == Sopen) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
415 { |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
416 SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
417 c = FETCH_CHAR_AS_MULTIBYTE (PT_BYTE); |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
418 if (SYNTAX (c) == Sopen) |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
419 break; |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
420 /* Now fallback to the default value. */ |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
421 gl_state.current_syntax_table = current_buffer->syntax_table; |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
422 gl_state.use_global = 0; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
423 } |
|
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
424 /* Move to beg of previous line. */ |
|
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
425 scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
426 } |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
427 |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
428 /* Record what we found, for the next try. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
429 find_start_value = PT; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
430 find_start_value_byte = PT_BYTE; |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
431 find_start_buffer = current_buffer; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
432 find_start_modiff = MODIFF; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
433 find_start_begv = BEGV; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
434 find_start_pos = pos; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
435 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
436 TEMP_SET_PT_BOTH (opoint, opoint_byte); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
437 |
|
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
438 return find_start_value; |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
439 } |
|
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
440 |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
441 /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
442 |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
443 static int |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
444 prev_char_comend_first (pos, pos_byte) |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
445 int pos, pos_byte; |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
446 { |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
447 int c, val; |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
448 |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
449 DEC_BOTH (pos, pos_byte); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
450 UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
451 c = FETCH_CHAR (pos_byte); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
452 val = SYNTAX_COMEND_FIRST (c); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
453 UPDATE_SYNTAX_TABLE_FORWARD (pos + 1); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
454 return val; |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
455 } |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
456 |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
457 /* Return the SYNTAX_COMSTART_FIRST of the character before POS, POS_BYTE. */ |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
458 |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
459 /* static int |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
460 * prev_char_comstart_first (pos, pos_byte) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
461 * int pos, pos_byte; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
462 * { |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
463 * int c, val; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
464 * |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
465 * DEC_BOTH (pos, pos_byte); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
466 * UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
467 * c = FETCH_CHAR (pos_byte); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
468 * val = SYNTAX_COMSTART_FIRST (c); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
469 * UPDATE_SYNTAX_TABLE_FORWARD (pos + 1); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
470 * return val; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
471 * } */ |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
472 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
473 /* Checks whether charpos FROM is at the end of a comment. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
474 FROM_BYTE is the bytepos corresponding to FROM. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
475 Do not move back before STOP. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
476 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
477 Return a positive value if we find a comment ending at FROM/FROM_BYTE; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
478 return -1 otherwise. |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
479 |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
480 If successful, store the charpos of the comment's beginning |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
481 into *CHARPOS_PTR, and the bytepos into *BYTEPOS_PTR. |
|
20330
f76b9c0ebc4b
(back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents:
20292
diff
changeset
|
482 |
|
f76b9c0ebc4b
(back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents:
20292
diff
changeset
|
483 Global syntax data remains valid for backward search starting at |
|
f76b9c0ebc4b
(back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents:
20292
diff
changeset
|
484 the returned value (or at FROM, if the search was not successful). */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
485 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
486 static int |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
487 back_comment (from, from_byte, stop, comnested, comstyle, charpos_ptr, bytepos_ptr) |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
488 EMACS_INT from, from_byte, stop; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
489 int comnested, comstyle; |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
490 EMACS_INT *charpos_ptr, *bytepos_ptr; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
491 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
492 /* Look back, counting the parity of string-quotes, |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
493 and recording the comment-starters seen. |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
494 When we reach a safe place, assume that's not in a string; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
495 then step the main scan to the earliest comment-starter seen |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
496 an even number of string quotes away from the safe place. |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
497 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
498 OFROM[I] is position of the earliest comment-starter seen |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
499 which is I+2X quotes from the comment-end. |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
500 PARITY is current parity of quotes from the comment end. */ |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
501 int string_style = -1; /* Presumed outside of any string. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
502 int string_lossage = 0; |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
503 /* Not a real lossage: indicates that we have passed a matching comment |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
504 starter plus a non-matching comment-ender, meaning that any matching |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
505 comment-starter we might see later could be a false positive (hidden |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
506 inside another comment). |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
507 Test case: { a (* b } c (* d *) */ |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
508 int comment_lossage = 0; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
509 int comment_end = from; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
510 int comment_end_byte = from_byte; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
511 int comstart_pos = 0; |
|
20766
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
512 int comstart_byte; |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
513 /* Place where the containing defun starts, |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
514 or 0 if we didn't come across it yet. */ |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
515 int defun_start = 0; |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
516 int defun_start_byte = 0; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
517 register enum syntaxcode code; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
518 int nesting = 1; /* current comment nesting */ |
|
18079
5fbb5aef5649
(back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents:
17786
diff
changeset
|
519 int c; |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
520 int syntax = 0; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
521 |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
522 /* FIXME: A }} comment-ender style leads to incorrect behavior |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
523 in the case of {{ c }}} because we ignore the last two chars which are |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
524 assumed to be comment-enders although they aren't. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
525 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
526 /* At beginning of range to scan, we're outside of strings; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
527 that determines quote parity to the comment-end. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
528 while (from != stop) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
529 { |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
530 int temp_byte, prev_syntax; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
531 int com2start, com2end; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
532 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
533 /* Move back and examine a character. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
534 DEC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
535 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
536 |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
537 prev_syntax = syntax; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
538 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
539 syntax = SYNTAX_WITH_FLAGS (c); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
540 code = SYNTAX (c); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
541 |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
542 /* Check for 2-char comment markers. */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
543 com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
544 && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
545 && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
546 && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
547 || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
548 com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
549 && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
550 |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
551 /* Nasty cases with overlapping 2-char comment markers: |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
552 - snmp-mode: -- c -- foo -- c -- |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
553 --- c -- |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
554 ------ c -- |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
555 - c-mode: *||* |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
556 |* *|* *| |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
557 |*| |* |*| |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
558 /// */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
559 |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
560 /* If a 2-char comment sequence partly overlaps with another, |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
561 we don't try to be clever. */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
562 if (from > stop && (com2end || com2start)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
563 { |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
564 int next = from, next_byte = from_byte, next_c, next_syntax; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
565 DEC_BOTH (next, next_byte); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
566 UPDATE_SYNTAX_TABLE_BACKWARD (next); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
567 next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
568 next_syntax = SYNTAX_WITH_FLAGS (next_c); |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
569 if (((com2start || comnested) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
570 && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
571 && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
572 || ((com2end || comnested) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
573 && SYNTAX_FLAGS_COMSTART_SECOND (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
574 && comstyle == SYNTAX_FLAGS_COMMENT_STYLE (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
575 && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax))) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
576 goto lossage; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
577 /* UPDATE_SYNTAX_TABLE_FORWARD (next + 1); */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
578 } |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
579 |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
580 if (com2start && comstart_pos == 0) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
581 /* We're looking at a comment starter. But it might be a comment |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
582 ender as well (see snmp-mode). The first time we see one, we |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
583 need to consider it as a comment starter, |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
584 and the subsequent times as a comment ender. */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
585 com2end = 0; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
586 |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
587 /* Turn a 2-char comment sequences into the appropriate syntax. */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
588 if (com2end) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
589 code = Sendcomment; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
590 else if (com2start) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
591 code = Scomment; |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
592 /* Ignore comment starters of a different style. */ |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
593 else if (code == Scomment |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
594 && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax) |
|
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
595 || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested)) |
|
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
596 continue; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
597 |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
598 /* Ignore escaped characters, except comment-enders. */ |
|
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
599 if (code != Sendcomment && char_quoted (from, from_byte)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
600 continue; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
601 |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
602 switch (code) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
603 { |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
604 case Sstring_fence: |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
605 case Scomment_fence: |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
606 c = (code == Sstring_fence ? ST_STRING_STYLE : ST_COMMENT_STYLE); |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
607 case Sstring: |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
608 /* Track parity of quotes. */ |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
609 if (string_style == -1) |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
610 /* Entering a string. */ |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
611 string_style = c; |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
612 else if (string_style == c) |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
613 /* Leaving the string. */ |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
614 string_style = -1; |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
615 else |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
616 /* If we have two kinds of string delimiters. |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
617 There's no way to grok this scanning backwards. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
618 string_lossage = 1; |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
619 break; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
620 |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
621 case Scomment: |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
622 /* We've already checked that it is the relevant comstyle. */ |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
623 if (string_style != -1 || comment_lossage || string_lossage) |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
624 /* There are odd string quotes involved, so let's be careful. |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
625 Test case in Pascal: " { " a { " } */ |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
626 goto lossage; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
627 |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
628 if (!comnested) |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
629 { |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
630 /* Record best comment-starter so far. */ |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
631 comstart_pos = from; |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
632 comstart_byte = from_byte; |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
633 } |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
634 else if (--nesting <= 0) |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
635 /* nested comments have to be balanced, so we don't need to |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
636 keep looking for earlier ones. We use here the same (slightly |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
637 incorrect) reasoning as below: since it is followed by uniform |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
638 paired string quotes, this comment-start has to be outside of |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
639 strings, else the comment-end itself would be inside a string. */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
640 goto done; |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
641 break; |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
642 |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
643 case Sendcomment: |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
644 if (SYNTAX_FLAGS_COMMENT_STYLE (syntax) == comstyle |
|
49971
afbb2d6d2f07
(back_comment): Only check nestedness of 2nd char if needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
645 && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)) |
|
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
646 || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested) |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
647 /* This is the same style of comment ender as ours. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
648 { |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
649 if (comnested) |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
650 nesting++; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
651 else |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
652 /* Anything before that can't count because it would match |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
653 this comment-ender rather than ours. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
654 from = stop; /* Break out of the loop. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
655 } |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
656 else if (comstart_pos != 0 || c != '\n') |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
657 /* We're mixing comment styles here, so we'd better be careful. |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
658 The (comstart_pos != 0 || c != '\n') check is not quite correct |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
659 (we should just always set comment_lossage), but removing it |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
660 would imply that any multiline comment in C would go through |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
661 lossage, which seems overkill. |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
662 The failure should only happen in the rare cases such as |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
663 { (* } *) */ |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
664 comment_lossage = 1; |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
665 break; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
666 |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
667 case Sopen: |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
668 /* Assume a defun-start point is outside of strings. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
669 if (open_paren_in_column_0_is_defun_start |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
670 && (from == stop |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
671 || (temp_byte = dec_bytepos (from_byte), |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
672 FETCH_CHAR (temp_byte) == '\n'))) |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
673 { |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
674 defun_start = from; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
675 defun_start_byte = from_byte; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
676 from = stop; /* Break out of the loop. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
677 } |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
678 break; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
679 |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
680 default: |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
681 break; |
|
20766
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
682 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
683 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
684 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
685 if (comstart_pos == 0) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
686 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
687 from = comment_end; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
688 from_byte = comment_end_byte; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
689 UPDATE_SYNTAX_TABLE_FORWARD (comment_end - 1); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
690 } |
|
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
691 /* If comstart_pos is set and we get here (ie. didn't jump to `lossage' |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
692 or `done'), then we've found the beginning of the non-nested comment. */ |
|
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
693 else if (1) /* !comnested */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
694 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
695 from = comstart_pos; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
696 from_byte = comstart_byte; |
|
56720
7c89be334c1b
(back_comment): Fixup globals in all cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56719
diff
changeset
|
697 UPDATE_SYNTAX_TABLE_FORWARD (from - 1); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
698 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
699 else |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
700 { |
|
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
701 struct lisp_parse_state state; |
|
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
702 lossage: |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
703 /* We had two kinds of string delimiters mixed up |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
704 together. Decode this going forwards. |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
705 Scan fwd from a known safe place (beginning-of-defun) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
706 to the one in question; this records where we |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
707 last passed a comment starter. */ |
|
20766
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
708 /* If we did not already find the defun start, find it now. */ |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
709 if (defun_start == 0) |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
710 { |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
711 defun_start = find_defun_start (comment_end, comment_end_byte); |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
712 defun_start_byte = find_start_value_byte; |
|
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
713 } |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
714 do |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
715 { |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
716 scan_sexps_forward (&state, |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
717 defun_start, defun_start_byte, |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
718 comment_end, -10000, 0, Qnil, 0); |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
719 defun_start = comment_end; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
720 if (state.incomment == (comnested ? 1 : -1) |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
721 && state.comstyle == comstyle) |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
722 from = state.comstr_start; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
723 else |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
724 { |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
725 from = comment_end; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
726 if (state.incomment) |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
727 /* If comment_end is inside some other comment, maybe ours |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
728 is nested, so we need to try again from within the |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
729 surrounding comment. Example: { a (* " *) */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
730 { |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
731 /* FIXME: We should advance by one or two chars. */ |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
732 defun_start = state.comstr_start + 2; |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
733 defun_start_byte = CHAR_TO_BYTE (defun_start); |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
734 } |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
735 } |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
736 } while (defun_start < comment_end); |
|
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
737 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
738 from_byte = CHAR_TO_BYTE (from); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
739 UPDATE_SYNTAX_TABLE_FORWARD (from - 1); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
740 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
741 |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
742 done: |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
743 *charpos_ptr = from; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
744 *bytepos_ptr = from_byte; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
745 |
|
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
746 return (from == comment_end) ? -1 : from; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
747 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
748 |
| 163 | 749 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
750 doc: /* Return t if OBJECT is a syntax table. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
751 Currently, any char-table counts as a syntax table. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
752 (object) |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
753 Lisp_Object object; |
| 163 | 754 { |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
755 if (CHAR_TABLE_P (object) |
|
18113
9f7fdb0f76f3
(Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents:
18080
diff
changeset
|
756 && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table)) |
| 163 | 757 return Qt; |
| 758 return Qnil; | |
| 759 } | |
| 760 | |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
761 static void |
| 163 | 762 check_syntax_table (obj) |
| 763 Lisp_Object obj; | |
| 764 { | |
|
71843
2d05f598fa85
(check_syntax_table): Use CHECK_TYPE.
Kim F. Storm <storm@cua.dk>
parents:
71787
diff
changeset
|
765 CHECK_TYPE (CHAR_TABLE_P (obj) && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table), |
|
2d05f598fa85
(check_syntax_table): Use CHECK_TYPE.
Kim F. Storm <storm@cua.dk>
parents:
71787
diff
changeset
|
766 Qsyntax_table_p, obj); |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
767 } |
| 163 | 768 |
| 769 DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
770 doc: /* Return the current syntax table. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
771 This is the one specified by the current buffer. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
772 () |
| 163 | 773 { |
| 774 return current_buffer->syntax_table; | |
| 775 } | |
| 776 | |
| 777 DEFUN ("standard-syntax-table", Fstandard_syntax_table, | |
| 778 Sstandard_syntax_table, 0, 0, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
779 doc: /* Return the standard syntax table. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
780 This is the one used for new buffers. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
781 () |
| 163 | 782 { |
| 783 return Vstandard_syntax_table; | |
| 784 } | |
| 785 | |
| 786 DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
787 doc: /* Construct a new syntax table and return it. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
788 It is a copy of the TABLE, which defaults to the standard syntax table. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
789 (table) |
| 163 | 790 Lisp_Object table; |
| 791 { | |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
792 Lisp_Object copy; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
793 |
| 485 | 794 if (!NILP (table)) |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
795 check_syntax_table (table); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
796 else |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
797 table = Vstandard_syntax_table; |
| 163 | 798 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
799 copy = Fcopy_sequence (table); |
|
14661
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
800 |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
801 /* Only the standard syntax table should have a default element. |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
802 Other syntax tables should inherit from parents instead. */ |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
803 XCHAR_TABLE (copy)->defalt = Qnil; |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
804 |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
805 /* Copied syntax tables should all have parents. |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
806 If we copied one with no parent, such as the standard syntax table, |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
807 use the standard syntax table as the copy's parent. */ |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
808 if (NILP (XCHAR_TABLE (copy)->parent)) |
|
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
809 Fset_char_table_parent (copy, Vstandard_syntax_table); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
810 return copy; |
| 163 | 811 } |
| 812 | |
| 813 DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
814 doc: /* Select a new syntax table for the current buffer. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
815 One argument, a syntax table. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
816 (table) |
| 163 | 817 Lisp_Object table; |
| 818 { | |
|
28313
cdb964ab44c3
(Fset_syntax_table): Use new macros for per-buffer
Gerd Moellmann <gerd@gnu.org>
parents:
28302
diff
changeset
|
819 int idx; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
820 check_syntax_table (table); |
| 163 | 821 current_buffer->syntax_table = table; |
| 822 /* Indicate that this buffer now has a specified syntax table. */ | |
| 28351 | 823 idx = PER_BUFFER_VAR_IDX (syntax_table); |
| 824 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); | |
| 163 | 825 return table; |
| 826 } | |
| 827 | |
| 828 /* Convert a letter which signifies a syntax code | |
| 829 into the code it signifies. | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
830 This is used by modify-syntax-entry, and other things. */ |
| 163 | 831 |
| 832 unsigned char syntax_spec_code[0400] = | |
| 833 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
| 834 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
| 835 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
| 836 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
837 (char) Swhitespace, (char) Scomment_fence, (char) Sstring, 0377, |
| 163 | 838 (char) Smath, 0377, 0377, (char) Squote, |
| 839 (char) Sopen, (char) Sclose, 0377, 0377, | |
| 840 0377, (char) Swhitespace, (char) Spunct, (char) Scharquote, | |
| 841 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
| 842 0377, 0377, 0377, 0377, | |
| 843 (char) Scomment, 0377, (char) Sendcomment, 0377, | |
|
5442
8cbae747a768
(describe_syntax): Handle Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
5339
diff
changeset
|
844 (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */ |
| 163 | 845 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
| 846 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | |
| 847 0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol, | |
| 848 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */ | |
| 849 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
| 850 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
851 0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377 |
| 163 | 852 }; |
| 853 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
854 /* Indexed by syntax code, give the letter that describes it. */ |
| 163 | 855 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
856 char syntax_code_spec[16] = |
| 163 | 857 { |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
858 ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@', |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
859 '!', '|' |
| 163 | 860 }; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
861 |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
862 /* Indexed by syntax code, give the object (cons of syntax code and |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
863 nil) to be stored in syntax table. Since these objects can be |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
864 shared among syntax tables, we generate them in advance. By |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
865 sharing objects, the function `describe-syntax' can give a more |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
866 compact listing. */ |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
867 static Lisp_Object Vsyntax_code_object; |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
868 |
| 163 | 869 |
| 870 DEFUN ("char-syntax", Fchar_syntax, Schar_syntax, 1, 1, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
871 doc: /* Return the syntax code of CHARACTER, described by a character. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
872 For example, if CHARACTER is a word constituent, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
873 the character `w' is returned. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
874 The characters that correspond to various syntax codes |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
875 are listed in the documentation of `modify-syntax-entry'. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
876 (character) |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
877 Lisp_Object character; |
| 163 | 878 { |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
879 int char_int; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
880 gl_state.current_syntax_table = current_buffer->syntax_table; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
881 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
882 gl_state.use_global = 0; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
883 CHECK_NUMBER (character); |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
884 char_int = XINT (character); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
885 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); |
|
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
886 } |
|
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
887 |
|
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
888 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
889 doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
890 (character) |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
891 Lisp_Object character; |
|
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
892 { |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
893 int char_int, code; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
894 gl_state.current_syntax_table = current_buffer->syntax_table; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
895 gl_state.use_global = 0; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
896 CHECK_NUMBER (character); |
|
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
897 char_int = XINT (character); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
898 code = SYNTAX (char_int); |
|
7975
49dc4ea976a0
(Fmatching_paren): Fix typo.
Richard M. Stallman <rms@gnu.org>
parents:
7968
diff
changeset
|
899 if (code == Sopen || code == Sclose) |
|
18613
614b916ff5bf
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18491
diff
changeset
|
900 return SYNTAX_MATCH (char_int); |
|
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
901 return Qnil; |
| 163 | 902 } |
| 903 | |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
904 DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
905 doc: /* Convert a syntax specification STRING into syntax cell form. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
906 STRING should be a string as it is allowed as argument of |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
907 `modify-syntax-entry'. Value is the equivalent cons cell |
|
74563
da4c1968d862
Fix spurious open-paren-in-column-0 in a comment.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
74542
diff
changeset
|
908 \(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table' |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
909 text property. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
910 (string) |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
911 Lisp_Object string; |
| 163 | 912 { |
|
46555
35e66a0949b8
(Fstring_to_syntax, skip_chars): Treat Lisp string
Ken Raeburn <raeburn@raeburn.org>
parents:
46370
diff
changeset
|
913 register const unsigned char *p; |
| 163 | 914 register enum syntaxcode code; |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
915 int val; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
916 Lisp_Object match; |
| 163 | 917 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
918 CHECK_STRING (string); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
919 |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
41598
diff
changeset
|
920 p = SDATA (string); |
| 163 | 921 code = (enum syntaxcode) syntax_spec_code[*p++]; |
| 922 if (((int) code & 0377) == 0377) | |
|
63703
bb4ab751a6a3
(Fstring_to_syntax): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents:
58897
diff
changeset
|
923 error ("Invalid syntax description letter: %c", p[-1]); |
| 163 | 924 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
925 if (code == Sinherit) |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
926 return Qnil; |
| 163 | 927 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
928 if (*p) |
|
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
929 { |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
930 int len; |
|
22547
1cf8123f4c67
(Fmodify_syntax_entry): Use macro STRING_BYTES to get
Kenichi Handa <handa@m17n.org>
parents:
22486
diff
changeset
|
931 int character = (STRING_CHAR_AND_LENGTH |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
41598
diff
changeset
|
932 (p, SBYTES (string) - 1, len)); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
933 XSETINT (match, character); |
|
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
934 if (XFASTINT (match) == ' ') |
|
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
935 match = Qnil; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
936 p += len; |
|
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
937 } |
|
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
938 else |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
939 match = Qnil; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
940 |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
941 val = (int) code; |
| 163 | 942 while (*p) |
| 943 switch (*p++) | |
| 944 { | |
| 945 case '1': | |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
946 val |= 1 << 16; |
| 163 | 947 break; |
| 948 | |
| 949 case '2': | |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
950 val |= 1 << 17; |
| 163 | 951 break; |
| 952 | |
| 953 case '3': | |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
954 val |= 1 << 18; |
| 163 | 955 break; |
| 956 | |
| 957 case '4': | |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
958 val |= 1 << 19; |
| 163 | 959 break; |
| 960 | |
| 961 case 'p': | |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
962 val |= 1 << 20; |
| 163 | 963 break; |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
964 |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
965 case 'b': |
|
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
966 val |= 1 << 21; |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
967 break; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
968 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
969 case 'n': |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
970 val |= 1 << 22; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
971 break; |
| 163 | 972 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
973 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
974 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match)) |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
975 return XVECTOR (Vsyntax_code_object)->contents[val]; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
976 else |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
977 /* Since we can't use a shared object, let's make a new one. */ |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
978 return Fcons (make_number (val), match); |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
979 } |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
980 |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
981 /* I really don't know why this is interactive |
|
40286
0e7059267f7e
Fix comment ending.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40205
diff
changeset
|
982 help-form should at least be made useful whilst reading the second arg. */ |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
983 DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
984 "cSet syntax for character: \nsSet syntax for %s to: ", |
|
40205
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
985 doc: /* Set syntax for character CHAR according to string NEWENTRY. |
|
55423
a9e10b866486
(Fmodify_syntax_entry): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54849
diff
changeset
|
986 The syntax is changed only for table SYNTAX-TABLE, which defaults to |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
987 the current buffer's syntax table. |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
988 CHAR may be a cons (MIN . MAX), in which case, syntaxes of all characters |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
989 in the range MIN and MAX are changed. |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
990 The first character of NEWENTRY should be one of the following: |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
991 Space or - whitespace syntax. w word constituent. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
992 _ symbol constituent. . punctuation. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
993 ( open-parenthesis. ) close-parenthesis. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
994 " string quote. \\ escape. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
995 $ paired delimiter. ' expression quote or prefix operator. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
996 < comment starter. > comment ender. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
997 / character-quote. @ inherit from `standard-syntax-table'. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
998 | generic string fence. ! generic comment fence. |
| 163 | 999 |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1000 Only single-character comment start and end sequences are represented thus. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1001 Two-character sequences are represented as described below. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1002 The second character of NEWENTRY is the matching parenthesis, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1003 used only if the first character is `(' or `)'. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1004 Any additional characters are flags. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1005 Defined flags are the characters 1, 2, 3, 4, b, p, and n. |
|
40205
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1006 1 means CHAR is the start of a two-char comment start sequence. |
|
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1007 2 means CHAR is the second character of such a sequence. |
|
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1008 3 means CHAR is the start of a two-char comment end sequence. |
|
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1009 4 means CHAR is the second character of such a sequence. |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1010 |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1011 There can be up to two orthogonal comment sequences. This is to support |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1012 language modes such as C++. By default, all comment sequences are of style |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1013 a, but you can set the comment sequence style to b (on the second character |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1014 of a comment-start, or the first character of a comment-end sequence) using |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1015 this flag: |
|
40205
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1016 b means CHAR is part of comment sequence b. |
|
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1017 n means CHAR is part of a nestable comment sequence. |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1018 |
|
40205
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1019 p means CHAR is a prefix character for `backward-prefix-chars'; |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1020 such characters are treated as whitespace when they occur |
|
40205
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1021 between expressions. |
|
d13b14b50715
(modify-syntax-entry): Fix argument names (use CHAR instead of C) and usage.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40103
diff
changeset
|
1022 usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1023 (c, newentry, syntax_table) |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1024 Lisp_Object c, newentry, syntax_table; |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1025 { |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1026 if (CONSP (c)) |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1027 { |
| 89483 | 1028 CHECK_CHARACTER_CAR (c); |
| 1029 CHECK_CHARACTER_CDR (c); | |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1030 } |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1031 else |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1032 CHECK_CHARACTER (c); |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1033 |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1034 if (NILP (syntax_table)) |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1035 syntax_table = current_buffer->syntax_table; |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1036 else |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1037 check_syntax_table (syntax_table); |
|
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1038 |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1039 newentry = Fstring_to_syntax (newentry); |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1040 if (CONSP (c)) |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1041 SET_RAW_SYNTAX_ENTRY_RANGE (syntax_table, c, newentry); |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1042 else |
|
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1043 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), newentry); |
|
72945
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1044 |
|
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1045 /* We clear the regexp cache, since character classes can now have |
|
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1046 different values from those in the compiled regexps.*/ |
|
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1047 clear_regexp_cache (); |
|
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1048 |
| 163 | 1049 return Qnil; |
| 1050 } | |
| 1051 | |
| 1052 /* Dump syntax table to buffer in human-readable format */ | |
| 1053 | |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1054 DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1055 Sinternal_describe_syntax_value, 1, 1, 0, |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1056 doc: /* Insert a description of the internal syntax description SYNTAX at point. */) |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1057 (syntax) |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1058 Lisp_Object syntax; |
| 163 | 1059 { |
| 1060 register enum syntaxcode code; | |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1061 char desc, start1, start2, end1, end2, prefix, comstyle, comnested; |
| 163 | 1062 char str[2]; |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1063 Lisp_Object first, match_lisp, value = syntax; |
| 163 | 1064 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1065 if (NILP (value)) |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1066 { |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1067 insert_string ("default"); |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1068 return syntax; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1069 } |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1070 |
|
17109
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1071 if (CHAR_TABLE_P (value)) |
|
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1072 { |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1073 insert_string ("deeper char-table ..."); |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1074 return syntax; |
|
17109
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1075 } |
|
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1076 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1077 if (!CONSP (value)) |
| 163 | 1078 { |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1079 insert_string ("invalid"); |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1080 return syntax; |
| 163 | 1081 } |
| 1082 | |
|
25663
a5eaace0fa01
Use XCAR and XCDR instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25659
diff
changeset
|
1083 first = XCAR (value); |
|
a5eaace0fa01
Use XCAR and XCDR instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25659
diff
changeset
|
1084 match_lisp = XCDR (value); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1085 |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1086 if (!INTEGERP (first) || !(NILP (match_lisp) || INTEGERP (match_lisp))) |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1087 { |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1088 insert_string ("invalid"); |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1089 return syntax; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1090 } |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1091 |
|
18113
9f7fdb0f76f3
(Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents:
18080
diff
changeset
|
1092 code = (enum syntaxcode) (XINT (first) & 0377); |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1093 start1 = (XINT (first) >> 16) & 1; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1094 start2 = (XINT (first) >> 17) & 1; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1095 end1 = (XINT (first) >> 18) & 1; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1096 end2 = (XINT (first) >> 19) & 1; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1097 prefix = (XINT (first) >> 20) & 1; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1098 comstyle = (XINT (first) >> 21) & 1; |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1099 comnested = (XINT (first) >> 22) & 1; |
| 163 | 1100 |
| 1101 if ((int) code < 0 || (int) code >= (int) Smax) | |
| 1102 { | |
| 1103 insert_string ("invalid"); | |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1104 return syntax; |
| 163 | 1105 } |
| 1106 desc = syntax_code_spec[(int) code]; | |
| 1107 | |
| 1108 str[0] = desc, str[1] = 0; | |
| 1109 insert (str, 1); | |
| 1110 | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1111 if (NILP (match_lisp)) |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1112 insert (" ", 1); |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1113 else |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1114 insert_char (XINT (match_lisp)); |
| 163 | 1115 |
| 1116 if (start1) | |
| 1117 insert ("1", 1); | |
| 1118 if (start2) | |
| 1119 insert ("2", 1); | |
| 1120 | |
| 1121 if (end1) | |
| 1122 insert ("3", 1); | |
| 1123 if (end2) | |
| 1124 insert ("4", 1); | |
| 1125 | |
| 1126 if (prefix) | |
| 1127 insert ("p", 1); | |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1128 if (comstyle) |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1129 insert ("b", 1); |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1130 if (comnested) |
|
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1131 insert ("n", 1); |
| 163 | 1132 |
| 1133 insert_string ("\twhich means: "); | |
| 1134 | |
|
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
9863
diff
changeset
|
1135 switch (SWITCH_ENUM_CAST (code)) |
| 163 | 1136 { |
| 1137 case Swhitespace: | |
| 1138 insert_string ("whitespace"); break; | |
| 1139 case Spunct: | |
| 1140 insert_string ("punctuation"); break; | |
| 1141 case Sword: | |
| 1142 insert_string ("word"); break; | |
| 1143 case Ssymbol: | |
| 1144 insert_string ("symbol"); break; | |
| 1145 case Sopen: | |
| 1146 insert_string ("open"); break; | |
| 1147 case Sclose: | |
| 1148 insert_string ("close"); break; | |
| 1149 case Squote: | |
|
32508
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1150 insert_string ("prefix"); break; |
| 163 | 1151 case Sstring: |
| 1152 insert_string ("string"); break; | |
| 1153 case Smath: | |
| 1154 insert_string ("math"); break; | |
| 1155 case Sescape: | |
| 1156 insert_string ("escape"); break; | |
| 1157 case Scharquote: | |
| 1158 insert_string ("charquote"); break; | |
| 1159 case Scomment: | |
| 1160 insert_string ("comment"); break; | |
| 1161 case Sendcomment: | |
| 1162 insert_string ("endcomment"); break; | |
|
32508
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1163 case Sinherit: |
|
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1164 insert_string ("inherit"); break; |
|
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1165 case Scomment_fence: |
|
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1166 insert_string ("comment fence"); break; |
|
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1167 case Sstring_fence: |
|
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1168 insert_string ("string fence"); break; |
| 163 | 1169 default: |
| 1170 insert_string ("invalid"); | |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1171 return syntax; |
| 163 | 1172 } |
| 1173 | |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1174 if (!NILP (match_lisp)) |
| 163 | 1175 { |
| 1176 insert_string (", matches "); | |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1177 insert_char (XINT (match_lisp)); |
| 163 | 1178 } |
| 1179 | |
| 1180 if (start1) | |
| 1181 insert_string (",\n\t is the first character of a comment-start sequence"); | |
| 1182 if (start2) | |
| 1183 insert_string (",\n\t is the second character of a comment-start sequence"); | |
| 1184 | |
| 1185 if (end1) | |
| 1186 insert_string (",\n\t is the first character of a comment-end sequence"); | |
| 1187 if (end2) | |
| 1188 insert_string (",\n\t is the second character of a comment-end sequence"); | |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1189 if (comstyle) |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1190 insert_string (" (comment style b)"); |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1191 if (comnested) |
|
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1192 insert_string (" (nestable)"); |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1193 |
| 163 | 1194 if (prefix) |
| 1195 insert_string (",\n\t is a prefix character for `backward-prefix-chars'"); | |
| 1196 | |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1197 return syntax; |
|
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1198 } |
| 163 | 1199 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1200 int parse_sexp_ignore_comments; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1201 |
| 89483 | 1202 /* Char-table of functions that find the next or previous word |
| 1203 boundary. */ | |
| 1204 Lisp_Object Vfind_word_boundary_function_table; | |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1205 |
| 163 | 1206 /* Return the position across COUNT words from FROM. |
| 1207 If that many words cannot be found before the end of the buffer, return 0. | |
| 1208 COUNT negative means scan backward and stop at word beginning. */ | |
| 1209 | |
| 21514 | 1210 int |
| 163 | 1211 scan_words (from, count) |
| 1212 register int from, count; | |
| 1213 { | |
| 1214 register int beg = BEGV; | |
| 1215 register int end = ZV; | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1216 register int from_byte = CHAR_TO_BYTE (from); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1217 register enum syntaxcode code; |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1218 int ch0, ch1; |
| 89483 | 1219 Lisp_Object func, script, pos; |
| 163 | 1220 |
| 1221 immediate_quit = 1; | |
| 1222 QUIT; | |
| 1223 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1224 SETUP_SYNTAX_TABLE (from, count); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1225 |
| 163 | 1226 while (count > 0) |
| 1227 { | |
| 1228 while (1) | |
| 1229 { | |
| 1230 if (from == end) | |
| 1231 { | |
| 1232 immediate_quit = 0; | |
| 1233 return 0; | |
| 1234 } | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1235 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1236 ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1237 code = SYNTAX (ch0); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1238 INC_BOTH (from, from_byte); |
| 163 | 1239 if (words_include_escapes |
| 1240 && (code == Sescape || code == Scharquote)) | |
| 1241 break; | |
| 1242 if (code == Sword) | |
| 1243 break; | |
| 1244 } | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1245 /* Now CH0 is a character which begins a word and FROM is the |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1246 position of the next character. */ |
| 89483 | 1247 func = CHAR_TABLE_REF (Vfind_word_boundary_function_table, ch0); |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1248 if (! NILP (Ffboundp (func))) |
| 163 | 1249 { |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1250 pos = call2 (func, make_number (from - 1), make_number (end)); |
| 89483 | 1251 if (INTEGERP (pos) && XINT (pos) > from) |
| 1252 { | |
| 1253 from = XINT (pos); | |
| 1254 from_byte = CHAR_TO_BYTE (from); | |
| 1255 } | |
| 163 | 1256 } |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1257 else |
| 163 | 1258 { |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1259 script = CHAR_TABLE_REF (Vchar_script_table, ch0); |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1260 while (1) |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1261 { |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1262 if (from == end) break; |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1263 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1264 ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1265 code = SYNTAX (ch1); |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1266 if ((code != Sword |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1267 && (! words_include_escapes |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1268 || (code != Sescape && code != Scharquote))) |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1269 || ! EQ (CHAR_TABLE_REF (Vchar_script_table, ch1), script)) |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1270 break; |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1271 INC_BOTH (from, from_byte); |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1272 ch0 = ch1; |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1273 } |
| 163 | 1274 } |
| 1275 count--; | |
| 1276 } | |
| 1277 while (count < 0) | |
| 1278 { | |
| 1279 while (1) | |
| 1280 { | |
| 1281 if (from == beg) | |
| 1282 { | |
| 1283 immediate_quit = 0; | |
| 1284 return 0; | |
| 1285 } | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1286 DEC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1287 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1288 ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1289 code = SYNTAX (ch1); |
| 163 | 1290 if (words_include_escapes |
| 1291 && (code == Sescape || code == Scharquote)) | |
| 1292 break; | |
| 1293 if (code == Sword) | |
| 1294 break; | |
| 1295 } | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1296 /* Now CH1 is a character which ends a word and FROM is the |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1297 position of it. */ |
| 89483 | 1298 func = CHAR_TABLE_REF (Vfind_word_boundary_function_table, ch1); |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1299 if (! NILP (Ffboundp (func))) |
| 89483 | 1300 { |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1301 pos = call2 (func, make_number (from), make_number (beg)); |
| 89483 | 1302 if (INTEGERP (pos) && XINT (pos) < from) |
| 1303 { | |
| 1304 from = XINT (pos); | |
| 1305 from_byte = CHAR_TO_BYTE (from); | |
| 1306 } | |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1307 } |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1308 else |
| 163 | 1309 { |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1310 script = CHAR_TABLE_REF (Vchar_script_table, ch1); |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1311 while (1) |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1312 { |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1313 if (from == beg) |
|
77927
d15a774f9796
(scan_words): Fix arg to UPDATE_SYNTAX_TABLE_BACKWARD.
Chong Yidong <cyd@stupidchicken.com>
parents:
77757
diff
changeset
|
1314 break; |
| 90851 | 1315 DEC_BOTH (from, from_byte); |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1316 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 90851 | 1317 ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1318 code = SYNTAX (ch0); |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1319 if ((code != Sword |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1320 && (! words_include_escapes |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1321 || (code != Sescape && code != Scharquote))) |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1322 || ! EQ (CHAR_TABLE_REF (Vchar_script_table, ch0), script)) |
| 90851 | 1323 { |
| 1324 INC_BOTH (from, from_byte); | |
| 1325 break; | |
| 1326 } | |
|
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1327 ch1 = ch0; |
|
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1328 } |
| 163 | 1329 } |
| 1330 count++; | |
| 1331 } | |
| 1332 | |
| 1333 immediate_quit = 0; | |
| 1334 | |
| 1335 return from; | |
| 1336 } | |
| 1337 | |
|
93546
45896a2e7bee
(Fforward_word): Add ^ interactive spec.
Chong Yidong <cyd@stupidchicken.com>
parents:
91806
diff
changeset
|
1338 DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "^p", |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1339 doc: /* Move point forward ARG words (backward if ARG is negative). |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1340 Normally returns t. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1341 If an edge of the buffer or a field boundary is reached, point is left there |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1342 and the function returns nil. Field boundaries are not noticed if |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1343 `inhibit-field-text-motion' is non-nil. */) |
|
52213
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1344 (arg) |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1345 Lisp_Object arg; |
| 163 | 1346 { |
|
58897
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1347 Lisp_Object tmp; |
|
26391
216416ad34fe
(Fforward_word): Handle fields even if would have hit
Richard M. Stallman <rms@gnu.org>
parents:
26272
diff
changeset
|
1348 int orig_val, val; |
|
52213
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1349 |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1350 if (NILP (arg)) |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1351 XSETFASTINT (arg, 1); |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1352 else |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1353 CHECK_NUMBER (arg); |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1354 |
|
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1355 val = orig_val = scan_words (PT, XINT (arg)); |
|
26391
216416ad34fe
(Fforward_word): Handle fields even if would have hit
Richard M. Stallman <rms@gnu.org>
parents:
26272
diff
changeset
|
1356 if (! orig_val) |
|
52213
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1357 val = XINT (arg) > 0 ? ZV : BEGV; |
|
25401
3f78f1fed4e0
(Fforward_word): If in a mini-buffer and moving
Gerd Moellmann <gerd@gnu.org>
parents:
25290
diff
changeset
|
1358 |
|
26060
6edf64bf5e22
(Fforward_word): Supply new ESCAPE_FROM_EDGE parameter
Gerd Moellmann <gerd@gnu.org>
parents:
25771
diff
changeset
|
1359 /* Avoid jumping out of an input field. */ |
|
58897
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1360 tmp = Fconstrain_to_field (make_number (val), make_number (PT), |
|
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1361 Qt, Qnil, Qnil); |
|
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1362 val = XFASTINT (tmp); |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
1363 |
| 163 | 1364 SET_PT (val); |
|
27079
638b309011d9
(Fforward_word): Notice field boundaries only if
Gerd Moellmann <gerd@gnu.org>
parents:
26526
diff
changeset
|
1365 return val == orig_val ? Qt : Qnil; |
| 163 | 1366 } |
| 1367 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1368 Lisp_Object skip_chars (); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1369 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1370 DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1371 doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1372 STRING is like the inside of a `[...]' in a regular expression |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1373 except that `]' is never special and `\\' quotes `^', `-' or `\\' |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1374 (but not as the end of a range; quoting is never needed there). |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1375 Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1376 With arg "^a-zA-Z", skips nonletters stopping before first letter. |
| 56088 | 1377 Char classes, e.g. `[:alpha:]', are supported. |
| 1378 | |
| 1379 Returns the distance traveled, either zero or positive. */) | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1380 (string, lim) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1381 Lisp_Object string, lim; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1382 { |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1383 return skip_chars (1, string, lim, 1); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1384 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1385 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1386 DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1387 doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1388 See `skip-chars-forward' for details. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1389 Returns the distance traveled, either zero or negative. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1390 (string, lim) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1391 Lisp_Object string, lim; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1392 { |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1393 return skip_chars (0, string, lim, 1); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1394 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1395 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1396 DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1397 doc: /* Move point forward across chars in specified syntax classes. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1398 SYNTAX is a string of syntax code characters. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1399 Stop before a char whose syntax is not in SYNTAX, or at position LIM. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1400 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1401 This function returns the distance traveled, either zero or positive. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1402 (syntax, lim) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1403 Lisp_Object syntax, lim; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1404 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1405 return skip_syntaxes (1, syntax, lim); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1406 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1407 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1408 DEFUN ("skip-syntax-backward", Fskip_syntax_backward, Sskip_syntax_backward, 1, 2, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1409 doc: /* Move point backward across chars in specified syntax classes. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1410 SYNTAX is a string of syntax code characters. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1411 Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1412 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1413 This function returns the distance traveled, either zero or negative. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1414 (syntax, lim) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1415 Lisp_Object syntax, lim; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1416 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1417 return skip_syntaxes (0, syntax, lim); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1418 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1419 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1420 static Lisp_Object |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1421 skip_chars (forwardp, string, lim, handle_iso_classes) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1422 int forwardp; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1423 Lisp_Object string, lim; |
| 56088 | 1424 int handle_iso_classes; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1425 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1426 register unsigned int c; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1427 unsigned char fastmap[0400]; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1428 /* Store the ranges of non-ASCII characters. */ |
|
20292
2befa7396e42
(skip_chars): Check type of `string' before using it.
Karl Heuer <kwzh@gnu.org>
parents:
18938
diff
changeset
|
1429 int *char_ranges; |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1430 int n_char_ranges = 0; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1431 int negate = 0; |
|
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1432 register int i, i_byte; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1433 /* Set to 1 if the current buffer is multibyte and the region |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1434 contains non-ASCII chars. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1435 int multibyte; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1436 /* Set to 1 if STRING is multibyte and it contains non-ASCII |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1437 chars. */ |
|
22486
a28020246db1
(skip_chars): Don't examine STRING before verifying that it is a string.
Richard M. Stallman <rms@gnu.org>
parents:
22432
diff
changeset
|
1438 int string_multibyte; |
|
a28020246db1
(skip_chars): Don't examine STRING before verifying that it is a string.
Richard M. Stallman <rms@gnu.org>
parents:
22432
diff
changeset
|
1439 int size_byte; |
|
46555
35e66a0949b8
(Fstring_to_syntax, skip_chars): Treat Lisp string
Ken Raeburn <raeburn@raeburn.org>
parents:
46370
diff
changeset
|
1440 const unsigned char *str; |
|
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1441 int len; |
| 56088 | 1442 Lisp_Object iso_classes; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1443 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
1444 CHECK_STRING (string); |
| 56088 | 1445 iso_classes = Qnil; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1446 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1447 if (NILP (lim)) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1448 XSETINT (lim, forwardp ? ZV : BEGV); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1449 else |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
1450 CHECK_NUMBER_COERCE_MARKER (lim); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1451 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1452 /* In any case, don't allow scan outside bounds of buffer. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1453 if (XINT (lim) > ZV) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1454 XSETFASTINT (lim, ZV); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1455 if (XINT (lim) < BEGV) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1456 XSETFASTINT (lim, BEGV); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1457 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1458 multibyte = (!NILP (current_buffer->enable_multibyte_characters) |
|
89341
9664825d832f
(skip_chars, skip_syntaxes): Fix type errors.
Dave Love <fx@gnu.org>
parents:
89114
diff
changeset
|
1459 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); |
| 89483 | 1460 string_multibyte = SBYTES (string) > SCHARS (string); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1461 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1462 bzero (fastmap, sizeof fastmap); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1463 |
| 89483 | 1464 str = SDATA (string); |
| 1465 size_byte = SBYTES (string); | |
|
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1466 |
|
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1467 i_byte = 0; |
|
22130
b25abff012fd
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22116
diff
changeset
|
1468 if (i_byte < size_byte |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
41598
diff
changeset
|
1469 && SREF (string, 0) == '^') |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1470 { |
|
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1471 negate = 1; i_byte++; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1472 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1473 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1474 /* Find the characters specified and set their elements of fastmap. |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1475 Handle backslashes and ranges specially. |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1476 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1477 If STRING contains non-ASCII characters, setup char_ranges for |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1478 them and use fastmap only for their leading codes. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1479 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1480 if (! string_multibyte) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1481 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1482 int string_has_eight_bit = 0; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1483 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1484 /* At first setup fastmap. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1485 while (i_byte < size_byte) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1486 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1487 c = str[i_byte++]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1488 |
| 56088 | 1489 if (handle_iso_classes && c == '[' |
| 1490 && i_byte < size_byte | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1491 && str[i_byte] == ':') |
| 56088 | 1492 { |
| 1493 const unsigned char *class_beg = str + i_byte + 1; | |
| 1494 const unsigned char *class_end = class_beg; | |
|
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1495 const unsigned char *class_limit = str + size_byte - 2; |
| 74145 | 1496 /* Leave room for the null. */ |
| 56088 | 1497 unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; |
| 1498 re_wctype_t cc; | |
| 1499 | |
| 1500 if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) | |
| 1501 class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; | |
| 1502 | |
|
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1503 while (class_end < class_limit |
|
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1504 && *class_end >= 'a' && *class_end <= 'z') |
| 56088 | 1505 class_end++; |
| 1506 | |
|
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1507 if (class_end == class_beg |
|
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1508 || *class_end != ':' || class_end[1] != ']') |
|
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1509 goto not_a_class_name; |
| 56088 | 1510 |
| 1511 bcopy (class_beg, class_name, class_end - class_beg); | |
| 1512 class_name[class_end - class_beg] = 0; | |
| 1513 | |
| 1514 cc = re_wctype (class_name); | |
| 1515 if (cc == 0) | |
| 1516 error ("Invalid ISO C character class"); | |
| 1517 | |
| 1518 iso_classes = Fcons (make_number (cc), iso_classes); | |
| 1519 | |
| 1520 i_byte = class_end + 2 - str; | |
| 1521 continue; | |
| 1522 } | |
| 1523 | |
|
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1524 not_a_class_name: |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1525 if (c == '\\') |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1526 { |
|
22130
b25abff012fd
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22116
diff
changeset
|
1527 if (i_byte == size_byte) |
|
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1528 break; |
|
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1529 |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1530 c = str[i_byte++]; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1531 } |
|
53508
c7553b3b3a60
(skip_chars): Treat '-' at end of string as ordinary
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1532 /* Treat `-' as range character only if another character |
|
c7553b3b3a60
(skip_chars): Treat '-' at end of string as ordinary
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1533 follows. */ |
|
c7553b3b3a60
(skip_chars): Treat '-' at end of string as ordinary
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1534 if (i_byte + 1 < size_byte |
|
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1535 && str[i_byte] == '-') |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1536 { |
|
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1537 unsigned int c2; |
|
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1538 |
|
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1539 /* Skip over the dash. */ |
|
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1540 i_byte++; |
|
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1541 |
|
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1542 /* Get the end of the range. */ |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1543 c2 = str[i_byte++]; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1544 if (c2 == '\\' |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1545 && i_byte < size_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1546 c2 = str[i_byte++]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1547 |
| 89483 | 1548 if (c <= c2) |
|
22116
09efd6a94b4b
(skip_chars): Fix bug in handling a range which
Kenichi Handa <handa@m17n.org>
parents:
22052
diff
changeset
|
1549 { |
|
09efd6a94b4b
(skip_chars): Fix bug in handling a range which
Kenichi Handa <handa@m17n.org>
parents:
22052
diff
changeset
|
1550 while (c <= c2) |
| 89483 | 1551 fastmap[c++] = 1; |
| 1552 if (! ASCII_CHAR_P (c2)) | |
| 1553 string_has_eight_bit = 1; | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1554 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1555 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1556 else |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1557 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1558 fastmap[c] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1559 if (! ASCII_CHAR_P (c)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1560 string_has_eight_bit = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1561 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1562 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1563 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1564 /* If the current range is multibyte and STRING contains |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1565 eight-bit chars, arrange fastmap and setup char_ranges for |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1566 the corresponding multibyte chars. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1567 if (multibyte && string_has_eight_bit) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1568 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1569 unsigned char fastmap2[0400]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1570 int range_start_byte, range_start_char; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1571 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1572 bcopy (fastmap2 + 0200, fastmap + 0200, 0200); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1573 bzero (fastmap + 0200, 0200); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1574 /* We are sure that this loop stops. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1575 for (i = 0200; ! fastmap2[i]; i++); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1576 c = unibyte_char_to_multibyte (i); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1577 fastmap[CHAR_LEADING_CODE (c)] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1578 range_start_byte = i; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1579 range_start_char = c; |
|
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1580 char_ranges = (int *) alloca (sizeof (int) * 128 * 2); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1581 for (i = 129; i < 0400; i++) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1582 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1583 c = unibyte_char_to_multibyte (i); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1584 fastmap[CHAR_LEADING_CODE (c)] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1585 if (i - range_start_byte != c - range_start_char) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1586 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1587 char_ranges[n_char_ranges++] = range_start_char; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1588 char_ranges[n_char_ranges++] = ((i - 1 - range_start_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1589 + range_start_char); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1590 range_start_byte = i; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1591 range_start_char = c; |
| 89483 | 1592 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1593 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1594 char_ranges[n_char_ranges++] = range_start_char; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1595 char_ranges[n_char_ranges++] = ((i - 1 - range_start_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1596 + range_start_char); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1597 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1598 } |
|
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1599 else /* STRING is multibyte */ |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1600 { |
|
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1601 char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2); |
|
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1602 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1603 while (i_byte < size_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1604 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1605 unsigned char leading_code; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1606 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1607 leading_code = str[i_byte]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1608 c = STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1609 i_byte += len; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1610 |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1611 if (handle_iso_classes && c == '[' |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1612 && i_byte < size_byte |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1613 && STRING_CHAR (str + i_byte, size_byte - i_byte) == ':') |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1614 { |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1615 const unsigned char *class_beg = str + i_byte + 1; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1616 const unsigned char *class_end = class_beg; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1617 const unsigned char *class_limit = str + size_byte - 2; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1618 /* Leave room for the null. */ |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1619 unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1620 re_wctype_t cc; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1621 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1622 if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1623 class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1624 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1625 while (class_end < class_limit |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1626 && *class_end >= 'a' && *class_end <= 'z') |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1627 class_end++; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1628 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1629 if (class_end == class_beg |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1630 || *class_end != ':' || class_end[1] != ']') |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1631 goto not_a_class_name_multibyte; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1632 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1633 bcopy (class_beg, class_name, class_end - class_beg); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1634 class_name[class_end - class_beg] = 0; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1635 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1636 cc = re_wctype (class_name); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1637 if (cc == 0) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1638 error ("Invalid ISO C character class"); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1639 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1640 iso_classes = Fcons (make_number (cc), iso_classes); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1641 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1642 i_byte = class_end + 2 - str; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1643 continue; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1644 } |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1645 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1646 not_a_class_name_multibyte: |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1647 if (c == '\\') |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1648 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1649 if (i_byte == size_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1650 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1651 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1652 leading_code = str[i_byte]; |
| 89880 | 1653 c = STRING_CHAR_AND_LENGTH (str + i_byte, |
| 1654 size_byte - i_byte, len); | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1655 i_byte += len; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1656 } |
| 89880 | 1657 /* Treat `-' as range character only if another character |
| 1658 follows. */ | |
| 1659 if (i_byte + 1 < size_byte | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1660 && str[i_byte] == '-') |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1661 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1662 unsigned int c2; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1663 unsigned char leading_code2; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1664 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1665 /* Skip over the dash. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1666 i_byte++; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1667 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1668 /* Get the end of the range. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1669 leading_code2 = str[i_byte]; |
| 89880 | 1670 c2 = STRING_CHAR_AND_LENGTH (str + i_byte, |
| 1671 size_byte - i_byte, len); | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1672 i_byte += len; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1673 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1674 if (c2 == '\\' |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1675 && i_byte < size_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1676 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1677 leading_code2 = str[i_byte]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1678 c2 =STRING_CHAR_AND_LENGTH (str + i_byte, size_byte-i_byte, len); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1679 i_byte += len; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1680 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1681 |
|
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1682 if (c > c2) |
|
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1683 continue; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1684 if (ASCII_CHAR_P (c)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1685 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1686 while (c <= c2 && c < 0x80) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1687 fastmap[c++] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1688 leading_code = CHAR_LEADING_CODE (c); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1689 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1690 if (! ASCII_CHAR_P (c)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1691 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1692 while (leading_code <= leading_code2) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1693 fastmap[leading_code++] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1694 if (c <= c2) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1695 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1696 char_ranges[n_char_ranges++] = c; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1697 char_ranges[n_char_ranges++] = c2; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1698 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1699 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1700 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1701 else |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1702 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1703 if (ASCII_CHAR_P (c)) |
|
30626
9d47c133b357
* syntax.c (skip_chars): Fix previous change. Make the handling of
Kenichi Handa <handa@m17n.org>
parents:
30596
diff
changeset
|
1704 fastmap[c] = 1; |
|
9d47c133b357
* syntax.c (skip_chars): Fix previous change. Make the handling of
Kenichi Handa <handa@m17n.org>
parents:
30596
diff
changeset
|
1705 else |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1706 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1707 fastmap[leading_code] = 1; |
|
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1708 char_ranges[n_char_ranges++] = c; |
|
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1709 char_ranges[n_char_ranges++] = c; |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1710 } |
|
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1711 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1712 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1713 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1714 /* If the current range is unibyte and STRING contains non-ASCII |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1715 chars, arrange fastmap for the corresponding unibyte |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1716 chars. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1717 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1718 if (! multibyte && n_char_ranges > 0) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1719 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1720 bzero (fastmap + 0200, 0200); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1721 for (i = 0; i < n_char_ranges; i += 2) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1722 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1723 int c1 = char_ranges[i]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1724 int c2 = char_ranges[i + 1]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1725 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1726 for (; c1 <= c2; c1++) |
|
95856
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1727 { |
|
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1728 int b = CHAR_TO_BYTE_SAFE (c1); |
|
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1729 if (b >= 0) |
|
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1730 fastmap[b] = 1; |
|
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1731 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1732 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1733 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1734 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1735 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1736 /* If ^ was the first character, complement the fastmap. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1737 if (negate) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1738 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1739 if (! multibyte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1740 for (i = 0; i < sizeof fastmap; i++) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1741 fastmap[i] ^= 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1742 else |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1743 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1744 for (i = 0; i < 0200; i++) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1745 fastmap[i] ^= 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1746 /* All non-ASCII chars possibly match. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1747 for (; i < sizeof fastmap; i++) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1748 fastmap[i] = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1749 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1750 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1751 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1752 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1753 int start_point = PT; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1754 int pos = PT; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1755 int pos_byte = PT_BYTE; |
| 89483 | 1756 unsigned char *p = PT_ADDR, *endp, *stop; |
| 1757 | |
| 1758 if (forwardp) | |
| 1759 { | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1760 endp = (XINT (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim)); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1761 stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp; |
| 89483 | 1762 } |
| 1763 else | |
| 1764 { | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1765 endp = CHAR_POS_ADDR (XINT (lim)); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1766 stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp; |
| 89483 | 1767 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1768 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1769 immediate_quit = 1; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1770 if (forwardp) |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1771 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1772 if (multibyte) |
| 89483 | 1773 while (1) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1774 { |
| 89483 | 1775 int nbytes; |
| 1776 | |
| 1777 if (p >= stop) | |
| 1778 { | |
| 1779 if (p >= endp) | |
| 1780 break; | |
| 1781 p = GAP_END_ADDR; | |
| 1782 stop = endp; | |
| 1783 } | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1784 c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1785 if (! NILP (iso_classes) && in_classes (c, iso_classes)) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1786 { |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1787 if (negate) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1788 break; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1789 else |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1790 goto fwd_ok; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1791 } |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1792 |
| 89483 | 1793 if (! fastmap[*p]) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1794 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1795 if (! ASCII_CHAR_P (c)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1796 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1797 /* As we are looking at a multibyte character, we |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1798 must look up the character in the table |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1799 CHAR_RANGES. If there's no data in the table, |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1800 that character is not what we want to skip. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1801 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1802 /* The following code do the right thing even if |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1803 n_char_ranges is zero (i.e. no data in |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1804 CHAR_RANGES). */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1805 for (i = 0; i < n_char_ranges; i += 2) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1806 if (c >= char_ranges[i] && c <= char_ranges[i + 1]) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1807 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1808 if (!(negate ^ (i < n_char_ranges))) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1809 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1810 } |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1811 fwd_ok: |
| 89483 | 1812 p += nbytes, pos++, pos_byte += nbytes; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1813 } |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1814 else |
| 89483 | 1815 while (1) |
| 1816 { | |
| 1817 if (p >= stop) | |
| 1818 { | |
| 1819 if (p >= endp) | |
| 1820 break; | |
| 1821 p = GAP_END_ADDR; | |
| 1822 stop = endp; | |
| 1823 } | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1824 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1825 if (!NILP (iso_classes) && in_classes (*p, iso_classes)) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1826 { |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1827 if (negate) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1828 break; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1829 else |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1830 goto fwd_unibyte_ok; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1831 } |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1832 |
| 89483 | 1833 if (!fastmap[*p]) |
| 1834 break; | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1835 fwd_unibyte_ok: |
| 89483 | 1836 p++, pos++, pos_byte++; |
| 1837 } | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1838 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1839 else |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1840 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1841 if (multibyte) |
| 89483 | 1842 while (1) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1843 { |
| 89483 | 1844 unsigned char *prev_p; |
| 1845 | |
| 1846 if (p <= stop) | |
| 1847 { | |
| 1848 if (p <= endp) | |
| 1849 break; | |
| 1850 p = GPT_ADDR; | |
| 1851 stop = endp; | |
| 1852 } | |
| 1853 prev_p = p; | |
| 1854 while (--p >= stop && ! CHAR_HEAD_P (*p)); | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1855 c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1856 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1857 if (! NILP (iso_classes) && in_classes (c, iso_classes)) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1858 { |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1859 if (negate) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1860 break; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1861 else |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1862 goto back_ok; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1863 } |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1864 |
| 89483 | 1865 if (! fastmap[*p]) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1866 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1867 if (! ASCII_CHAR_P (c)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1868 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1869 /* See the comment in the previous similar code. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1870 for (i = 0; i < n_char_ranges; i += 2) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1871 if (c >= char_ranges[i] && c <= char_ranges[i + 1]) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1872 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1873 if (!(negate ^ (i < n_char_ranges))) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1874 break; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1875 } |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1876 back_ok: |
| 89483 | 1877 pos--, pos_byte -= prev_p - p; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1878 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1879 else |
| 89483 | 1880 while (1) |
| 1881 { | |
| 1882 if (p <= stop) | |
| 1883 { | |
| 1884 if (p <= endp) | |
| 1885 break; | |
| 1886 p = GPT_ADDR; | |
| 1887 stop = endp; | |
| 1888 } | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1889 |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1890 if (! NILP (iso_classes) && in_classes (p[-1], iso_classes)) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1891 { |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1892 if (negate) |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1893 break; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1894 else |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1895 goto back_unibyte_ok; |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1896 } |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1897 |
| 89483 | 1898 if (!fastmap[p[-1]]) |
| 1899 break; | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1900 back_unibyte_ok: |
| 89483 | 1901 p--, pos--, pos_byte--; |
| 1902 } | |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1903 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1904 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1905 SET_PT_BOTH (pos, pos_byte); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1906 immediate_quit = 0; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1907 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1908 return make_number (PT - start_point); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1909 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1910 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1911 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1912 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1913 static Lisp_Object |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1914 skip_syntaxes (forwardp, string, lim) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1915 int forwardp; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1916 Lisp_Object string, lim; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1917 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1918 register unsigned int c; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1919 unsigned char fastmap[0400]; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1920 int negate = 0; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1921 register int i, i_byte; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1922 int multibyte; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1923 int size_byte; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1924 unsigned char *str; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1925 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1926 CHECK_STRING (string); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1927 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1928 if (NILP (lim)) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1929 XSETINT (lim, forwardp ? ZV : BEGV); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1930 else |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1931 CHECK_NUMBER_COERCE_MARKER (lim); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1932 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1933 /* In any case, don't allow scan outside bounds of buffer. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1934 if (XINT (lim) > ZV) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1935 XSETFASTINT (lim, ZV); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1936 if (XINT (lim) < BEGV) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1937 XSETFASTINT (lim, BEGV); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1938 |
| 89114 | 1939 if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim))) |
|
90041
7e61e1c97f6b
(skip_syntaxes): Return lispy 0 (not nil) if point is
Kenichi Handa <handa@m17n.org>
parents:
89966
diff
changeset
|
1940 return make_number (0); |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
1941 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1942 multibyte = (!NILP (current_buffer->enable_multibyte_characters) |
|
89341
9664825d832f
(skip_chars, skip_syntaxes): Fix type errors.
Dave Love <fx@gnu.org>
parents:
89114
diff
changeset
|
1943 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1944 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1945 bzero (fastmap, sizeof fastmap); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1946 |
| 89483 | 1947 if (SBYTES (string) > SCHARS (string)) |
| 1948 /* As this is very rare case (syntax spec is ASCII only), don't | |
| 1949 consider efficiency. */ | |
|
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1950 string = string_make_unibyte (string); |
|
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1951 |
| 89483 | 1952 str = SDATA (string); |
| 1953 size_byte = SBYTES (string); | |
|
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1954 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1955 i_byte = 0; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1956 if (i_byte < size_byte |
| 89483 | 1957 && SREF (string, 0) == '^') |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1958 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1959 negate = 1; i_byte++; |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1960 } |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1961 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1962 /* Find the syntaxes specified and set their elements of fastmap. */ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1963 |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1964 while (i_byte < size_byte) |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1965 { |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1966 c = str[i_byte++]; |
| 89483 | 1967 fastmap[syntax_spec_code[c]] = 1; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1968 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1969 |
|
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1970 /* If ^ was the first character, complement the fastmap. */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1971 if (negate) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1972 for (i = 0; i < sizeof fastmap; i++) |
|
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1973 fastmap[i] ^= 1; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1974 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1975 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1976 int start_point = PT; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1977 int pos = PT; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1978 int pos_byte = PT_BYTE; |
|
50675
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1979 unsigned char *p = PT_ADDR, *endp, *stop; |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1980 |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1981 if (forwardp) |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1982 { |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1983 endp = (XINT (lim) == GPT) ? GPT_ADDR : CHAR_POS_ADDR (XINT (lim)); |
|
55423
a9e10b866486
(Fmodify_syntax_entry): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54849
diff
changeset
|
1984 stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp; |
|
50675
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1985 } |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1986 else |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1987 { |
|
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1988 endp = CHAR_POS_ADDR (XINT (lim)); |
|
55423
a9e10b866486
(Fmodify_syntax_entry): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54849
diff
changeset
|
1989 stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp; |
|
50675
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1990 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1991 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1992 immediate_quit = 1; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1993 SETUP_SYNTAX_TABLE (pos, forwardp ? 1 : -1); |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1994 if (forwardp) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1995 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1996 if (multibyte) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1997 { |
| 89483 | 1998 while (1) |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
1999 { |
| 89483 | 2000 int nbytes; |
| 2001 | |
| 2002 if (p >= stop) | |
| 2003 { | |
| 2004 if (p >= endp) | |
| 2005 break; | |
| 2006 p = GAP_END_ADDR; | |
| 2007 stop = endp; | |
| 2008 } | |
| 2009 c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, nbytes); | |
| 2010 if (! fastmap[(int) SYNTAX (c)]) | |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2011 break; |
| 89483 | 2012 p += nbytes, pos++, pos_byte += nbytes; |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2013 UPDATE_SYNTAX_TABLE_FORWARD (pos); |
|
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2014 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2015 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2016 else |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2017 { |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2018 while (1) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2019 { |
| 89483 | 2020 if (p >= stop) |
| 2021 { | |
| 2022 if (p >= endp) | |
|
50675
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
2023 break; |
| 89483 | 2024 p = GAP_END_ADDR; |
| 2025 stop = endp; | |
| 2026 } | |
| 2027 if (! fastmap[(int) SYNTAX (*p)]) | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2028 break; |
| 89483 | 2029 p++, pos++, pos_byte++; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2030 UPDATE_SYNTAX_TABLE_FORWARD (pos); |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2031 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2032 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2033 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2034 else |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2035 { |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2036 if (multibyte) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2037 { |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2038 while (1) |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2039 { |
| 89483 | 2040 unsigned char *prev_p; |
| 2041 | |
| 2042 if (p <= stop) | |
| 2043 { | |
| 2044 if (p <= endp) | |
| 2045 break; | |
| 2046 p = GPT_ADDR; | |
| 2047 stop = endp; | |
| 2048 } | |
| 90851 | 2049 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); |
| 89483 | 2050 prev_p = p; |
| 2051 while (--p >= stop && ! CHAR_HEAD_P (*p)); | |
| 2052 c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH); | |
| 2053 if (! fastmap[(int) SYNTAX (c)]) | |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2054 break; |
| 89483 | 2055 pos--, pos_byte -= prev_p - p; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2056 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2057 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2058 else |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2059 { |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2060 while (1) |
|
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2061 { |
| 89483 | 2062 if (p <= stop) |
| 2063 { | |
| 2064 if (p <= endp) | |
| 2065 break; | |
| 2066 p = GPT_ADDR; | |
| 2067 stop = endp; | |
| 2068 } | |
|
90846
c035421fe210
(skip_syntaxes): Synch with the trunk.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2069 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); |
| 89483 | 2070 if (! fastmap[(int) SYNTAX (p[-1])]) |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2071 break; |
| 89483 | 2072 p--, pos--, pos_byte--; |
|
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2073 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2074 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2075 } |
|
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2076 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2077 SET_PT_BOTH (pos, pos_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2078 immediate_quit = 0; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2079 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2080 return make_number (PT - start_point); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2081 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2082 } |
| 56088 | 2083 |
| 2084 /* Return 1 if character C belongs to one of the ISO classes | |
| 2085 in the list ISO_CLASSES. Each class is represented by an | |
| 2086 integer which is its type according to re_wctype. */ | |
| 2087 | |
| 2088 static int | |
| 2089 in_classes (c, iso_classes) | |
| 2090 int c; | |
| 2091 Lisp_Object iso_classes; | |
| 2092 { | |
| 2093 int fits_class = 0; | |
| 2094 | |
| 2095 while (! NILP (iso_classes)) | |
| 2096 { | |
| 2097 Lisp_Object elt; | |
| 2098 elt = XCAR (iso_classes); | |
| 2099 iso_classes = XCDR (iso_classes); | |
| 2100 | |
| 2101 if (re_iswctype (c, XFASTINT (elt))) | |
| 2102 fits_class = 1; | |
| 2103 } | |
| 2104 | |
| 2105 return fits_class; | |
| 2106 } | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2107 |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2108 /* Jump over a comment, assuming we are at the beginning of one. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2109 FROM is the current position. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2110 FROM_BYTE is the bytepos corresponding to FROM. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2111 Do not move past STOP (a charpos). |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2112 The comment over which we have to jump is of style STYLE |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2113 (either SYNTAX_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2114 NESTING should be positive to indicate the nesting at the beginning |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2115 for nested comments and should be zero or negative else. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2116 ST_COMMENT_STYLE cannot be nested. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2117 PREV_SYNTAX is the SYNTAX_WITH_FLAGS of the previous character |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2118 (or 0 If the search cannot start in the middle of a two-character). |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2119 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2120 If successful, return 1 and store the charpos of the comment's end |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2121 into *CHARPOS_PTR and the corresponding bytepos into *BYTEPOS_PTR. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2122 Else, return 0 and store the charpos STOP into *CHARPOS_PTR, the |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2123 corresponding bytepos into *BYTEPOS_PTR and the current nesting |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2124 (as defined for state.incomment) in *INCOMMENT_PTR. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2125 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2126 The comment end is the last character of the comment rather than the |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2127 character just after the comment. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2128 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2129 Global syntax data is assumed to initially be valid for FROM and |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2130 remains valid for forward search starting at the returned position. */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2131 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2132 static int |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2133 forw_comment (from, from_byte, stop, nesting, style, prev_syntax, |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2134 charpos_ptr, bytepos_ptr, incomment_ptr) |
|
71787
7e302766894f
(forw_comment): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71740
diff
changeset
|
2135 EMACS_INT from, from_byte, stop; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2136 int nesting, style, prev_syntax; |
|
71787
7e302766894f
(forw_comment): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71740
diff
changeset
|
2137 EMACS_INT *charpos_ptr, *bytepos_ptr; |
|
7e302766894f
(forw_comment): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71740
diff
changeset
|
2138 int *incomment_ptr; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2139 { |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2140 register int c, c1; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2141 register enum syntaxcode code; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2142 register int syntax; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2143 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2144 if (nesting <= 0) nesting = -1; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2145 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2146 /* Enter the loop in the middle so that we find |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2147 a 2-char comment ender if we start in the middle of it. */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2148 syntax = prev_syntax; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2149 if (syntax != 0) goto forw_incomment; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2150 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2151 while (1) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2152 { |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2153 if (from == stop) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2154 { |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2155 *incomment_ptr = nesting; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2156 *charpos_ptr = from; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2157 *bytepos_ptr = from_byte; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2158 return 0; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2159 } |
| 89483 | 2160 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2161 syntax = SYNTAX_WITH_FLAGS (c); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2162 code = syntax & 0xff; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2163 if (code == Sendcomment |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2164 && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2165 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2166 (nesting > 0 && --nesting == 0) : nesting < 0)) |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2167 /* we have encountered a comment end of the same style |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2168 as the comment sequence which began this comment |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2169 section */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2170 break; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2171 if (code == Scomment_fence |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2172 && style == ST_COMMENT_STYLE) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2173 /* we have encountered a comment end of the same style |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2174 as the comment sequence which began this comment |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2175 section. */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2176 break; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2177 if (nesting > 0 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2178 && code == Scomment |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2179 && SYNTAX_FLAGS_COMMENT_NESTED (syntax) |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2180 && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2181 /* we have encountered a nested comment of the same style |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2182 as the comment sequence which began this comment section */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2183 nesting++; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2184 INC_BOTH (from, from_byte); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2185 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2186 |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2187 forw_incomment: |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2188 if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2189 && SYNTAX_FLAGS_COMMENT_STYLE (syntax) == style |
| 89483 | 2190 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2191 SYNTAX_COMEND_SECOND (c1)) |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2192 && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2193 SYNTAX_COMMENT_NESTED (c1)) ? nesting > 0 : nesting < 0)) |
|
25771
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2194 { |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2195 if (--nesting <= 0) |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2196 /* we have encountered a comment end of the same style |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2197 as the comment sequence which began this comment |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2198 section */ |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2199 break; |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2200 else |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2201 { |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2202 INC_BOTH (from, from_byte); |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2203 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2204 } |
|
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2205 } |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2206 if (nesting > 0 |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2207 && from < stop |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2208 && SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
| 89483 | 2209 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2210 SYNTAX_COMMENT_STYLE (c1) == style |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2211 && SYNTAX_COMSTART_SECOND (c1)) |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2212 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2213 SYNTAX_COMMENT_NESTED (c1))) |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2214 /* we have encountered a nested comment of the same style |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2215 as the comment sequence which began this comment |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2216 section */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2217 { |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2218 INC_BOTH (from, from_byte); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2219 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2220 nesting++; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2221 } |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2222 } |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2223 *charpos_ptr = from; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2224 *bytepos_ptr = from_byte; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2225 return 1; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2226 } |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2227 |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2228 DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0, |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49551
diff
changeset
|
2229 doc: /* |
| 48089 | 2230 Move forward across up to COUNT comments. If COUNT is negative, move backward. |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2231 Stop scanning if we find something other than a comment or whitespace. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2232 Set point to where scanning stops. |
| 48089 | 2233 If COUNT comments are found as expected, with nothing except whitespace |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2234 between them, return t; otherwise return nil. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2235 (count) |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2236 Lisp_Object count; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2237 { |
|
71739
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2238 register EMACS_INT from; |
|
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2239 EMACS_INT from_byte; |
|
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2240 register EMACS_INT stop; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
2241 register int c, c1; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2242 register enum syntaxcode code; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2243 int comstyle = 0; /* style of comment encountered */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2244 int comnested = 0; /* whether the comment is nestable or not */ |
|
3087
ea0cb469490e
(Fforward_comment): Fix last change.
Richard M. Stallman <rms@gnu.org>
parents:
3086
diff
changeset
|
2245 int found; |
|
71739
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2246 EMACS_INT count1; |
|
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2247 EMACS_INT out_charpos, out_bytepos; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2248 int dummy; |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2249 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2250 CHECK_NUMBER (count); |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2251 count1 = XINT (count); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2252 stop = count1 > 0 ? ZV : BEGV; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2253 |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2254 immediate_quit = 1; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2255 QUIT; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2256 |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2257 from = PT; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2258 from_byte = PT_BYTE; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2259 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2260 SETUP_SYNTAX_TABLE (from, count1); |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2261 while (count1 > 0) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2262 { |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2263 do |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2264 { |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2265 int comstart_first; |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2266 |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2267 if (from == stop) |
|
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2268 { |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2269 SET_PT_BOTH (from, from_byte); |
|
10947
e805ef6b931c
(Fforward_comment): Always clear immediate_quit for return.
Richard M. Stallman <rms@gnu.org>
parents:
10457
diff
changeset
|
2270 immediate_quit = 0; |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2271 return Qnil; |
|
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2272 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2273 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2274 code = SYNTAX (c); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2275 comstart_first = SYNTAX_COMSTART_FIRST (c); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2276 comnested = SYNTAX_COMMENT_NESTED (c); |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
2277 comstyle = SYNTAX_COMMENT_STYLE (c); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2278 INC_BOTH (from, from_byte); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2279 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2280 if (from < stop && comstart_first |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2281 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
2282 SYNTAX_COMSTART_SECOND (c1))) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2283 { |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2284 /* We have encountered a comment start sequence and we |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2285 are ignoring all text inside comments. We must record |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2286 the comment style this sequence begins so that later, |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2287 only a comment end of the same style actually ends |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2288 the comment section. */ |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2289 code = Scomment; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
2290 comstyle = SYNTAX_COMMENT_STYLE (c1); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2291 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2292 INC_BOTH (from, from_byte); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2293 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2294 } |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2295 } |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2296 while (code == Swhitespace || (code == Sendcomment && c == '\n')); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2297 |
|
25290
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2298 if (code == Scomment_fence) |
|
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2299 comstyle = ST_COMMENT_STYLE; |
|
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2300 else if (code != Scomment) |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2301 { |
|
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2302 immediate_quit = 0; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2303 DEC_BOTH (from, from_byte); |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2304 SET_PT_BOTH (from, from_byte); |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2305 return Qnil; |
|
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2306 } |
|
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2307 /* We're at the start of a comment. */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2308 found = forw_comment (from, from_byte, stop, comnested, comstyle, 0, |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2309 &out_charpos, &out_bytepos, &dummy); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2310 from = out_charpos; from_byte = out_bytepos; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2311 if (!found) |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2312 { |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2313 immediate_quit = 0; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2314 SET_PT_BOTH (from, from_byte); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2315 return Qnil; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2316 } |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2317 INC_BOTH (from, from_byte); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2318 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2319 /* We have skipped one comment. */ |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2320 count1--; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2321 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2322 |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2323 while (count1 < 0) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2324 { |
|
18938
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2325 while (1) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2326 { |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
2327 int quoted; |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2328 |
|
18938
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2329 if (from <= stop) |
|
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2330 { |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2331 SET_PT_BOTH (BEGV, BEGV_BYTE); |
|
18938
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2332 immediate_quit = 0; |
|
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2333 return Qnil; |
|
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2334 } |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2335 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2336 DEC_BOTH (from, from_byte); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2337 /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from). */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2338 quoted = char_quoted (from, from_byte); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2339 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2340 code = SYNTAX (c); |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2341 comstyle = 0; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2342 comnested = SYNTAX_COMMENT_NESTED (c); |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2343 if (code == Sendcomment) |
|
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2344 comstyle = SYNTAX_COMMENT_STYLE (c); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2345 if (from > stop && SYNTAX_COMEND_SECOND (c) |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2346 && prev_char_comend_first (from, from_byte) |
|
22432
ac339ec4a12a
(Fforward_comment): Properly compute BYTEPOS arg to char_quoted.
Richard M. Stallman <rms@gnu.org>
parents:
22394
diff
changeset
|
2347 && !char_quoted (from - 1, dec_bytepos (from_byte))) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2348 { |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2349 /* We must record the comment style encountered so that |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2350 later, we can match only the proper comment begin |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2351 sequence of the same style. */ |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2352 DEC_BOTH (from, from_byte); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2353 code = Sendcomment; |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2354 /* Calling char_quoted, above, set up global syntax position |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2355 at the new value of FROM. */ |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2356 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2357 comstyle = SYNTAX_COMMENT_STYLE (c1); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2358 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2359 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2360 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2361 if (code == Scomment_fence) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2362 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2363 /* Skip until first preceding unquoted comment_fence. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2364 int found = 0, ini = from, ini_byte = from_byte; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2365 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2366 while (1) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2367 { |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2368 DEC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2369 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2370 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2371 if (SYNTAX (c) == Scomment_fence |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2372 && !char_quoted (from, from_byte)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2373 { |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2374 found = 1; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2375 break; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2376 } |
|
70317
48f9beb0cfdc
(Fforward_comment): Detect generic comment at beginning of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70291
diff
changeset
|
2377 else if (from == stop) |
|
48f9beb0cfdc
(Fforward_comment): Detect generic comment at beginning of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70291
diff
changeset
|
2378 break; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2379 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2380 if (found == 0) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2381 { |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2382 from = ini; /* Set point to ini + 1. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2383 from_byte = ini_byte; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2384 goto leave; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2385 } |
|
70291
e4dbfbc6b5c6
(Fforward_comment): Don't forget to break out of the loop
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
2386 else |
|
e4dbfbc6b5c6
(Fforward_comment): Don't forget to break out of the loop
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
2387 /* We have skipped one comment. */ |
|
e4dbfbc6b5c6
(Fforward_comment): Don't forget to break out of the loop
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
2388 break; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2389 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2390 else if (code == Sendcomment) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2391 { |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2392 found = back_comment (from, from_byte, stop, comnested, comstyle, |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2393 &out_charpos, &out_bytepos); |
|
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2394 if (found == -1) |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2395 { |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2396 if (c == '\n') |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2397 /* This end-of-line is not an end-of-comment. |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2398 Treat it like a whitespace. |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2399 CC-mode (and maybe others) relies on this behavior. */ |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2400 ; |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2401 else |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2402 { |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2403 /* Failure: we should go back to the end of this |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2404 not-quite-endcomment. */ |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2405 if (SYNTAX(c) != code) |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2406 /* It was a two-char Sendcomment. */ |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2407 INC_BOTH (from, from_byte); |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2408 goto leave; |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2409 } |
|
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2410 } |
|
27719
73926d5a4d9f
(Fforward_comment): Undo the previous change, since cc-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27698
diff
changeset
|
2411 else |
|
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2412 { |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2413 /* We have skipped one comment. */ |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2414 from = out_charpos, from_byte = out_bytepos; |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2415 break; |
|
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2416 } |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2417 } |
|
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
2418 else if (code != Swhitespace || quoted) |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2419 { |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2420 leave: |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2421 immediate_quit = 0; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2422 INC_BOTH (from, from_byte); |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2423 SET_PT_BOTH (from, from_byte); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2424 return Qnil; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2425 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2426 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2427 |
|
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2428 count1++; |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2429 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2430 |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2431 SET_PT_BOTH (from, from_byte); |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2432 immediate_quit = 0; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2433 return Qt; |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2434 } |
|
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2435 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2436 /* Return syntax code of character C if C is an ASCII character |
| 38047 | 2437 or `multibyte_symbol_p' is zero. Otherwise, return Ssymbol. */ |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2438 |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2439 #define SYNTAX_WITH_MULTIBYTE_CHECK(c) \ |
|
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2440 ((ASCII_CHAR_P (c) || !multibyte_symbol_p) \ |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2441 ? SYNTAX (c) : Ssymbol) |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2442 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2443 static Lisp_Object |
| 163 | 2444 scan_lists (from, count, depth, sexpflag) |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2445 register EMACS_INT from; |
|
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2446 EMACS_INT count, depth; |
|
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2447 int sexpflag; |
| 163 | 2448 { |
| 2449 Lisp_Object val; | |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2450 register EMACS_INT stop = count > 0 ? ZV : BEGV; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2451 register int c, c1; |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2452 int stringterm; |
| 163 | 2453 int quoted; |
| 2454 int mathexit = 0; | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2455 register enum syntaxcode code, temp_code; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2456 int min_depth = depth; /* Err out if depth gets less than this. */ |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2457 int comstyle = 0; /* style of comment encountered */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2458 int comnested = 0; /* whether the comment is nestable or not */ |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2459 EMACS_INT temp_pos; |
|
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2460 EMACS_INT last_good = from; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2461 int found; |
|
71740
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2462 EMACS_INT from_byte; |
|
df55df8eb062
(back_comment, scan_lists): Also use EMACS_INT for buffer positions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71739
diff
changeset
|
2463 EMACS_INT out_bytepos, out_charpos; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2464 int temp, dummy; |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2465 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; |
| 163 | 2466 |
| 2467 if (depth > 0) min_depth = 0; | |
| 2468 | |
|
23404
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2469 if (from > ZV) from = ZV; |
|
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2470 if (from < BEGV) from = BEGV; |
|
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2471 |
|
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2472 from_byte = CHAR_TO_BYTE (from); |
|
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2473 |
| 163 | 2474 immediate_quit = 1; |
| 2475 QUIT; | |
| 2476 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2477 SETUP_SYNTAX_TABLE (from, count); |
| 163 | 2478 while (count > 0) |
| 2479 { | |
| 2480 while (from < stop) | |
| 2481 { | |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2482 int comstart_first, prefix; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2483 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2484 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2485 code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2486 comstart_first = SYNTAX_COMSTART_FIRST (c); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2487 comnested = SYNTAX_COMMENT_NESTED (c); |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
2488 comstyle = SYNTAX_COMMENT_STYLE (c); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2489 prefix = SYNTAX_PREFIX (c); |
|
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2490 if (depth == min_depth) |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2491 last_good = from; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2492 INC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2493 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2494 if (from < stop && comstart_first |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
2495 && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
2496 SYNTAX_COMSTART_SECOND (c)) |
| 163 | 2497 && parse_sexp_ignore_comments) |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2498 { |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2499 /* we have encountered a comment start sequence and we |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2500 are ignoring all text inside comments. We must record |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2501 the comment style this sequence begins so that later, |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2502 only a comment end of the same style actually ends |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2503 the comment section */ |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2504 code = Scomment; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2505 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2506 comstyle = SYNTAX_COMMENT_STYLE (c1); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2507 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2508 INC_BOTH (from, from_byte); |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2509 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2510 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2511 |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2512 if (prefix) |
| 163 | 2513 continue; |
| 2514 | |
|
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
9863
diff
changeset
|
2515 switch (SWITCH_ENUM_CAST (code)) |
| 163 | 2516 { |
| 2517 case Sescape: | |
| 2518 case Scharquote: | |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2519 if (from == stop) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2520 goto lose; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2521 INC_BOTH (from, from_byte); |
| 163 | 2522 /* treat following character as a word constituent */ |
| 2523 case Sword: | |
| 2524 case Ssymbol: | |
| 2525 if (depth || !sexpflag) break; | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2526 /* This word counts as a sexp; return at end of it. */ |
| 163 | 2527 while (from < stop) |
| 2528 { | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2529 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2530 |
|
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2531 /* Some compilers can't handle this inside the switch. */ |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2532 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2533 temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2534 switch (temp) |
| 163 | 2535 { |
| 2536 case Scharquote: | |
| 2537 case Sescape: | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2538 INC_BOTH (from, from_byte); |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2539 if (from == stop) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2540 goto lose; |
| 163 | 2541 break; |
| 2542 case Sword: | |
| 2543 case Ssymbol: | |
| 2544 case Squote: | |
| 2545 break; | |
| 2546 default: | |
| 2547 goto done; | |
| 2548 } | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2549 INC_BOTH (from, from_byte); |
| 163 | 2550 } |
| 2551 goto done; | |
| 2552 | |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2553 case Scomment_fence: |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2554 comstyle = ST_COMMENT_STYLE; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2555 /* FALLTHROUGH */ |
| 163 | 2556 case Scomment: |
| 2557 if (!parse_sexp_ignore_comments) break; | |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2558 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2559 found = forw_comment (from, from_byte, stop, |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2560 comnested, comstyle, 0, |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2561 &out_charpos, &out_bytepos, &dummy); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2562 from = out_charpos, from_byte = out_bytepos; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2563 if (!found) |
| 163 | 2564 { |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2565 if (depth == 0) |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2566 goto done; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2567 goto lose; |
| 163 | 2568 } |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2569 INC_BOTH (from, from_byte); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2570 UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 163 | 2571 break; |
| 2572 | |
| 2573 case Smath: | |
| 2574 if (!sexpflag) | |
| 2575 break; | |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2576 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (from_byte)) |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2577 { |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2578 INC_BOTH (from, from_byte); |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2579 } |
| 163 | 2580 if (mathexit) |
| 2581 { | |
| 2582 mathexit = 0; | |
| 2583 goto close1; | |
| 2584 } | |
| 2585 mathexit = 1; | |
| 2586 | |
| 2587 case Sopen: | |
| 2588 if (!++depth) goto done; | |
| 2589 break; | |
| 2590 | |
| 2591 case Sclose: | |
| 2592 close1: | |
| 2593 if (!--depth) goto done; | |
| 2594 if (depth < min_depth) | |
| 71988 | 2595 xsignal3 (Qscan_error, |
| 2596 build_string ("Containing expression ends prematurely"), | |
| 2597 make_number (last_good), make_number (from)); | |
| 163 | 2598 break; |
| 2599 | |
| 2600 case Sstring: | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2601 case Sstring_fence: |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2602 temp_pos = dec_bytepos (from_byte); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2603 stringterm = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
| 163 | 2604 while (1) |
| 2605 { | |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2606 if (from >= stop) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2607 goto lose; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2608 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2609 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
34398
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2610 if (code == Sstring |
|
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2611 ? (c == stringterm |
|
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2612 && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2613 : SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring_fence) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2614 break; |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2615 |
|
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2616 /* Some compilers can't handle this inside the switch. */ |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2617 temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2618 switch (temp) |
| 163 | 2619 { |
| 2620 case Scharquote: | |
| 2621 case Sescape: | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2622 INC_BOTH (from, from_byte); |
| 163 | 2623 } |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2624 INC_BOTH (from, from_byte); |
| 163 | 2625 } |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2626 INC_BOTH (from, from_byte); |
| 163 | 2627 if (!depth && sexpflag) goto done; |
| 2628 break; | |
|
47872
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2629 default: |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2630 /* Ignore whitespace, punctuation, quote, endcomment. */ |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2631 break; |
| 163 | 2632 } |
| 2633 } | |
| 2634 | |
| 2635 /* Reached end of buffer. Error if within object, return nil if between */ | |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2636 if (depth) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2637 goto lose; |
| 163 | 2638 |
| 2639 immediate_quit = 0; | |
| 2640 return Qnil; | |
| 2641 | |
| 2642 /* End of object reached */ | |
| 2643 done: | |
| 2644 count--; | |
| 2645 } | |
| 2646 | |
| 2647 while (count < 0) | |
| 2648 { | |
| 2649 while (from > stop) | |
| 2650 { | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2651 DEC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2652 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2653 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2654 code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
|
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2655 if (depth == min_depth) |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2656 last_good = from; |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2657 comstyle = 0; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2658 comnested = SYNTAX_COMMENT_NESTED (c); |
|
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2659 if (code == Sendcomment) |
|
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2660 comstyle = SYNTAX_COMMENT_STYLE (c); |
| 163 | 2661 if (from > stop && SYNTAX_COMEND_SECOND (c) |
|
22486
a28020246db1
(skip_chars): Don't examine STRING before verifying that it is a string.
Richard M. Stallman <rms@gnu.org>
parents:
22432
diff
changeset
|
2662 && prev_char_comend_first (from, from_byte) |
| 163 | 2663 && parse_sexp_ignore_comments) |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2664 { |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2665 /* We must record the comment style encountered so that |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2666 later, we can match only the proper comment begin |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2667 sequence of the same style. */ |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2668 DEC_BOTH (from, from_byte); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2669 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2670 code = Sendcomment; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2671 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2672 comstyle = SYNTAX_COMMENT_STYLE (c1); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2673 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2674 } |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2675 |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2676 /* Quoting turns anything except a comment-ender |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
2677 into a word character. Note that this cannot be true |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2678 if we decremented FROM in the if-statement above. */ |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2679 if (code != Sendcomment && char_quoted (from, from_byte)) |
|
47872
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2680 { |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2681 DEC_BOTH (from, from_byte); |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2682 code = Sword; |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2683 } |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2684 else if (SYNTAX_PREFIX (c)) |
| 163 | 2685 continue; |
| 2686 | |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2687 switch (SWITCH_ENUM_CAST (code)) |
| 163 | 2688 { |
| 2689 case Sword: | |
| 2690 case Ssymbol: | |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2691 case Sescape: |
|
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2692 case Scharquote: |
| 163 | 2693 if (depth || !sexpflag) break; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2694 /* This word counts as a sexp; count object finished |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2695 after passing it. */ |
| 163 | 2696 while (from > stop) |
| 2697 { | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2698 temp_pos = from_byte; |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2699 if (! NILP (current_buffer->enable_multibyte_characters)) |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2700 DEC_POS (temp_pos); |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2701 else |
|
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2702 temp_pos--; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2703 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2704 c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2705 temp_code = SYNTAX_WITH_MULTIBYTE_CHECK (c1); |
|
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2706 /* Don't allow comment-end to be quoted. */ |
|
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2707 if (temp_code == Sendcomment) |
|
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2708 goto done2; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2709 quoted = char_quoted (from - 1, temp_pos); |
| 163 | 2710 if (quoted) |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2711 { |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2712 DEC_BOTH (from, from_byte); |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2713 temp_pos = dec_bytepos (temp_pos); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2714 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2715 } |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2716 c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2717 temp_code = SYNTAX_WITH_MULTIBYTE_CHECK (c1); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2718 if (! (quoted || temp_code == Sword |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2719 || temp_code == Ssymbol |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2720 || temp_code == Squote)) |
| 163 | 2721 goto done2; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2722 DEC_BOTH (from, from_byte); |
| 163 | 2723 } |
| 2724 goto done2; | |
| 2725 | |
| 2726 case Smath: | |
| 2727 if (!sexpflag) | |
| 2728 break; | |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2729 temp_pos = dec_bytepos (from_byte); |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2730 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2731 if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2732 DEC_BOTH (from, from_byte); |
| 163 | 2733 if (mathexit) |
| 2734 { | |
| 2735 mathexit = 0; | |
| 2736 goto open2; | |
| 2737 } | |
| 2738 mathexit = 1; | |
| 2739 | |
| 2740 case Sclose: | |
| 2741 if (!++depth) goto done2; | |
| 2742 break; | |
| 2743 | |
| 2744 case Sopen: | |
| 2745 open2: | |
| 2746 if (!--depth) goto done2; | |
| 2747 if (depth < min_depth) | |
| 71988 | 2748 xsignal3 (Qscan_error, |
| 2749 build_string ("Containing expression ends prematurely"), | |
| 2750 make_number (last_good), make_number (from)); | |
| 163 | 2751 break; |
| 2752 | |
| 2753 case Sendcomment: | |
| 2754 if (!parse_sexp_ignore_comments) | |
| 2755 break; | |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2756 found = back_comment (from, from_byte, stop, comnested, comstyle, |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2757 &out_charpos, &out_bytepos); |
|
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2758 /* FIXME: if found == -1, then it really wasn't a comment-end. |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2759 For single-char Sendcomment, we can't do much about it apart |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2760 from skipping the char. |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2761 For 2-char endcomments, we could try again, taking both |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2762 chars as separate entities, but it's a lot of trouble |
|
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2763 for very little gain, so we don't bother either. -sm */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2764 if (found != -1) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2765 from = out_charpos, from_byte = out_bytepos; |
| 163 | 2766 break; |
| 2767 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2768 case Scomment_fence: |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2769 case Sstring_fence: |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2770 while (1) |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2771 { |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2772 if (from == stop) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2773 goto lose; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2774 DEC_BOTH (from, from_byte); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2775 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2776 if (!char_quoted (from, from_byte) |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2777 && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2778 SYNTAX_WITH_MULTIBYTE_CHECK (c) == code)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2779 break; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2780 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2781 if (code == Sstring_fence && !depth && sexpflag) goto done2; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2782 break; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2783 |
| 163 | 2784 case Sstring: |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2785 stringterm = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 163 | 2786 while (1) |
| 2787 { | |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2788 if (from == stop) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2789 goto lose; |
|
54849
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2790 DEC_BOTH (from, from_byte); |
|
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2791 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
|
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2792 if (!char_quoted (from, from_byte) |
| 89909 | 2793 && (stringterm |
| 2794 == (c = FETCH_CHAR_AS_MULTIBYTE (from_byte))) | |
|
34398
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2795 && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) |
| 163 | 2796 break; |
| 2797 } | |
| 2798 if (!depth && sexpflag) goto done2; | |
| 2799 break; | |
|
47872
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2800 default: |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2801 /* Ignore whitespace, punctuation, quote, endcomment. */ |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
2802 break; |
| 163 | 2803 } |
| 2804 } | |
| 2805 | |
| 2806 /* Reached start of buffer. Error if within object, return nil if between */ | |
|
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2807 if (depth) |
|
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2808 goto lose; |
| 163 | 2809 |
| 2810 immediate_quit = 0; | |
| 2811 return Qnil; | |
| 2812 | |
| 2813 done2: | |
| 2814 count++; | |
| 2815 } | |
| 2816 | |
| 2817 | |
| 2818 immediate_quit = 0; | |
|
9320
4be3f8f9f090
(Fcopy_syntax_table, Fmodify_syntax_entry, scan_lists, init_syntax_once):
Karl Heuer <kwzh@gnu.org>
parents:
9111
diff
changeset
|
2819 XSETFASTINT (val, from); |
| 163 | 2820 return val; |
| 2821 | |
| 2822 lose: | |
| 71988 | 2823 xsignal3 (Qscan_error, |
| 2824 build_string ("Unbalanced parentheses"), | |
| 2825 make_number (last_good), make_number (from)); | |
| 163 | 2826 } |
| 2827 | |
| 2828 DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2829 doc: /* Scan from character number FROM by COUNT lists. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2830 Returns the character number of the position thus found. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2831 |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2832 If DEPTH is nonzero, paren depth begins counting from that value, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2833 only places where the depth in parentheses becomes zero |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2834 are candidates for stopping; COUNT such places are counted. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2835 Thus, a positive value for DEPTH means go out levels. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2836 |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2837 Comments are ignored if `parse-sexp-ignore-comments' is non-nil. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2838 |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2839 If the beginning or end of (the accessible part of) the buffer is reached |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2840 and the depth is wrong, an error is signaled. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2841 If the depth is right but the count is not used up, nil is returned. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2842 (from, count, depth) |
| 163 | 2843 Lisp_Object from, count, depth; |
| 2844 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2845 CHECK_NUMBER (from); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2846 CHECK_NUMBER (count); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2847 CHECK_NUMBER (depth); |
| 163 | 2848 |
| 2849 return scan_lists (XINT (from), XINT (count), XINT (depth), 0); | |
| 2850 } | |
| 2851 | |
| 2852 DEFUN ("scan-sexps", Fscan_sexps, Sscan_sexps, 2, 2, 0, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2853 doc: /* Scan from character number FROM by COUNT balanced expressions. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2854 If COUNT is negative, scan backwards. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2855 Returns the character number of the position thus found. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2856 |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2857 Comments are ignored if `parse-sexp-ignore-comments' is non-nil. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2858 |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2859 If the beginning or end of (the accessible part of) the buffer is reached |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2860 in the middle of a parenthetical grouping, an error is signaled. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2861 If the beginning or end is reached between groupings |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2862 but before count is used up, nil is returned. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2863 (from, count) |
| 163 | 2864 Lisp_Object from, count; |
| 2865 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2866 CHECK_NUMBER (from); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2867 CHECK_NUMBER (count); |
| 163 | 2868 |
| 2869 return scan_lists (XINT (from), XINT (count), 0, 1); | |
| 2870 } | |
| 2871 | |
| 2872 DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2873 0, 0, 0, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2874 doc: /* Move point backward over any number of chars with prefix syntax. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2875 This includes chars with "quote" or "prefix" syntax (' or p). */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2876 () |
| 163 | 2877 { |
| 2878 int beg = BEGV; | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2879 int opoint = PT; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2880 int opoint_byte = PT_BYTE; |
|
16039
855c8d8ba0f0
Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents:
14661
diff
changeset
|
2881 int pos = PT; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2882 int pos_byte = PT_BYTE; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2883 int c; |
| 163 | 2884 |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2885 if (pos <= beg) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2886 { |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2887 SET_PT_BOTH (opoint, opoint_byte); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2888 |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2889 return Qnil; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2890 } |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2891 |
|
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2892 SETUP_SYNTAX_TABLE (pos, -1); |
|
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2893 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2894 DEC_BOTH (pos, pos_byte); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2895 |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2896 while (!char_quoted (pos, pos_byte) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2897 /* Previous statement updates syntax table. */ |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2898 && ((c = FETCH_CHAR_AS_MULTIBYTE (pos_byte), SYNTAX (c) == Squote) |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2899 || SYNTAX_PREFIX (c))) |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2900 { |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2901 opoint = pos; |
|
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2902 opoint_byte = pos_byte; |
|
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2903 |
|
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2904 if (pos + 1 > beg) |
|
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2905 DEC_BOTH (pos, pos_byte); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2906 } |
| 163 | 2907 |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2908 SET_PT_BOTH (opoint, opoint_byte); |
| 163 | 2909 |
| 2910 return Qnil; | |
| 2911 } | |
| 2912 | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2913 /* Parse forward from FROM / FROM_BYTE to END, |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2914 assuming that FROM has state OLDSTATE (nil means FROM is start of function), |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2915 and return a description of the state of the parse at END. |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
2916 If STOPBEFORE is nonzero, stop at the start of an atom. |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
2917 If COMMENTSTOP is 1, stop at the start of a comment. |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
2918 If COMMENTSTOP is -1, stop at the start or end of a comment, |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
2919 after the beginning of a string, or after the end of a string. */ |
| 163 | 2920 |
|
3720
408c7ee69be7
(scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents:
3684
diff
changeset
|
2921 static void |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2922 scan_sexps_forward (stateptr, from, from_byte, end, targetdepth, |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
2923 stopbefore, oldstate, commentstop) |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2924 struct lisp_parse_state *stateptr; |
| 163 | 2925 register int from; |
|
88935
49128e8e5ebb
(scan_sexps_forward): Declare an arg.
Dave Love <fx@gnu.org>
parents:
88389
diff
changeset
|
2926 int from_byte; |
| 163 | 2927 int end, targetdepth, stopbefore; |
| 2928 Lisp_Object oldstate; | |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
2929 int commentstop; |
| 163 | 2930 { |
| 2931 struct lisp_parse_state state; | |
| 2932 | |
| 2933 register enum syntaxcode code; | |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2934 int c1; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2935 int comnested; |
| 163 | 2936 struct level { int last, prev; }; |
| 2937 struct level levelstart[100]; | |
| 2938 register struct level *curlevel = levelstart; | |
| 2939 struct level *endlevel = levelstart + 100; | |
| 2940 register int depth; /* Paren depth of current scanning location. | |
| 2941 level - levelstart equals this except | |
| 2942 when the depth becomes negative. */ | |
| 2943 int mindepth; /* Lowest DEPTH value seen. */ | |
| 2944 int start_quoted = 0; /* Nonzero means starting after a char quote */ | |
| 2945 Lisp_Object tem; | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2946 int prev_from; /* Keep one character before FROM. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2947 int prev_from_byte; |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2948 int prev_from_syntax; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2949 int boundary_stop = commentstop == -1; |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2950 int nofence; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2951 int found; |
|
71867
c8c21ddb276e
(scan_sexps_forward): Use EMACS_INT for out_bytepos and
Andreas Schwab <schwab@suse.de>
parents:
71843
diff
changeset
|
2952 EMACS_INT out_bytepos, out_charpos; |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2953 int temp; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2954 |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2955 prev_from = from; |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2956 prev_from_byte = from_byte; |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2957 if (from != BEGV) |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2958 DEC_BOTH (prev_from, prev_from_byte); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2959 |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2960 /* Use this macro instead of `from++'. */ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2961 #define INC_FROM \ |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2962 do { prev_from = from; \ |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2963 prev_from_byte = from_byte; \ |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
2964 temp = FETCH_CHAR_AS_MULTIBYTE (prev_from_byte); \ |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
2965 prev_from_syntax = SYNTAX_WITH_FLAGS (temp); \ |
|
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2966 INC_BOTH (from, from_byte); \ |
|
48266
a404c0056619
(scan_sexps_forward): Undo last patch.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48236
diff
changeset
|
2967 if (from < end) \ |
|
a404c0056619
(scan_sexps_forward): Undo last patch.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48236
diff
changeset
|
2968 UPDATE_SYNTAX_TABLE_FORWARD (from); \ |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2969 } while (0) |
| 163 | 2970 |
| 2971 immediate_quit = 1; | |
| 2972 QUIT; | |
| 2973 | |
| 485 | 2974 if (NILP (oldstate)) |
| 163 | 2975 { |
| 2976 depth = 0; | |
| 2977 state.instring = -1; | |
| 2978 state.incomment = 0; | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2979 state.comstyle = 0; /* comment style a by default. */ |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2980 state.comstr_start = -1; /* no comment/string seen. */ |
| 163 | 2981 } |
| 2982 else | |
| 2983 { | |
| 2984 tem = Fcar (oldstate); | |
| 485 | 2985 if (!NILP (tem)) |
| 163 | 2986 depth = XINT (tem); |
| 2987 else | |
| 2988 depth = 0; | |
| 2989 | |
| 2990 oldstate = Fcdr (oldstate); | |
| 2991 oldstate = Fcdr (oldstate); | |
| 2992 oldstate = Fcdr (oldstate); | |
| 2993 tem = Fcar (oldstate); | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2994 /* Check whether we are inside string_fence-style string: */ |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2995 state.instring = (!NILP (tem) |
|
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2996 ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE) |
|
26272
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
2997 : -1); |
| 163 | 2998 |
| 2999 oldstate = Fcdr (oldstate); | |
| 3000 tem = Fcar (oldstate); | |
|
26272
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
3001 state.incomment = (!NILP (tem) |
|
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
3002 ? (INTEGERP (tem) ? XINT (tem) : -1) |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3003 : 0); |
| 163 | 3004 |
| 3005 oldstate = Fcdr (oldstate); | |
| 3006 tem = Fcar (oldstate); | |
| 485 | 3007 start_quoted = !NILP (tem); |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3008 |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3009 /* if the eighth element of the list is nil, we are in comment |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3010 style a. If it is non-nil, we are in comment style b */ |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3011 oldstate = Fcdr (oldstate); |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3012 oldstate = Fcdr (oldstate); |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3013 tem = Fcar (oldstate); |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3014 state.comstyle = NILP (tem) ? 0 : (EQ (tem, Qsyntax_table) |
|
26272
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
3015 ? ST_COMMENT_STYLE : 1); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3016 |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3017 oldstate = Fcdr (oldstate); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3018 tem = Fcar (oldstate); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3019 state.comstr_start = NILP (tem) ? -1 : XINT (tem) ; |
|
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3020 oldstate = Fcdr (oldstate); |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3021 tem = Fcar (oldstate); |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3022 while (!NILP (tem)) /* >= second enclosing sexps. */ |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3023 { |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3024 /* curlevel++->last ran into compiler bug on Apollo */ |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3025 curlevel->last = XINT (Fcar (tem)); |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3026 if (++curlevel == endlevel) |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
3027 curlevel--; /* error ("Nesting too deep for parser"); */ |
|
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3028 curlevel->prev = -1; |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3029 curlevel->last = -1; |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3030 tem = Fcdr (tem); |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3031 } |
| 163 | 3032 } |
| 3033 state.quoted = 0; | |
| 3034 mindepth = depth; | |
| 3035 | |
| 3036 curlevel->prev = -1; | |
| 3037 curlevel->last = -1; | |
| 3038 | |
|
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3039 SETUP_SYNTAX_TABLE (prev_from, 1); |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
3040 temp = FETCH_CHAR (prev_from_byte); |
|
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
3041 prev_from_syntax = SYNTAX_WITH_FLAGS (temp); |
|
48266
a404c0056619
(scan_sexps_forward): Undo last patch.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48236
diff
changeset
|
3042 UPDATE_SYNTAX_TABLE_FORWARD (from); |
|
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3043 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3044 /* Enter the loop at a place appropriate for initial state. */ |
| 163 | 3045 |
|
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3046 if (state.incomment) |
|
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3047 goto startincomment; |
| 163 | 3048 if (state.instring >= 0) |
| 3049 { | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3050 nofence = state.instring != ST_STRING_STYLE; |
|
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3051 if (start_quoted) |
|
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3052 goto startquotedinstring; |
| 163 | 3053 goto startinstring; |
| 3054 } | |
|
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3055 else if (start_quoted) |
|
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3056 goto startquoted; |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3057 |
| 163 | 3058 while (from < end) |
| 3059 { | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3060 INC_FROM; |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3061 code = prev_from_syntax & 0xff; |
|
18491
bf0d449581c8
(scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents:
18113
diff
changeset
|
3062 |
|
57756
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3063 if (from < end |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3064 && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3065 && (c1 = FETCH_CHAR (from_byte), |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3066 SYNTAX_COMSTART_SECOND (c1))) |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3067 /* Duplicate code to avoid a complex if-expression |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3068 which causes trouble for the SGI compiler. */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3069 { |
|
57756
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3070 /* Record the comment style we have entered so that only |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3071 the comment-end sequence of the same style actually |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3072 terminates the comment section. */ |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3073 state.comstyle = SYNTAX_COMMENT_STYLE (c1); |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3074 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3075 comnested = comnested || SYNTAX_COMMENT_NESTED (c1); |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3076 state.incomment = comnested ? 1 : -1; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3077 state.comstr_start = prev_from; |
|
57756
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3078 INC_FROM; |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3079 code = Scomment; |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3080 } |
|
18491
bf0d449581c8
(scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents:
18113
diff
changeset
|
3081 else if (code == Scomment_fence) |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3082 { |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3083 /* Record the comment style we have entered so that only |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3084 the comment-end sequence of the same style actually |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3085 terminates the comment section. */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3086 state.comstyle = ST_COMMENT_STYLE; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3087 state.incomment = -1; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3088 state.comstr_start = prev_from; |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3089 code = Scomment; |
|
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3090 } |
|
57756
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3091 else if (code == Scomment) |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3092 { |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3093 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax); |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3094 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3095 1 : -1); |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3096 state.comstr_start = prev_from; |
|
a8bc01ac68d0
(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56724
diff
changeset
|
3097 } |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3098 |
|
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3099 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) |
| 163 | 3100 continue; |
|
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
9863
diff
changeset
|
3101 switch (SWITCH_ENUM_CAST (code)) |
| 163 | 3102 { |
| 3103 case Sescape: | |
| 3104 case Scharquote: | |
| 3105 if (stopbefore) goto stop; /* this arg means stop at sexp start */ | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3106 curlevel->last = prev_from; |
| 163 | 3107 startquoted: |
| 3108 if (from == end) goto endquoted; | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3109 INC_FROM; |
| 163 | 3110 goto symstarted; |
| 3111 /* treat following character as a word constituent */ | |
| 3112 case Sword: | |
| 3113 case Ssymbol: | |
| 3114 if (stopbefore) goto stop; /* this arg means stop at sexp start */ | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3115 curlevel->last = prev_from; |
| 163 | 3116 symstarted: |
| 3117 while (from < end) | |
| 3118 { | |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3119 /* Some compilers can't handle this inside the switch. */ |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
3120 temp = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
3121 temp = SYNTAX (temp); |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3122 switch (temp) |
| 163 | 3123 { |
| 3124 case Scharquote: | |
| 3125 case Sescape: | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3126 INC_FROM; |
| 163 | 3127 if (from == end) goto endquoted; |
| 3128 break; | |
| 3129 case Sword: | |
| 3130 case Ssymbol: | |
| 3131 case Squote: | |
| 3132 break; | |
| 3133 default: | |
| 3134 goto symdone; | |
| 3135 } | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3136 INC_FROM; |
| 163 | 3137 } |
| 3138 symdone: | |
| 3139 curlevel->prev = curlevel->last; | |
| 3140 break; | |
| 3141 | |
|
47872
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
3142 case Scomment_fence: /* Can't happen because it's handled above. */ |
|
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3143 case Scomment: |
|
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3144 if (commentstop || boundary_stop) goto done; |
|
9475
c15caadae3c4
(scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents:
9411
diff
changeset
|
3145 startincomment: |
|
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3146 /* The (from == BEGV) test was to enter the loop in the middle so |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3147 that we find a 2-char comment ender even if we start in the |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
3148 middle of it. We don't want to do that if we're just at the |
|
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3149 beginning of the comment (think of (*) ... (*)). */ |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3150 found = forw_comment (from, from_byte, end, |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3151 state.incomment, state.comstyle, |
|
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
3152 (from == BEGV || from < state.comstr_start + 3) |
|
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
3153 ? 0 : prev_from_syntax, |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3154 &out_charpos, &out_bytepos, &state.incomment); |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3155 from = out_charpos; from_byte = out_bytepos; |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3156 /* Beware! prev_from and friends are invalid now. |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3157 Luckily, the `done' doesn't use them and the INC_FROM |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3158 sets them to a sane value without looking at them. */ |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3159 if (!found) goto done; |
|
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3160 INC_FROM; |
| 163 | 3161 state.incomment = 0; |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3162 state.comstyle = 0; /* reset the comment style */ |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3163 if (boundary_stop) goto done; |
| 163 | 3164 break; |
| 3165 | |
| 3166 case Sopen: | |
| 3167 if (stopbefore) goto stop; /* this arg means stop at sexp start */ | |
| 3168 depth++; | |
| 3169 /* curlevel++->last ran into compiler bug on Apollo */ | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3170 curlevel->last = prev_from; |
| 163 | 3171 if (++curlevel == endlevel) |
|
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
3172 curlevel--; /* error ("Nesting too deep for parser"); */ |
| 163 | 3173 curlevel->prev = -1; |
| 3174 curlevel->last = -1; | |
|
12894
b2a75405de3c
(scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12870
diff
changeset
|
3175 if (targetdepth == depth) goto done; |
| 163 | 3176 break; |
| 3177 | |
| 3178 case Sclose: | |
| 3179 depth--; | |
| 3180 if (depth < mindepth) | |
| 3181 mindepth = depth; | |
| 3182 if (curlevel != levelstart) | |
| 3183 curlevel--; | |
| 3184 curlevel->prev = curlevel->last; | |
|
12894
b2a75405de3c
(scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12870
diff
changeset
|
3185 if (targetdepth == depth) goto done; |
| 163 | 3186 break; |
| 3187 | |
| 3188 case Sstring: | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3189 case Sstring_fence: |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3190 state.comstr_start = from - 1; |
| 163 | 3191 if (stopbefore) goto stop; /* this arg means stop at sexp start */ |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3192 curlevel->last = prev_from; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3193 state.instring = (code == Sstring |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
3194 ? (FETCH_CHAR_AS_MULTIBYTE (prev_from_byte)) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3195 : ST_STRING_STYLE); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3196 if (boundary_stop) goto done; |
| 163 | 3197 startinstring: |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3198 { |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3199 nofence = state.instring != ST_STRING_STYLE; |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3200 |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3201 while (1) |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3202 { |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3203 int c; |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3204 |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3205 if (from >= end) goto done; |
|
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
3206 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3207 /* Some compilers can't handle this inside the switch. */ |
|
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3208 temp = SYNTAX (c); |
|
24148
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3209 |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3210 /* Check TEMP here so that if the char has |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3211 a syntax-table property which says it is NOT |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3212 a string character, it does not end the string. */ |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3213 if (nofence && c == state.instring && temp == Sstring) |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3214 break; |
|
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3215 |
|
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3216 switch (temp) |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3217 { |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3218 case Sstring_fence: |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3219 if (!nofence) goto string_end; |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3220 break; |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3221 case Scharquote: |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3222 case Sescape: |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3223 INC_FROM; |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3224 startquotedinstring: |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3225 if (from >= end) goto endquoted; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3226 } |
|
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3227 INC_FROM; |
|
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3228 } |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3229 } |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3230 string_end: |
| 163 | 3231 state.instring = -1; |
| 3232 curlevel->prev = curlevel->last; | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3233 INC_FROM; |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3234 if (boundary_stop) goto done; |
| 163 | 3235 break; |
| 3236 | |
| 3237 case Smath: | |
|
47872
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
3238 /* FIXME: We should do something with it. */ |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
3239 break; |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
3240 default: |
|
e5d59debb925
(scan_lists): Don't get fooled by a symbol ending with a backslash-quoted char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46555
diff
changeset
|
3241 /* Ignore whitespace, punctuation, quote, endcomment. */ |
| 163 | 3242 break; |
| 3243 } | |
| 3244 } | |
| 3245 goto done; | |
| 3246 | |
| 3247 stop: /* Here if stopping before start of sexp. */ | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3248 from = prev_from; /* We have just fetched the char that starts it; */ |
| 163 | 3249 goto done; /* but return the position before it. */ |
| 3250 | |
| 3251 endquoted: | |
| 3252 state.quoted = 1; | |
| 3253 done: | |
| 3254 state.depth = depth; | |
| 3255 state.mindepth = mindepth; | |
| 3256 state.thislevelstart = curlevel->prev; | |
| 3257 state.prevlevelstart | |
| 3258 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; | |
| 3259 state.location = from; | |
|
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3260 state.levelstarts = Qnil; |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3261 while (--curlevel >= levelstart) |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3262 state.levelstarts = Fcons (make_number (curlevel->last), |
|
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3263 state.levelstarts); |
| 163 | 3264 immediate_quit = 0; |
| 3265 | |
|
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3266 *stateptr = state; |
| 163 | 3267 } |
| 3268 | |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
3269 DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3270 doc: /* Parse Lisp syntax starting at FROM until TO; return status of parse at TO. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3271 Parsing stops at TO or when certain criteria are met; |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3272 point is set to where parsing stops. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3273 If fifth arg OLDSTATE is omitted or nil, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3274 parsing assumes that FROM is the beginning of a function. |
|
66525
aaac09f838e0
(Fparse_partial_sexp): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65215
diff
changeset
|
3275 Value is a list of elements describing final state of parsing: |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3276 0. depth in parens. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3277 1. character address of start of innermost containing list; nil if none. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3278 2. character address of start of last complete sexp terminated. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3279 3. non-nil if inside a string. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3280 (it is the character that will terminate the string, |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3281 or t if the string should be terminated by a generic string delimiter.) |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3282 4. nil if outside a comment, t if inside a non-nestable comment, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3283 else an integer (the current comment nesting). |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3284 5. t if following a quote character. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3285 6. the minimum paren-depth encountered during this scan. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3286 7. t if in a comment of style b; symbol `syntax-table' if the comment |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3287 should be terminated by a generic comment delimiter. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3288 8. character address of start of comment or string; nil if not in one. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3289 9. Intermediate data for continuation of parsing (subject to change). |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3290 If third arg TARGETDEPTH is non-nil, parsing stops if the depth |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3291 in parentheses becomes equal to TARGETDEPTH. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3292 Fourth arg STOPBEFORE non-nil means stop when come to |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3293 any character that starts a sexp. |
|
66525
aaac09f838e0
(Fparse_partial_sexp): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65215
diff
changeset
|
3294 Fifth arg OLDSTATE is a list like what this function returns. |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3295 It is used to initialize the state of the parse. Elements number 1, 2, 6 |
|
74542
31287a59d704
* syntax.c (Fpartial_parse_sexp): Correct Docco: Elt 8 of the
Alan Mackenzie <acm@muc.de>
parents:
74145
diff
changeset
|
3296 and 8 are ignored. |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3297 Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3298 If it is symbol `syntax-table', stop after the start of a comment or a |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3299 string, or after end of a comment or a string. */) |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3300 (from, to, targetdepth, stopbefore, oldstate, commentstop) |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
3301 Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop; |
| 163 | 3302 { |
| 3303 struct lisp_parse_state state; | |
| 3304 int target; | |
| 3305 | |
| 485 | 3306 if (!NILP (targetdepth)) |
| 163 | 3307 { |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
3308 CHECK_NUMBER (targetdepth); |
| 163 | 3309 target = XINT (targetdepth); |
| 3310 } | |
| 3311 else | |
| 3312 target = -100000; /* We won't reach this depth */ | |
| 3313 | |
| 3314 validate_region (&from, &to); | |
|
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
3315 scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), |
|
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
3316 XINT (to), |
|
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
3317 target, !NILP (stopbefore), oldstate, |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3318 (NILP (commentstop) |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3319 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); |
| 163 | 3320 |
| 3321 SET_PT (state.location); | |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3322 |
| 163 | 3323 return Fcons (make_number (state.depth), |
| 3324 Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart), | |
| 3325 Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart), | |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3326 Fcons (state.instring >= 0 |
|
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3327 ? (state.instring == ST_STRING_STYLE |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3328 ? Qt : make_number (state.instring)) : Qnil, |
|
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3329 Fcons (state.incomment < 0 ? Qt : |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3330 (state.incomment == 0 ? Qnil : |
|
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3331 make_number (state.incomment)), |
| 163 | 3332 Fcons (state.quoted ? Qt : Qnil, |
|
20486
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3333 Fcons (make_number (state.mindepth), |
|
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3334 Fcons ((state.comstyle |
|
20486
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3335 ? (state.comstyle == ST_COMMENT_STYLE |
|
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3336 ? Qsyntax_table : Qt) : |
|
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3337 Qnil), |
|
24728
e94104cf5891
(Fparse_partial_sexp): Correct test for element 8 to be
Dave Love <fx@gnu.org>
parents:
24148
diff
changeset
|
3338 Fcons (((state.incomment |
|
e94104cf5891
(Fparse_partial_sexp): Correct test for element 8 to be
Dave Love <fx@gnu.org>
parents:
24148
diff
changeset
|
3339 || (state.instring >= 0)) |
|
20486
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3340 ? make_number (state.comstr_start) |
|
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3341 : Qnil), |
|
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3342 Fcons (state.levelstarts, Qnil)))))))))); |
| 163 | 3343 } |
| 3344 | |
| 21514 | 3345 void |
| 163 | 3346 init_syntax_once () |
| 3347 { | |
|
17126
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3348 register int i, c; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3349 Lisp_Object temp; |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3350 |
|
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3351 /* This has to be done here, before we call Fmake_char_table. */ |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3352 Qsyntax_table = intern ("syntax-table"); |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3353 staticpro (&Qsyntax_table); |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3354 |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3355 /* Intern this now in case it isn't already done. |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3356 Setting this variable twice is harmless. |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3357 But don't staticpro it here--that is done in alloc.c. */ |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3358 Qchar_table_extra_slots = intern ("char-table-extra-slots"); |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3359 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3360 /* Create objects which can be shared among syntax tables. */ |
|
34398
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
3361 Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil); |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3362 for (i = 0; i < XVECTOR (Vsyntax_code_object)->size; i++) |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3363 XVECTOR (Vsyntax_code_object)->contents[i] |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3364 = Fcons (make_number (i), Qnil); |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3365 |
|
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3366 /* Now we are ready to set up this property, so we can |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3367 create syntax tables. */ |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3368 Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); |
|
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3369 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3370 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3371 |
|
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3372 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); |
| 163 | 3373 |
|
71395
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3374 /* Control characters should not be whitespace. */ |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3375 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3376 for (i = 0; i <= ' ' - 1; i++) |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3377 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3378 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3379 |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3380 /* Except that a few really are whitespace. */ |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3381 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3382 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3383 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3384 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3385 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3386 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); |
|
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3387 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3388 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; |
| 163 | 3389 for (i = 'a'; i <= 'z'; i++) |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3390 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 163 | 3391 for (i = 'A'; i <= 'Z'; i++) |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3392 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
| 163 | 3393 for (i = '0'; i <= '9'; i++) |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3394 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3395 |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3396 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '$', temp); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3397 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '%', temp); |
| 163 | 3398 |
|
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3399 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '(', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3400 Fcons (make_number (Sopen), make_number (')'))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3401 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ')', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3402 Fcons (make_number (Sclose), make_number ('('))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3403 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '[', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3404 Fcons (make_number (Sopen), make_number (']'))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3405 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ']', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3406 Fcons (make_number (Sclose), make_number ('['))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3407 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '{', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3408 Fcons (make_number (Sopen), make_number ('}'))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3409 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3410 Fcons (make_number (Sclose), make_number ('{'))); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3411 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3412 Fcons (make_number ((int) Sstring), Qnil)); |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3413 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', |
|
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3414 Fcons (make_number ((int) Sescape), Qnil)); |
| 163 | 3415 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3416 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol]; |
| 163 | 3417 for (i = 0; i < 10; i++) |
|
17126
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3418 { |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3419 c = "_-+*/&|<>="[i]; |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3420 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3421 } |
| 163 | 3422 |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3423 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; |
| 163 | 3424 for (i = 0; i < 12; i++) |
|
17126
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3425 { |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3426 c = ".,;:?!#@~^'`"[i]; |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3427 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); |
|
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3428 } |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3429 |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3430 /* All multibyte characters have syntax `word' by default. */ |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3431 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; |
|
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
3432 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); |
| 163 | 3433 } |
| 3434 | |
| 21514 | 3435 void |
| 163 | 3436 syms_of_syntax () |
| 3437 { | |
| 3438 Qsyntax_table_p = intern ("syntax-table-p"); | |
| 3439 staticpro (&Qsyntax_table_p); | |
| 3440 | |
|
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3441 staticpro (&Vsyntax_code_object); |
|
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3442 |
|
64319
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3443 staticpro (&gl_state.object); |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3444 staticpro (&gl_state.global_code); |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3445 staticpro (&gl_state.current_syntax_table); |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3446 staticpro (&gl_state.old_prop); |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3447 |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3448 /* Defined in regex.c */ |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3449 staticpro (&re_match_object); |
|
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3450 |
|
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3451 Qscan_error = intern ("scan-error"); |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3452 staticpro (&Qscan_error); |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3453 Fput (Qscan_error, Qerror_conditions, |
|
23503
ce7900230b17
(syms_of_syntax): Fix the setup of Qscan_error.
Richard M. Stallman <rms@gnu.org>
parents:
23404
diff
changeset
|
3454 Fcons (Qscan_error, Fcons (Qerror, Qnil))); |
|
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3455 Fput (Qscan_error, Qerror_message, |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3456 build_string ("Scan error")); |
|
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3457 |
| 163 | 3458 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3459 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); |
| 163 | 3460 |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3461 DEFVAR_BOOL ("parse-sexp-lookup-properties", &parse_sexp_lookup_properties, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3462 doc: /* Non-nil means `forward-sexp', etc., obey `syntax-table' property. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3463 Otherwise, that text property is simply ignored. |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3464 See the info node `(elisp)Syntax Properties' for a description of the |
|
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3465 `syntax-table' property. */); |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3466 |
| 163 | 3467 words_include_escapes = 0; |
| 3468 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes, | |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3469 doc: /* Non-nil means `forward-word', etc., should treat escape chars part of words. */); |
| 163 | 3470 |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3471 DEFVAR_BOOL ("multibyte-syntax-as-symbol", &multibyte_syntax_as_symbol, |
|
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3472 doc: /* Non-nil means `scan-sexps' treats all multibyte characters as symbol. */); |
|
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3473 multibyte_syntax_as_symbol = 0; |
|
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3474 |
|
28302
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
3475 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
3476 &open_paren_in_column_0_is_defun_start, |
| 49551 | 3477 doc: /* *Non-nil means an open paren in column 0 denotes the start of a defun. */); |
|
28302
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
3478 open_paren_in_column_0_is_defun_start = 1; |
|
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
3479 |
| 89483 | 3480 |
| 3481 DEFVAR_LISP ("find-word-boundary-function-table", | |
| 3482 &Vfind_word_boundary_function_table, | |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3483 doc: /* |
| 89483 | 3484 Char table of functions to search for the word boundary. |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3485 Each function is called with two arguments; POS and LIMIT. |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3486 POS and LIMIT are character positions in the current buffer. |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3487 |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3488 If POS is less than LIMIT, POS is at the first character of a word, |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3489 and the return value of a function is a position after the last |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3490 character of that word. |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3491 |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3492 If POS is not less than LIMIT, POS is at the last character of a word, |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3493 and the return value of a function is a position at the first |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3494 character of that word. |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3495 |
|
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3496 In both cases, LIMIT bounds the search. */); |
| 89483 | 3497 Vfind_word_boundary_function_table = Fmake_char_table (Qnil, Qnil); |
|
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3498 |
| 163 | 3499 defsubr (&Ssyntax_table_p); |
| 3500 defsubr (&Ssyntax_table); | |
| 3501 defsubr (&Sstandard_syntax_table); | |
| 3502 defsubr (&Scopy_syntax_table); | |
| 3503 defsubr (&Sset_syntax_table); | |
| 3504 defsubr (&Schar_syntax); | |
|
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
3505 defsubr (&Smatching_paren); |
|
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
3506 defsubr (&Sstring_to_syntax); |
| 163 | 3507 defsubr (&Smodify_syntax_entry); |
|
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
3508 defsubr (&Sinternal_describe_syntax_value); |
| 163 | 3509 |
| 3510 defsubr (&Sforward_word); | |
| 3511 | |
|
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3512 defsubr (&Sskip_chars_forward); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3513 defsubr (&Sskip_chars_backward); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3514 defsubr (&Sskip_syntax_forward); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3515 defsubr (&Sskip_syntax_backward); |
|
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3516 |
|
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
3517 defsubr (&Sforward_comment); |
| 163 | 3518 defsubr (&Sscan_lists); |
| 3519 defsubr (&Sscan_sexps); | |
| 3520 defsubr (&Sbackward_prefix_chars); | |
| 3521 defsubr (&Sparse_partial_sexp); | |
| 3522 } | |
| 52401 | 3523 |
| 3524 /* arch-tag: 3e297b9f-088e-4b64-8f4c-fb0b3443e412 | |
| 3525 (do not change this comment) */ |
