Mercurial > emacs
annotate src/syntax.c @ 112316:2887524f362a
Include <getopt.h> not "getopt.h".
* ebrowse.c, emacsclient.c: Include <getopt.h>, not "getopt.h".
Since getopt.h is no longer in this directory, there's no point
using the form with double-quotes.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 09 Jan 2011 00:00:02 -0800 |
parents | ac49e05bfcf2 |
children | 417b1e4d63cd |
rev | line source |
---|---|
163 | 1 /* 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
|
2 Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001, |
106815 | 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
74563
diff
changeset
|
4 Free Software Foundation, Inc. |
163 | 5 |
6 This file is part of GNU Emacs. | |
7 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93546
diff
changeset
|
8 GNU Emacs is free software: you can redistribute it and/or modify |
163 | 9 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
|
10 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
|
11 (at your option) any later version. |
163 | 12 |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 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
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
163 | 20 |
21 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4458
diff
changeset
|
22 #include <config.h> |
163 | 23 #include <ctype.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105661
diff
changeset
|
24 #include <setjmp.h> |
163 | 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" |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
37 #include "category.h" |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
38 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
39 /* Then there are seven single-bit flags that have the following meanings: |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
40 1. This character is the first of a two-character comment-start sequence. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
41 2. This character is the second of a two-character comment-start sequence. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
42 3. This character is the first of a two-character comment-end sequence. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
43 4. This character is the second of a two-character comment-end sequence. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
44 5. This character is a prefix, for backward-prefix-chars. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
45 6. The char is part of a delimiter for comments of style "b". |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
46 7. This character is part of a nestable comment sequence. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
47 8. The char is part of a delimiter for comments of style "c". |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
48 Note that any two-character sequence whose first character has flag 1 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
49 and whose second character has flag 2 will be interpreted as a comment start. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
50 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
51 bit 6 and 8 are used to discriminate between different comment styles. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
52 Languages such as C++ allow two orthogonal syntax start/end pairs |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
53 and bit 6 is used to determine whether a comment-end or Scommentend |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
54 ends style a or b. Comment markers can start style a, b, c, or bc. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
55 Style a is always the default. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
56 For 2-char comment markers, the style b flag is only looked up on the second |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
57 char of the comment marker and on the first char of the comment ender. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
58 For style c (like to for the nested flag), the flag can be placed on any |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
59 one of the chars. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
60 */ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
61 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
62 /* These macros extract specific flags from an integer |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
63 that holds the syntax code and the flags. */ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
64 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
65 #define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
66 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
67 #define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
68 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
69 #define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
70 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
71 #define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
72 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
73 #define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
74 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
75 #define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
76 #define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
77 /* FLAGS should be the flags of the main char of the comment marker, e.g. |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
78 the second for comstart and the first for comend. */ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
79 #define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
80 (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
81 | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
82 | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags)) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
83 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
84 #define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
85 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
86 /* These macros extract a particular flag for a given character. */ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
87 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
88 #define SYNTAX_COMEND_FIRST(c) \ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
89 (SYNTAX_FLAGS_COMEND_FIRST (SYNTAX_WITH_FLAGS (c))) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
90 #define SYNTAX_PREFIX(c) (SYNTAX_FLAGS_PREFIX (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
|
91 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
92 /* 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
|
93 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
|
94 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
|
95 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
96 #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
|
97 #define ST_STRING_STYLE (256 + 2) |
163 | 98 |
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
99 Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error; |
163 | 100 |
101 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
|
102 int parse_sexp_lookup_properties; |
163 | 103 |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
104 /* 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
|
105 int multibyte_syntax_as_symbol; |
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
106 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
107 /* 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
|
108 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
|
109 only very temporarily. */ |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
110 Lisp_Object syntax_temp; |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
111 |
28302
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
112 /* 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
|
113 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
|
114 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
|
115 |
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
116 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
|
117 |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
118 /* 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
|
119 |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
120 struct lisp_parse_state |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
121 { |
96988
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
122 int depth; /* Depth at end of parsing. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
123 int instring; /* -1 if not within string, else desired terminator. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
124 int incomment; /* -1 if in unnestable comment else comment nesting */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
125 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
126 int quoted; /* Nonzero if just after an escape char at end of parsing */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
127 int mindepth; /* Minimum depth seen while scanning. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
128 /* Char number of most recent start-of-expression at current level */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
129 EMACS_INT thislevelstart; |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
130 /* Char number of start of containing expression */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
131 EMACS_INT prevlevelstart; |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
132 EMACS_INT location; /* Char number at which parsing stopped. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
133 EMACS_INT comstr_start; /* Position of last comment/string starter. */ |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
134 Lisp_Object levelstarts; /* Char numbers of starts-of-expression |
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
135 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
|
136 }; |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
137 |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
138 /* 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
146 static EMACS_INT find_start_pos; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
147 static EMACS_INT find_start_value; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
148 static EMACS_INT find_start_value_byte; |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
149 static struct buffer *find_start_buffer; |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
150 static EMACS_INT find_start_begv; |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
151 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
|
152 |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
153 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
154 static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
155 static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
156 static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
157 static void scan_sexps_forward (struct lisp_parse_state *, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
158 EMACS_INT, EMACS_INT, EMACS_INT, int, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
159 int, Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108246
diff
changeset
|
160 static int in_classes (int, Lisp_Object); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
161 |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
162 /* Whether the syntax of the character C has the prefix flag set. */ |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
163 int syntax_prefix_flag_p (int c) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
164 { |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
165 return SYNTAX_PREFIX (c); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
166 } |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
167 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
168 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
|
169 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
170 #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
|
171 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
|
172 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
173 /* 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
|
174 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
|
175 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
|
176 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
|
177 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
178 `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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 start/end of OBJECT. */ |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
185 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
186 void |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
187 update_syntax_table (EMACS_INT charpos, int count, int init, |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
188 Lisp_Object object) |
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 Lisp_Object tmp_table; |
25771
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
191 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
|
192 INTERVAL i; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
193 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
194 if (init) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
195 { |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
196 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
|
197 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
|
198 gl_state.stop = gl_state.e_property; |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
199 i = interval_of (charpos, object); |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
200 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
|
201 invalidate = 0; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
202 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
|
203 return; |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
204 /* 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
|
205 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
|
206 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
|
207 { |
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
208 if (AM_RIGHT_CHILD (i)) |
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
209 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
|
210 - 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
|
211 - TOTAL_LENGTH (INTERVAL_PARENT (i)) |
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
212 + 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
|
213 else |
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
214 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
|
215 + TOTAL_LENGTH (i); |
28269
fd13be8ae190
Changes towards better type safety regarding intervals, primarily
Ken Raeburn <raeburn@raeburn.org>
parents:
27812
diff
changeset
|
216 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
|
217 } |
ceb05db73a63
(update_syntax_table): Properly update `position' field of used intervals.
Richard M. Stallman <rms@gnu.org>
parents:
20956
diff
changeset
|
218 i = gl_state.forward_i; |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
219 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
|
220 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
|
221 goto update; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
222 } |
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
223 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
|
224 |
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
225 /* 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
|
226 or further off. */ |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
227 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
|
228 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
|
229 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
|
230 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
231 if (count > 0) |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
232 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
|
233 /* Update the interval. */ |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
234 i = update_interval (i, charpos); |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
235 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
|
236 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
237 invalidate = 0; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
238 gl_state.forward_i = i; |
20956
15d1b7bf1cd7
(update_syntax_table): Fix calculations using offset.
Karl Heuer <kwzh@gnu.org>
parents:
20905
diff
changeset
|
239 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
|
240 } |
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
241 } |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
242 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
|
243 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
244 if (count < 0) |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
245 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
|
246 /* Update the interval. */ |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
247 i = update_interval (i, charpos); |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
248 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
|
249 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
250 invalidate = 0; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
251 gl_state.backward_i = i; |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
252 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
|
253 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
254 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
255 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
256 update: |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
257 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
|
258 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
259 if (invalidate) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
260 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
|
261 |
37532
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
262 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
|
263 { /* with the same table => */ |
f14973be41f5
(update_syntax_table): Check that oldi has the same
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34398
diff
changeset
|
264 /* 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
|
265 if (count > 0) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
266 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
267 gl_state.backward_i = i; |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
268 gl_state.b_property = i->position - gl_state.offset; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
269 } |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
270 else |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
271 { |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
272 gl_state.forward_i = i; |
20956
15d1b7bf1cd7
(update_syntax_table): Fix calculations using offset.
Karl Heuer <kwzh@gnu.org>
parents:
20905
diff
changeset
|
273 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
|
274 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
275 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
276 |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
277 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
|
278 { |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
279 gl_state.current_syntax_table = tmp_table; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
280 gl_state.old_prop = tmp_table; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
281 if (EQ (Fsyntax_table_p (tmp_table), Qt)) |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
282 { |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
283 gl_state.use_global = 0; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
284 } |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
285 else if (CONSP (tmp_table)) |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
286 { |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
287 gl_state.use_global = 1; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
288 gl_state.global_code = tmp_table; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
289 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
290 else |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
291 { |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
292 gl_state.use_global = 0; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
293 gl_state.current_syntax_table = current_buffer->syntax_table; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
294 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
295 } |
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 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
|
298 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
299 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
|
300 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
301 if (count > 0) |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
302 { |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
303 gl_state.e_property = i->position - gl_state.offset; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
304 gl_state.forward_i = i; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
305 } |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
306 else |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
307 { |
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
308 gl_state.b_property |
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
309 = i->position + LENGTH (i) - gl_state.offset; |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
310 gl_state.backward_i = i; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
311 } |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
312 return; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
313 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
314 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
|
315 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
316 if (count > 0) |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
317 { |
65215
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
318 gl_state.e_property |
c37b7f6542ec
(update_syntax_table): Properly reproduce the special +1
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64770
diff
changeset
|
319 = 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
|
320 /* 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
|
321 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
|
322 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
|
323 + (NULL_INTERVAL_P (next_interval (i)) ? 1 : 0); |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
324 gl_state.forward_i = i; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
325 } |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
326 else |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
327 { |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
328 gl_state.b_property = i->position - gl_state.offset; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
329 gl_state.backward_i = i; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
330 } |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
331 return; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
332 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
333 cnt++; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
334 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
|
335 } |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
336 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
|
337 if (count > 0) |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
338 gl_state.e_property = gl_state.stop; |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
339 else |
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
340 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
|
341 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
342 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
343 /* 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
|
344 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
|
345 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
|
346 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
347 static int |
96988
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
348 char_quoted (EMACS_INT charpos, EMACS_INT bytepos) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
349 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
350 register enum syntaxcode code; |
96988
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
351 register EMACS_INT beg = BEGV; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
352 register int quoted = 0; |
96988
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
353 EMACS_INT orig = charpos; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
354 |
96898
6521e10c7e45
(char_quoted): Check "charpos > beg" before decrementing.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96838
diff
changeset
|
355 while (charpos > beg) |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
356 { |
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
357 int c; |
96898
6521e10c7e45
(char_quoted): Check "charpos > beg" before decrementing.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96838
diff
changeset
|
358 DEC_BOTH (charpos, bytepos); |
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
359 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
360 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
|
361 c = FETCH_CHAR_AS_MULTIBYTE (bytepos); |
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
362 code = SYNTAX (c); |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
363 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
|
364 break; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
365 |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
366 quoted = !quoted; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
367 } |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
368 |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
369 UPDATE_SYNTAX_TABLE (orig); |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
370 return quoted; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
371 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
372 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
373 /* 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
|
374 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
|
375 |
111640
8bd4a845ba2a
* src/xfaces.c (lookup_face): Make static.
Andreas Schwab <schwab@linux-m68k.org>
parents:
110551
diff
changeset
|
376 static INLINE EMACS_INT |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
377 dec_bytepos (EMACS_INT bytepos) |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
378 { |
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
379 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
|
380 return bytepos - 1; |
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
381 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
382 DEC_POS (bytepos); |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
383 return bytepos; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
384 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
385 |
105426
d0a6d64c3cfc
Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents:
105102
diff
changeset
|
386 /* Return a defun-start position before POS and not too far before. |
39195 | 387 It should be the last one before POS, or nearly the last. |
388 | |
389 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
|
390 only the beginning of the buffer is treated as a defun-start. |
39195 | 391 |
392 We record the information about where the scan started | |
393 and what its result was, so that another call in the same area | |
394 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
|
395 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
396 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
|
397 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
|
398 update the global data. */ |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
399 |
96988
77625aa3eac4
(struct lisp_parse_state, char_quoted, inc_bytepos)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96898
diff
changeset
|
400 static EMACS_INT |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
401 find_defun_start (EMACS_INT pos, EMACS_INT pos_byte) |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
402 { |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
403 EMACS_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
|
404 |
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
405 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
|
406 { |
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
407 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
|
408 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
|
409 } |
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
410 |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
411 /* 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
|
412 if (current_buffer == find_start_buffer |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
413 /* 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
|
414 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
|
415 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
|
416 && pos <= find_start_pos + 1000 |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
417 && pos >= find_start_value |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
418 && BEGV == find_start_begv |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
419 && MODIFF == find_start_modiff) |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
420 return find_start_value; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
421 |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
422 /* 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
|
423 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
|
424 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
425 /* 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
|
426 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
|
427 syntax-tables. */ |
107366
14ff9accfbd3
Cleanup setup of gl_state in various parts of the code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
428 SETUP_BUFFER_SYNTAX_TABLE (); |
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
429 while (PT > BEGV) |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
430 { |
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
431 int c; |
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
432 |
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
433 /* 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
|
434 defun-start. */ |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
435 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
|
436 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
|
437 { |
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
438 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
|
439 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
|
440 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
|
441 break; |
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
442 /* Now fallback to the default value. */ |
107366
14ff9accfbd3
Cleanup setup of gl_state in various parts of the code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
443 SETUP_BUFFER_SYNTAX_TABLE (); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
444 } |
51036
5a30d8fb640c
(find_defun_start): When open_paren_in_column_0_is_defun_start,
Richard M. Stallman <rms@gnu.org>
parents:
50697
diff
changeset
|
445 /* 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
|
446 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
|
447 } |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
448 |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
449 /* 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
|
450 find_start_value = PT; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
451 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
|
452 find_start_buffer = current_buffer; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
453 find_start_modiff = MODIFF; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
454 find_start_begv = BEGV; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
455 find_start_pos = pos; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
456 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
457 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
|
458 |
1167
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
459 return find_start_value; |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
460 } |
a9aeeaa9da8f
(scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents:
1085
diff
changeset
|
461 |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
462 /* 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
|
463 |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
464 static int |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
465 prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte) |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
466 { |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
467 int c, val; |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
468 |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
469 DEC_BOTH (pos, pos_byte); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
470 UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
471 c = FETCH_CHAR (pos_byte); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
472 val = SYNTAX_COMEND_FIRST (c); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
473 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
|
474 return val; |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
475 } |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
476 |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
477 /* 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
|
478 |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
479 /* static int |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
480 * prev_char_comstart_first (pos, pos_byte) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
481 * int pos, pos_byte; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
482 * { |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
483 * int c, val; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
484 * |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
485 * DEC_BOTH (pos, pos_byte); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
486 * UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
487 * c = FETCH_CHAR (pos_byte); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
488 * val = SYNTAX_COMSTART_FIRST (c); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
489 * UPDATE_SYNTAX_TABLE_FORWARD (pos + 1); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
490 * return val; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
491 * } */ |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
492 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
493 /* 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
|
494 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
|
495 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
|
496 |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
497 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
|
498 return -1 otherwise. |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
499 |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
500 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
|
501 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
|
502 |
f76b9c0ebc4b
(back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents:
20292
diff
changeset
|
503 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
|
504 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
|
505 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
506 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
507 back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
508 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
509 /* 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
|
510 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
|
511 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
|
512 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
|
513 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
|
514 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 /* 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
|
521 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
|
522 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
|
523 inside another comment). |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
524 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
|
525 int comment_lossage = 0; |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
526 EMACS_INT comment_end = from; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
527 EMACS_INT comment_end_byte = from_byte; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
528 EMACS_INT comstart_pos = 0; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
529 EMACS_INT comstart_byte; |
20766
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
530 /* 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
|
531 or 0 if we didn't come across it yet. */ |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
532 EMACS_INT defun_start = 0; |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
533 EMACS_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
|
534 register enum syntaxcode code; |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
535 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
|
536 int c; |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
537 int syntax = 0; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
538 |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
539 /* 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
|
540 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
|
541 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
|
542 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
543 /* 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
|
544 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
|
545 while (from != stop) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
546 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
547 EMACS_INT temp_byte; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
548 int prev_syntax, com2start, com2end; |
110530
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
549 int comstart; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
550 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
551 /* 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
|
552 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
|
553 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
|
554 |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
555 prev_syntax = syntax; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
556 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
557 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
|
558 code = SYNTAX (c); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
559 |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
560 /* Check for 2-char comment markers. */ |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
561 com2start = (SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
562 && SYNTAX_FLAGS_COMSTART_SECOND (prev_syntax) |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
563 && (comstyle |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
564 == SYNTAX_FLAGS_COMMENT_STYLE (prev_syntax, syntax)) |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
565 && (SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
566 || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
567 com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
568 && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); |
110530
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
569 comstart = (com2start || code == Scomment); |
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
570 |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
571 /* Nasty cases with overlapping 2-char comment markers: |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
572 - snmp-mode: -- c -- foo -- c -- |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
573 --- c -- |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
574 ------ c -- |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
575 - c-mode: *||* |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
576 |* *|* *| |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
577 |*| |* |*| |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
578 /// */ |
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 a 2-char comment sequence partly overlaps with another, |
110530
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
581 we don't try to be clever. E.g. |*| in C, or }% in modes that |
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
582 have %..\n and %{..}%. */ |
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
583 if (from > stop && (com2end || comstart)) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
584 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
585 EMACS_INT next = from, next_byte = from_byte; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
586 int next_c, next_syntax; |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
587 DEC_BOTH (next, next_byte); |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
588 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
|
589 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
|
590 next_syntax = SYNTAX_WITH_FLAGS (next_c); |
110530
2d0eee1a24b9
* src/syntax.c (back_comment): Detect the case where a 1-char comment
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
591 if (((comstart || comnested) |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
592 && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
593 && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
594 || ((com2end || comnested) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
595 && SYNTAX_FLAGS_COMSTART_SECOND (syntax) |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
596 && (comstyle |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
597 == SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_syntax)) |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
598 && SYNTAX_FLAGS_COMSTART_FIRST (next_syntax))) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
599 goto lossage; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
600 /* 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
|
601 } |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
602 |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
603 if (com2start && comstart_pos == 0) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
604 /* 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
|
605 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
|
606 need to consider it as a comment starter, |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
607 and the subsequent times as a comment ender. */ |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
608 com2end = 0; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
609 |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
610 /* 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
|
611 if (com2end) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
612 code = Sendcomment; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
613 else if (com2start) |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
614 code = Scomment; |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
615 /* Ignore comment starters of a different style. */ |
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
616 else if (code == Scomment |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
617 && (comstyle != SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
618 || 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
|
619 continue; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
620 |
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
621 /* 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
|
622 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
|
623 continue; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
624 |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
625 switch (code) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
626 { |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
627 case Sstring_fence: |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
628 case Scomment_fence: |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
629 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
|
630 case Sstring: |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
631 /* Track parity of quotes. */ |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
632 if (string_style == -1) |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
633 /* Entering a string. */ |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
634 string_style = c; |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
635 else if (string_style == c) |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
636 /* Leaving the string. */ |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
637 string_style = -1; |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
638 else |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
639 /* 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
|
640 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
|
641 string_lossage = 1; |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
642 break; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
643 |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
644 case Scomment: |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
645 /* 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
|
646 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
|
647 /* 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
|
648 Test case in Pascal: " { " a { " } */ |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
649 goto lossage; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
650 |
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
651 if (!comnested) |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
652 { |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
653 /* 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
|
654 comstart_pos = from; |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
655 comstart_byte = from_byte; |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
656 } |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
657 else if (--nesting <= 0) |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
658 /* 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 goto done; |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
664 break; |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
665 |
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
666 case Sendcomment: |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
667 if (SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == comstyle |
49971
afbb2d6d2f07
(back_comment): Only check nestedness of 2nd char if needed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
668 && ((com2end && SYNTAX_FLAGS_COMMENT_NESTED (prev_syntax)) |
32087
83ecc6bc4bc2
(prev_char_comstart_first): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32086
diff
changeset
|
669 || 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
|
670 /* 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
|
671 { |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
672 if (comnested) |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
673 nesting++; |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
674 else |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
675 /* 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
|
676 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
|
677 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
|
678 } |
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
679 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
|
680 /* 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
|
681 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
|
682 (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
|
683 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
|
684 lossage, which seems overkill. |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
685 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
|
686 { (* } *) */ |
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
687 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
|
688 break; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
689 |
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
690 case Sopen: |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
691 /* 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
|
692 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
|
693 && (from == stop |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
694 || (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
|
695 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
|
696 { |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
697 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
|
698 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
|
699 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
|
700 } |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
701 break; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
702 |
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
703 default: |
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
704 break; |
20766
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
705 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
706 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
707 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
708 if (comstart_pos == 0) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
709 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
710 from = comment_end; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
711 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
|
712 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
|
713 } |
31209
00943ea58fd1
(back_comment): Detect cases where a comment-starter is
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30626
diff
changeset
|
714 /* 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
|
715 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
|
716 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
|
717 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
718 from = comstart_pos; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
719 from_byte = comstart_byte; |
56720
7c89be334c1b
(back_comment): Fixup globals in all cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56719
diff
changeset
|
720 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
|
721 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
722 else |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
723 { |
29835
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
724 struct lisp_parse_state state; |
5dec8ee96c0c
(back_comment): Simplify string-parity counting (with
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29823
diff
changeset
|
725 lossage: |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
726 /* 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 /* 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
|
732 if (defun_start == 0) |
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
733 { |
92c662c4ab0e
(back_comment): Move the find_defun_start call
Richard M. Stallman <rms@gnu.org>
parents:
20704
diff
changeset
|
734 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
|
735 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
|
736 } |
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
737 do |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
738 { |
30156
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
739 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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 && 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
|
745 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
|
746 else |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
747 { |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
748 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
|
749 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
|
750 /* 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
|
751 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
|
752 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
|
753 { |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
754 /* 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
|
755 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
|
756 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
|
757 } |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
758 } |
f59021679260
(back_comment): Use one switch rather than a few `if's.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29835
diff
changeset
|
759 } 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
|
760 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
761 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
|
762 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
|
763 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
764 |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
765 done: |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
766 *charpos_ptr = from; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
767 *bytepos_ptr = from_byte; |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
768 |
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
769 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
|
770 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
771 |
163 | 772 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
|
773 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
|
774 Currently, any char-table counts as a syntax table. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
775 (Lisp_Object object) |
163 | 776 { |
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
777 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
|
778 && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table)) |
163 | 779 return Qt; |
780 return Qnil; | |
781 } | |
782 | |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
783 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
784 check_syntax_table (Lisp_Object obj) |
163 | 785 { |
71843
2d05f598fa85
(check_syntax_table): Use CHECK_TYPE.
Kim F. Storm <storm@cua.dk>
parents:
71787
diff
changeset
|
786 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
|
787 Qsyntax_table_p, obj); |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
788 } |
163 | 789 |
790 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
|
791 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
|
792 This is the one specified by the current buffer. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
793 (void) |
163 | 794 { |
795 return current_buffer->syntax_table; | |
796 } | |
797 | |
798 DEFUN ("standard-syntax-table", Fstandard_syntax_table, | |
799 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
|
800 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
|
801 This is the one used for new buffers. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
802 (void) |
163 | 803 { |
804 return Vstandard_syntax_table; | |
805 } | |
806 | |
807 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
|
808 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
|
809 It is a copy of the TABLE, which defaults to the standard syntax table. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
810 (Lisp_Object table) |
163 | 811 { |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
812 Lisp_Object copy; |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
813 |
485 | 814 if (!NILP (table)) |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
815 check_syntax_table (table); |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
816 else |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
817 table = Vstandard_syntax_table; |
163 | 818 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
819 copy = Fcopy_sequence (table); |
14661
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
820 |
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
821 /* 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
|
822 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
|
823 XCHAR_TABLE (copy)->defalt = Qnil; |
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
824 |
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
825 /* 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
|
826 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
|
827 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
|
828 if (NILP (XCHAR_TABLE (copy)->parent)) |
46ba65e7976c
(Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
829 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
|
830 return copy; |
163 | 831 } |
832 | |
833 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
|
834 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
|
835 One argument, a syntax table. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
836 (Lisp_Object table) |
163 | 837 { |
28313
cdb964ab44c3
(Fset_syntax_table): Use new macros for per-buffer
Gerd Moellmann <gerd@gnu.org>
parents:
28302
diff
changeset
|
838 int idx; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
839 check_syntax_table (table); |
163 | 840 current_buffer->syntax_table = table; |
841 /* Indicate that this buffer now has a specified syntax table. */ | |
28351 | 842 idx = PER_BUFFER_VAR_IDX (syntax_table); |
843 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); | |
163 | 844 return table; |
845 } | |
846 | |
847 /* Convert a letter which signifies a syntax code | |
848 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
|
849 This is used by modify-syntax-entry, and other things. */ |
163 | 850 |
851 unsigned char syntax_spec_code[0400] = | |
852 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
853 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
854 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
855 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
|
856 (char) Swhitespace, (char) Scomment_fence, (char) Sstring, 0377, |
163 | 857 (char) Smath, 0377, 0377, (char) Squote, |
858 (char) Sopen, (char) Sclose, 0377, 0377, | |
859 0377, (char) Swhitespace, (char) Spunct, (char) Scharquote, | |
860 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
861 0377, 0377, 0377, 0377, | |
862 (char) Scomment, 0377, (char) Sendcomment, 0377, | |
5442
8cbae747a768
(describe_syntax): Handle Sinherit.
Richard M. Stallman <rms@gnu.org>
parents:
5339
diff
changeset
|
863 (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */ |
163 | 864 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
865 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, | |
866 0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol, | |
867 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */ | |
868 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | |
869 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
|
870 0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377 |
163 | 871 }; |
872 | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
873 /* Indexed by syntax code, give the letter that describes it. */ |
163 | 874 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
875 char syntax_code_spec[16] = |
163 | 876 { |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
877 ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@', |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
878 '!', '|' |
163 | 879 }; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
880 |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
881 /* 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
|
882 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
|
883 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
|
884 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
|
885 compact listing. */ |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
886 static Lisp_Object Vsyntax_code_object; |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
887 |
163 | 888 |
889 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
|
890 doc: /* Return the syntax code of CHARACTER, described by a character. |
105102
7a2f279a2c8d
* syntax.c (Fchar_syntax): Minor doc fix (Bug#119).
Chong Yidong <cyd@stupidchicken.com>
parents:
102145
diff
changeset
|
891 For example, if CHARACTER is a word constituent, the |
7a2f279a2c8d
* syntax.c (Fchar_syntax): Minor doc fix (Bug#119).
Chong Yidong <cyd@stupidchicken.com>
parents:
102145
diff
changeset
|
892 character `w' (119) is returned. |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
893 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
|
894 are listed in the documentation of `modify-syntax-entry'. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
895 (Lisp_Object character) |
163 | 896 { |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
897 int char_int; |
108246
ea6ba19c6edd
* syntax.c (Fchar_syntax): Check the arg is a character.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107366
diff
changeset
|
898 CHECK_CHARACTER (character); |
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
899 char_int = XINT (character); |
107366
14ff9accfbd3
Cleanup setup of gl_state in various parts of the code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
900 SETUP_BUFFER_SYNTAX_TABLE (); |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
901 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
|
902 } |
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
903 |
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
904 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
|
905 doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
906 (Lisp_Object character) |
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
907 { |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
908 int char_int, code; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
909 CHECK_NUMBER (character); |
14087
1709d9f11c66
(Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents:
13513
diff
changeset
|
910 char_int = XINT (character); |
107366
14ff9accfbd3
Cleanup setup of gl_state in various parts of the code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
911 SETUP_BUFFER_SYNTAX_TABLE (); |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
912 code = SYNTAX (char_int); |
7975
49dc4ea976a0
(Fmatching_paren): Fix typo.
Richard M. Stallman <rms@gnu.org>
parents:
7968
diff
changeset
|
913 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
|
914 return SYNTAX_MATCH (char_int); |
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
915 return Qnil; |
163 | 916 } |
917 | |
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
918 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
|
919 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
|
920 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
|
921 `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
|
922 \(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
|
923 text property. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
924 (Lisp_Object string) |
163 | 925 { |
46555
35e66a0949b8
(Fstring_to_syntax, skip_chars): Treat Lisp string
Ken Raeburn <raeburn@raeburn.org>
parents:
46370
diff
changeset
|
926 register const unsigned char *p; |
163 | 927 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
|
928 int val; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
929 Lisp_Object match; |
163 | 930 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
931 CHECK_STRING (string); |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
932 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
41598
diff
changeset
|
933 p = SDATA (string); |
163 | 934 code = (enum syntaxcode) syntax_spec_code[*p++]; |
935 if (((int) code & 0377) == 0377) | |
63703
bb4ab751a6a3
(Fstring_to_syntax): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents:
58897
diff
changeset
|
936 error ("Invalid syntax description letter: %c", p[-1]); |
163 | 937 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
938 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
|
939 return Qnil; |
163 | 940 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
941 if (*p) |
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
942 { |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
943 int len; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
944 int character = STRING_CHAR_AND_LENGTH (p, len); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
945 XSETINT (match, character); |
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
946 if (XFASTINT (match) == ' ') |
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
947 match = Qnil; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
948 p += len; |
13513
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
949 } |
907544cb2c7d
(check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents:
13218
diff
changeset
|
950 else |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
951 match = Qnil; |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
952 |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
953 val = (int) code; |
163 | 954 while (*p) |
955 switch (*p++) | |
956 { | |
957 case '1': | |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
958 val |= 1 << 16; |
163 | 959 break; |
960 | |
961 case '2': | |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
962 val |= 1 << 17; |
163 | 963 break; |
964 | |
965 case '3': | |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
966 val |= 1 << 18; |
163 | 967 break; |
968 | |
969 case '4': | |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
970 val |= 1 << 19; |
163 | 971 break; |
972 | |
973 case 'p': | |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
974 val |= 1 << 20; |
163 | 975 break; |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
976 |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
977 case 'b': |
9333
925795f1a594
(Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9320
diff
changeset
|
978 val |= 1 << 21; |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
979 break; |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
980 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
981 case 'n': |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
982 val |= 1 << 22; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
983 break; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
984 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
985 case 'c': |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
986 val |= 1 << 23; |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
987 break; |
163 | 988 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
989 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
990 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
|
991 return XVECTOR (Vsyntax_code_object)->contents[val]; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
992 else |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
993 /* 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
|
994 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
|
995 } |
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
996 |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
997 /* I really don't know why this is interactive |
40286
0e7059267f7e
Fix comment ending.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40205
diff
changeset
|
998 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
|
999 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
|
1000 "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
|
1001 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
|
1002 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
|
1003 the current buffer's syntax table. |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1004 CHAR may be a cons (MIN . MAX), in which case, syntaxes of all characters |
100345
b814c7996a93
* syntax.c (Fmodify_syntax_entry): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
99020
diff
changeset
|
1005 in the range MIN to 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
|
1006 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
|
1007 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
|
1008 _ symbol constituent. . punctuation. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1009 ( 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
|
1010 " string quote. \\ escape. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1011 $ 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
|
1012 < 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
|
1013 / 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
|
1014 | generic string fence. ! generic comment fence. |
163 | 1015 |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1016 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
|
1017 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
|
1018 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
|
1019 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
|
1020 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
|
1021 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
|
1022 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
|
1023 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
|
1024 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
|
1025 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
|
1026 |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1027 There can be several orthogonal comment sequences. This is to support |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1028 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
|
1029 a, but you can set the comment sequence style to b (on the second character |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1030 of a comment-start, and the first character of a comment-end sequence) and/or |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1031 c (on any of its chars) using 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
|
1032 b means CHAR is part of comment sequence b. |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1033 c means CHAR is part of comment sequence c. |
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
|
1034 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
|
1035 |
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
|
1036 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
|
1037 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
|
1038 between expressions. |
100345
b814c7996a93
* syntax.c (Fmodify_syntax_entry): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
99020
diff
changeset
|
1039 usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1040 (Lisp_Object c, Lisp_Object newentry, Lisp_Object syntax_table) |
32506
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1041 { |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1042 if (CONSP (c)) |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1043 { |
89483 | 1044 CHECK_CHARACTER_CAR (c); |
1045 CHECK_CHARACTER_CDR (c); | |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1046 } |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1047 else |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1048 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
|
1049 |
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1050 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
|
1051 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
|
1052 else |
a85522b7799c
(Fstring_to_syntax): New function extracted from Fmodify_syntax_entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32496
diff
changeset
|
1053 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
|
1054 |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1055 newentry = Fstring_to_syntax (newentry); |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1056 if (CONSP (c)) |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1057 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
|
1058 else |
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1059 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
|
1060 |
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1061 /* 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
|
1062 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
|
1063 clear_regexp_cache (); |
d4ecc69b8d2e
* search.c (clear_regexp_cache): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
71988
diff
changeset
|
1064 |
163 | 1065 return Qnil; |
1066 } | |
1067 | |
1068 /* Dump syntax table to buffer in human-readable format */ | |
1069 | |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1070 DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1071 Sinternal_describe_syntax_value, 1, 1, 0, |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1072 doc: /* Insert a description of the internal syntax description SYNTAX at point. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1073 (Lisp_Object syntax) |
163 | 1074 { |
1075 register enum syntaxcode code; | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1076 int syntax_code; |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1077 char desc, start1, start2, end1, end2, prefix, |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1078 comstyleb, comstylec, comnested; |
163 | 1079 char str[2]; |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1080 Lisp_Object first, match_lisp, value = syntax; |
163 | 1081 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1082 if (NILP (value)) |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1083 { |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1084 insert_string ("default"); |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1085 return syntax; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1086 } |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1087 |
17109
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1088 if (CHAR_TABLE_P (value)) |
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1089 { |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1090 insert_string ("deeper char-table ..."); |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1091 return syntax; |
17109
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1092 } |
dfe4f98935c4
(describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents:
17044
diff
changeset
|
1093 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1094 if (!CONSP (value)) |
163 | 1095 { |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1096 insert_string ("invalid"); |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1097 return syntax; |
163 | 1098 } |
1099 | |
25663
a5eaace0fa01
Use XCAR and XCDR instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25659
diff
changeset
|
1100 first = XCAR (value); |
a5eaace0fa01
Use XCAR and XCDR instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25659
diff
changeset
|
1101 match_lisp = XCDR (value); |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1102 |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1103 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
|
1104 { |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1105 insert_string ("invalid"); |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1106 return syntax; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1107 } |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1108 |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1109 syntax_code = XINT (first); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1110 code = (enum syntaxcode) (syntax_code & 0377); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1111 start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1112 start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1113 end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1114 end2 = SYNTAX_FLAGS_COMEND_SECOND (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1115 prefix = SYNTAX_FLAGS_PREFIX (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1116 comstyleb = SYNTAX_FLAGS_COMMENT_STYLEB (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1117 comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1118 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code); |
163 | 1119 |
1120 if ((int) code < 0 || (int) code >= (int) Smax) | |
1121 { | |
1122 insert_string ("invalid"); | |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1123 return syntax; |
163 | 1124 } |
1125 desc = syntax_code_spec[(int) code]; | |
1126 | |
1127 str[0] = desc, str[1] = 0; | |
1128 insert (str, 1); | |
1129 | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1130 if (NILP (match_lisp)) |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1131 insert (" ", 1); |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1132 else |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1133 insert_char (XINT (match_lisp)); |
163 | 1134 |
1135 if (start1) | |
1136 insert ("1", 1); | |
1137 if (start2) | |
1138 insert ("2", 1); | |
1139 | |
1140 if (end1) | |
1141 insert ("3", 1); | |
1142 if (end2) | |
1143 insert ("4", 1); | |
1144 | |
1145 if (prefix) | |
1146 insert ("p", 1); | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1147 if (comstyleb) |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1148 insert ("b", 1); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1149 if (comstylec) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1150 insert ("c", 1); |
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1151 if (comnested) |
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1152 insert ("n", 1); |
163 | 1153 |
1154 insert_string ("\twhich means: "); | |
1155 | |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
9863
diff
changeset
|
1156 switch (SWITCH_ENUM_CAST (code)) |
163 | 1157 { |
1158 case Swhitespace: | |
1159 insert_string ("whitespace"); break; | |
1160 case Spunct: | |
1161 insert_string ("punctuation"); break; | |
1162 case Sword: | |
1163 insert_string ("word"); break; | |
1164 case Ssymbol: | |
1165 insert_string ("symbol"); break; | |
1166 case Sopen: | |
1167 insert_string ("open"); break; | |
1168 case Sclose: | |
1169 insert_string ("close"); break; | |
1170 case Squote: | |
32508
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1171 insert_string ("prefix"); break; |
163 | 1172 case Sstring: |
1173 insert_string ("string"); break; | |
1174 case Smath: | |
1175 insert_string ("math"); break; | |
1176 case Sescape: | |
1177 insert_string ("escape"); break; | |
1178 case Scharquote: | |
1179 insert_string ("charquote"); break; | |
1180 case Scomment: | |
1181 insert_string ("comment"); break; | |
1182 case Sendcomment: | |
1183 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
|
1184 case Sinherit: |
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1185 insert_string ("inherit"); break; |
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1186 case Scomment_fence: |
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1187 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
|
1188 case Sstring_fence: |
d371f8c371bd
(describe_syntax): Add code for comment and string fences.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32506
diff
changeset
|
1189 insert_string ("string fence"); break; |
163 | 1190 default: |
1191 insert_string ("invalid"); | |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1192 return syntax; |
163 | 1193 } |
1194 | |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1195 if (!NILP (match_lisp)) |
163 | 1196 { |
1197 insert_string (", matches "); | |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
1198 insert_char (XINT (match_lisp)); |
163 | 1199 } |
1200 | |
1201 if (start1) | |
1202 insert_string (",\n\t is the first character of a comment-start sequence"); | |
1203 if (start2) | |
1204 insert_string (",\n\t is the second character of a comment-start sequence"); | |
1205 | |
1206 if (end1) | |
1207 insert_string (",\n\t is the first character of a comment-end sequence"); | |
1208 if (end2) | |
1209 insert_string (",\n\t is the second character of a comment-end sequence"); | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1210 if (comstyleb) |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1211 insert_string (" (comment style b)"); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1212 if (comstylec) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
1213 insert_string (" (comment style c)"); |
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1214 if (comnested) |
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
1215 insert_string (" (nestable)"); |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
1216 |
163 | 1217 if (prefix) |
1218 insert_string (",\n\t is a prefix character for `backward-prefix-chars'"); | |
1219 | |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1220 return syntax; |
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
1221 } |
163 | 1222 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1223 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
|
1224 |
89483 | 1225 /* Char-table of functions that find the next or previous word |
1226 boundary. */ | |
1227 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
|
1228 |
163 | 1229 /* Return the position across COUNT words from FROM. |
1230 If that many words cannot be found before the end of the buffer, return 0. | |
1231 COUNT negative means scan backward and stop at word beginning. */ | |
1232 | |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1233 EMACS_INT |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1234 scan_words (register EMACS_INT from, register EMACS_INT count) |
163 | 1235 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1236 register EMACS_INT beg = BEGV; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1237 register EMACS_INT end = ZV; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1238 register EMACS_INT from_byte = CHAR_TO_BYTE (from); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1239 register enum syntaxcode code; |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1240 int ch0, ch1; |
89483 | 1241 Lisp_Object func, script, pos; |
163 | 1242 |
1243 immediate_quit = 1; | |
1244 QUIT; | |
1245 | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1246 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
|
1247 |
163 | 1248 while (count > 0) |
1249 { | |
1250 while (1) | |
1251 { | |
1252 if (from == end) | |
1253 { | |
1254 immediate_quit = 0; | |
1255 return 0; | |
1256 } | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1257 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
|
1258 ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1259 code = SYNTAX (ch0); |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1260 INC_BOTH (from, from_byte); |
163 | 1261 if (words_include_escapes |
1262 && (code == Sescape || code == Scharquote)) | |
1263 break; | |
1264 if (code == Sword) | |
1265 break; | |
1266 } | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1267 /* 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
|
1268 position of the next character. */ |
89483 | 1269 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
|
1270 if (! NILP (Ffboundp (func))) |
163 | 1271 { |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1272 pos = call2 (func, make_number (from - 1), make_number (end)); |
89483 | 1273 if (INTEGERP (pos) && XINT (pos) > from) |
1274 { | |
1275 from = XINT (pos); | |
1276 from_byte = CHAR_TO_BYTE (from); | |
1277 } | |
163 | 1278 } |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1279 else |
163 | 1280 { |
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1281 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
|
1282 while (1) |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1283 { |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1284 if (from == end) break; |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1285 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
|
1286 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
|
1287 code = SYNTAX (ch1); |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1288 if ((code != Sword |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1289 && (! words_include_escapes |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1290 || (code != Sescape && code != Scharquote))) |
99020
08af05537037
(scan_words): Call word_boundary_p instead of comparing
Kenichi Handa <handa@m17n.org>
parents:
96988
diff
changeset
|
1291 || word_boundary_p (ch0, ch1)) |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1292 break; |
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1293 INC_BOTH (from, from_byte); |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1294 ch0 = ch1; |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1295 } |
163 | 1296 } |
1297 count--; | |
1298 } | |
1299 while (count < 0) | |
1300 { | |
1301 while (1) | |
1302 { | |
1303 if (from == beg) | |
1304 { | |
1305 immediate_quit = 0; | |
1306 return 0; | |
1307 } | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1308 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
|
1309 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
|
1310 ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1311 code = SYNTAX (ch1); |
163 | 1312 if (words_include_escapes |
1313 && (code == Sescape || code == Scharquote)) | |
1314 break; | |
1315 if (code == Sword) | |
1316 break; | |
1317 } | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
1318 /* 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
|
1319 position of it. */ |
89483 | 1320 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
|
1321 if (! NILP (Ffboundp (func))) |
89483 | 1322 { |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1323 pos = call2 (func, make_number (from), make_number (beg)); |
89483 | 1324 if (INTEGERP (pos) && XINT (pos) < from) |
1325 { | |
1326 from = XINT (pos); | |
1327 from_byte = CHAR_TO_BYTE (from); | |
1328 } | |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1329 } |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
1330 else |
163 | 1331 { |
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1332 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
|
1333 while (1) |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1334 { |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1335 if (from == beg) |
77927
d15a774f9796
(scan_words): Fix arg to UPDATE_SYNTAX_TABLE_BACKWARD.
Chong Yidong <cyd@stupidchicken.com>
parents:
77757
diff
changeset
|
1336 break; |
90851 | 1337 DEC_BOTH (from, from_byte); |
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1338 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
90851 | 1339 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
|
1340 code = SYNTAX (ch0); |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1341 if ((code != Sword |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1342 && (! words_include_escapes |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1343 || (code != Sescape && code != Scharquote))) |
99020
08af05537037
(scan_words): Call word_boundary_p instead of comparing
Kenichi Handa <handa@m17n.org>
parents:
96988
diff
changeset
|
1344 || word_boundary_p (ch0, ch1)) |
90851 | 1345 { |
1346 INC_BOTH (from, from_byte); | |
1347 break; | |
1348 } | |
89010
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1349 ch1 = ch0; |
0b75ae2e80b1
(scan_words): Don't treat characters belonging to
Kenichi Handa <handa@m17n.org>
parents:
88970
diff
changeset
|
1350 } |
163 | 1351 } |
1352 count++; | |
1353 } | |
1354 | |
1355 immediate_quit = 0; | |
1356 | |
1357 return from; | |
1358 } | |
1359 | |
93546
45896a2e7bee
(Fforward_word): Add ^ interactive spec.
Chong Yidong <cyd@stupidchicken.com>
parents:
91806
diff
changeset
|
1360 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
|
1361 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
|
1362 Normally returns t. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1363 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
|
1364 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
|
1365 `inhibit-field-text-motion' is non-nil. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1366 (Lisp_Object arg) |
163 | 1367 { |
58897
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1368 Lisp_Object tmp; |
26391
216416ad34fe
(Fforward_word): Handle fields even if would have hit
Richard M. Stallman <rms@gnu.org>
parents:
26272
diff
changeset
|
1369 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
|
1370 |
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1371 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
|
1372 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
|
1373 else |
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1374 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
|
1375 |
d8341603541c
(Fforward_word): Argument changed to optional. Set default value to 1.
Richard M. Stallman <rms@gnu.org>
parents:
51036
diff
changeset
|
1376 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
|
1377 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
|
1378 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
|
1379 |
26060
6edf64bf5e22
(Fforward_word): Supply new ESCAPE_FROM_EDGE parameter
Gerd Moellmann <gerd@gnu.org>
parents:
25771
diff
changeset
|
1380 /* 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
|
1381 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
|
1382 Qt, Qnil, Qnil); |
98e94b29b59b
(Fforward_word): Avoid non-idempotent side-effects in macro arguments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57756
diff
changeset
|
1383 val = XFASTINT (tmp); |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
1384 |
163 | 1385 SET_PT (val); |
27079
638b309011d9
(Fforward_word): Notice field boundaries only if
Gerd Moellmann <gerd@gnu.org>
parents:
26526
diff
changeset
|
1386 return val == orig_val ? Qt : Qnil; |
163 | 1387 } |
1388 | |
109139
c25c24812fb1
Convert declarations or definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
1389 Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1390 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1391 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
|
1392 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
|
1393 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
|
1394 except that `]' is never special and `\\' quotes `^', `-' or `\\' |
102145
16ac9218f780
(Fskip_chars_forward): Fix doc typo.
Glenn Morris <rgm@gnu.org>
parents:
100951
diff
changeset
|
1395 (but not at the end of a range; quoting is never needed there). |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
1396 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
|
1397 With arg "^a-zA-Z", skips nonletters stopping before first letter. |
56088 | 1398 Char classes, e.g. `[:alpha:]', are supported. |
1399 | |
1400 Returns the distance traveled, either zero or positive. */) | |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1401 (Lisp_Object string, Lisp_Object lim) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1402 { |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1403 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
|
1404 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1405 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1406 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
|
1407 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
|
1408 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
|
1409 Returns the distance traveled, either zero or negative. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1410 (Lisp_Object string, Lisp_Object lim) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1411 { |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1412 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
|
1413 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1414 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1415 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
|
1416 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
|
1417 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
|
1418 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
|
1419 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
|
1420 This function returns the distance traveled, either zero or positive. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1421 (Lisp_Object syntax, Lisp_Object lim) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1422 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1423 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
|
1424 } |
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 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
|
1427 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
|
1428 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
|
1429 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
|
1430 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
|
1431 This function returns the distance traveled, either zero or negative. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
1432 (Lisp_Object syntax, Lisp_Object lim) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1433 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1434 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
|
1435 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1436 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
1437 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1438 skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, 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
|
1439 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1440 register unsigned int c; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1441 unsigned char fastmap[0400]; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1442 /* 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
|
1443 int *char_ranges; |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1444 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
|
1445 int negate = 0; |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1446 register EMACS_INT i, i_byte; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1447 /* 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
|
1448 contains non-ASCII chars. */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1449 int multibyte; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1450 /* 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
|
1451 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
|
1452 int string_multibyte; |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1453 EMACS_INT size_byte; |
46555
35e66a0949b8
(Fstring_to_syntax, skip_chars): Treat Lisp string
Ken Raeburn <raeburn@raeburn.org>
parents:
46370
diff
changeset
|
1454 const unsigned char *str; |
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1455 int len; |
56088 | 1456 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
|
1457 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
1458 CHECK_STRING (string); |
56088 | 1459 iso_classes = Qnil; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1460 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1461 if (NILP (lim)) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1462 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
|
1463 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
1464 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
|
1465 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1466 /* 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
|
1467 if (XINT (lim) > ZV) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1468 XSETFASTINT (lim, ZV); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1469 if (XINT (lim) < BEGV) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1470 XSETFASTINT (lim, BEGV); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1471 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1472 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
|
1473 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); |
89483 | 1474 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
|
1475 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1476 memset (fastmap, 0, sizeof fastmap); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1477 |
89483 | 1478 str = SDATA (string); |
1479 size_byte = SBYTES (string); | |
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1480 |
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1481 i_byte = 0; |
22130
b25abff012fd
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22116
diff
changeset
|
1482 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
|
1483 && SREF (string, 0) == '^') |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1484 { |
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1485 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
|
1486 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1487 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1488 /* 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
|
1489 Handle backslashes and ranges specially. |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1490 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1491 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
|
1492 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
|
1493 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1494 if (! string_multibyte) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1495 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1496 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
|
1497 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1498 /* At first setup fastmap. */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1499 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
|
1500 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1501 c = str[i_byte++]; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1502 |
56088 | 1503 if (handle_iso_classes && c == '[' |
1504 && i_byte < size_byte | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1505 && str[i_byte] == ':') |
56088 | 1506 { |
1507 const unsigned char *class_beg = str + i_byte + 1; | |
1508 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
|
1509 const unsigned char *class_limit = str + size_byte - 2; |
74145 | 1510 /* Leave room for the null. */ |
56088 | 1511 unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; |
1512 re_wctype_t cc; | |
1513 | |
1514 if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) | |
1515 class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; | |
1516 | |
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1517 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
|
1518 && *class_end >= 'a' && *class_end <= 'z') |
56088 | 1519 class_end++; |
1520 | |
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1521 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
|
1522 || *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
|
1523 goto not_a_class_name; |
56088 | 1524 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1525 memcpy (class_name, class_beg, class_end - class_beg); |
56088 | 1526 class_name[class_end - class_beg] = 0; |
1527 | |
1528 cc = re_wctype (class_name); | |
1529 if (cc == 0) | |
1530 error ("Invalid ISO C character class"); | |
1531 | |
1532 iso_classes = Fcons (make_number (cc), iso_classes); | |
1533 | |
1534 i_byte = class_end + 2 - str; | |
1535 continue; | |
1536 } | |
1537 | |
56116
6725db0f57d5
(skip_chars): Only recognize [:class:] when it has the
Kim F. Storm <storm@cua.dk>
parents:
56088
diff
changeset
|
1538 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
|
1539 if (c == '\\') |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1540 { |
22130
b25abff012fd
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22116
diff
changeset
|
1541 if (i_byte == size_byte) |
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1542 break; |
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1543 |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1544 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
|
1545 } |
53508
c7553b3b3a60
(skip_chars): Treat '-' at end of string as ordinary
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1546 /* 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
|
1547 follows. */ |
c7553b3b3a60
(skip_chars): Treat '-' at end of string as ordinary
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1548 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
|
1549 && str[i_byte] == '-') |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1550 { |
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1551 unsigned int c2; |
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1552 |
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1553 /* Skip over the dash. */ |
30596
48a9e9f4fd9d
(skip_chars): Fix handling of multibyte<->unibyte conversion.
Kenichi Handa <handa@m17n.org>
parents:
30594
diff
changeset
|
1554 i_byte++; |
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1555 |
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1556 /* Get the end of the range. */ |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1557 c2 = str[i_byte++]; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1558 if (c2 == '\\' |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1559 && i_byte < size_byte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1560 c2 = str[i_byte++]; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1561 |
89483 | 1562 if (c <= c2) |
22116
09efd6a94b4b
(skip_chars): Fix bug in handling a range which
Kenichi Handa <handa@m17n.org>
parents:
22052
diff
changeset
|
1563 { |
09efd6a94b4b
(skip_chars): Fix bug in handling a range which
Kenichi Handa <handa@m17n.org>
parents:
22052
diff
changeset
|
1564 while (c <= c2) |
89483 | 1565 fastmap[c++] = 1; |
1566 if (! ASCII_CHAR_P (c2)) | |
1567 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
|
1568 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1569 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1570 else |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1571 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1572 fastmap[c] = 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1573 if (! ASCII_CHAR_P (c)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1574 string_has_eight_bit = 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1575 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1576 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1577 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1578 /* 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
|
1579 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
|
1580 the corresponding multibyte chars. */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1581 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
|
1582 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1583 unsigned char fastmap2[0400]; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1584 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
|
1585 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1586 memcpy (fastmap + 0200, fastmap2 + 0200, 0200); |
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1587 memset (fastmap + 0200, 0, 0200); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1588 /* 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
|
1589 for (i = 0200; ! fastmap2[i]; i++); |
105661
bac26aa40069
Remove leftover table unibyte_to_multibyte_table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105426
diff
changeset
|
1590 c = BYTE8_TO_CHAR (i); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1591 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
|
1592 range_start_byte = i; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1593 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
|
1594 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
|
1595 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
|
1596 { |
105661
bac26aa40069
Remove leftover table unibyte_to_multibyte_table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105426
diff
changeset
|
1597 c = BYTE8_TO_CHAR (i); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1598 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
|
1599 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
|
1600 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1601 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
|
1602 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
|
1603 + range_start_char); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1604 range_start_byte = i; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1605 range_start_char = c; |
89483 | 1606 } |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1607 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1608 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
|
1609 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
|
1610 + range_start_char); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1611 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1612 } |
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1613 else /* STRING is multibyte */ |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1614 { |
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1615 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
|
1616 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1617 while (i_byte < size_byte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1618 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1619 unsigned char leading_code; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1620 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1621 leading_code = str[i_byte]; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1622 c = STRING_CHAR_AND_LENGTH (str + i_byte, len); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1623 i_byte += len; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1624 |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1625 if (handle_iso_classes && c == '[' |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1626 && i_byte < size_byte |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1627 && STRING_CHAR (str + i_byte) == ':') |
89943
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 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
|
1630 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
|
1631 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
|
1632 /* Leave room for the null. */ |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1633 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
|
1634 re_wctype_t cc; |
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 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
|
1637 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
|
1638 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1639 while (class_end < class_limit |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1640 && *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
|
1641 class_end++; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1642 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1643 if (class_end == class_beg |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1644 || *class_end != ':' || class_end[1] != ']') |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1645 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
|
1646 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1647 memcpy (class_name, class_beg, class_end - class_beg); |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1648 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
|
1649 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1650 cc = re_wctype (class_name); |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1651 if (cc == 0) |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1652 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
|
1653 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1654 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
|
1655 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1656 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
|
1657 continue; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1658 } |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1659 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1660 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
|
1661 if (c == '\\') |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1662 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1663 if (i_byte == size_byte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1664 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1665 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1666 leading_code = str[i_byte]; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1667 c = STRING_CHAR_AND_LENGTH (str + i_byte, len); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1668 i_byte += len; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1669 } |
89880 | 1670 /* Treat `-' as range character only if another character |
1671 follows. */ | |
1672 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
|
1673 && str[i_byte] == '-') |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1674 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1675 unsigned int c2; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1676 unsigned char leading_code2; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1677 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1678 /* Skip over the dash. */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1679 i_byte++; |
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 /* 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
|
1682 leading_code2 = str[i_byte]; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1683 c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1684 i_byte += len; |
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 if (c2 == '\\' |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1687 && i_byte < size_byte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1688 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1689 leading_code2 = str[i_byte]; |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1690 c2 =STRING_CHAR_AND_LENGTH (str + i_byte, len); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1691 i_byte += len; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1692 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1693 |
89622
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1694 if (c > c2) |
96081c0be5ca
(skip_chars): Be sure to alloca char_ranges when necessary.
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
1695 continue; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1696 if (ASCII_CHAR_P (c)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1697 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1698 while (c <= c2 && c < 0x80) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1699 fastmap[c++] = 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1700 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
|
1701 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1702 if (! ASCII_CHAR_P (c)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1703 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1704 while (leading_code <= leading_code2) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1705 fastmap[leading_code++] = 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1706 if (c <= c2) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1707 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1708 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
|
1709 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
|
1710 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1711 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1712 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1713 else |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1714 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1715 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
|
1716 fastmap[c] = 1; |
9d47c133b357
* syntax.c (skip_chars): Fix previous change. Make the handling of
Kenichi Handa <handa@m17n.org>
parents:
30596
diff
changeset
|
1717 else |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1718 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1719 fastmap[leading_code] = 1; |
20626
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1720 char_ranges[n_char_ranges++] = c; |
a39bcf9c0e1e
(skip_chars): Handle multibyte and unibyte strings
Richard M. Stallman <rms@gnu.org>
parents:
20546
diff
changeset
|
1721 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
|
1722 } |
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
1723 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1724 } |
89063
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 /* 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
|
1727 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
|
1728 chars. */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1729 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1730 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
|
1731 { |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1732 memset (fastmap + 0200, 0, 0200); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1733 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
|
1734 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1735 int c1 = char_ranges[i]; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1736 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
|
1737 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1738 for (; c1 <= c2; c1++) |
95856
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1739 { |
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1740 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
|
1741 if (b >= 0) |
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1742 fastmap[b] = 1; |
f13a77e0e34f
* character.h (CHAR_TO_BYTE_SAFE): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94963
diff
changeset
|
1743 } |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1744 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1745 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1746 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1747 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1748 /* 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
|
1749 if (negate) |
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 if (! multibyte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1752 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
|
1753 fastmap[i] ^= 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1754 else |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1755 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1756 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
|
1757 fastmap[i] ^= 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1758 /* 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
|
1759 for (; i < sizeof fastmap; i++) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1760 fastmap[i] = 1; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1761 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1762 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1763 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1764 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1765 EMACS_INT start_point = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1766 EMACS_INT pos = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1767 EMACS_INT pos_byte = PT_BYTE; |
89483 | 1768 unsigned char *p = PT_ADDR, *endp, *stop; |
1769 | |
1770 if (forwardp) | |
1771 { | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1772 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
|
1773 stop = (pos < GPT && GPT < XINT (lim)) ? GPT_ADDR : endp; |
89483 | 1774 } |
1775 else | |
1776 { | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1777 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
|
1778 stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp; |
89483 | 1779 } |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1780 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1781 immediate_quit = 1; |
107335
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
1782 /* This code may look up syntax tables using macros that rely on the |
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
1783 gl_state object. To make sure this object is not out of date, |
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
1784 let's initialize it manually. |
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
1785 We ignore syntax-table text-properties for now, since that's |
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
1786 what we've done in the past. */ |
107366
14ff9accfbd3
Cleanup setup of gl_state in various parts of the code.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107335
diff
changeset
|
1787 SETUP_BUFFER_SYNTAX_TABLE (); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1788 if (forwardp) |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1789 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1790 if (multibyte) |
89483 | 1791 while (1) |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1792 { |
89483 | 1793 int nbytes; |
1794 | |
1795 if (p >= stop) | |
1796 { | |
1797 if (p >= endp) | |
1798 break; | |
1799 p = GAP_END_ADDR; | |
1800 stop = endp; | |
1801 } | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1802 c = STRING_CHAR_AND_LENGTH (p, nbytes); |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1803 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
|
1804 { |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1805 if (negate) |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1806 break; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1807 else |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1808 goto fwd_ok; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1809 } |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1810 |
89483 | 1811 if (! fastmap[*p]) |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1812 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1813 if (! ASCII_CHAR_P (c)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1814 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1815 /* 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
|
1816 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
|
1817 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
|
1818 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
|
1819 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1820 /* 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
|
1821 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
|
1822 CHAR_RANGES). */ |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1823 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
|
1824 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
|
1825 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1826 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
|
1827 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1828 } |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1829 fwd_ok: |
89483 | 1830 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
|
1831 } |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1832 else |
89483 | 1833 while (1) |
1834 { | |
1835 if (p >= stop) | |
1836 { | |
1837 if (p >= endp) | |
1838 break; | |
1839 p = GAP_END_ADDR; | |
1840 stop = endp; | |
1841 } | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1842 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1843 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
|
1844 { |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1845 if (negate) |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1846 break; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1847 else |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1848 goto fwd_unibyte_ok; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1849 } |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1850 |
89483 | 1851 if (!fastmap[*p]) |
1852 break; | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1853 fwd_unibyte_ok: |
89483 | 1854 p++, pos++, pos_byte++; |
1855 } | |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1856 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1857 else |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1858 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1859 if (multibyte) |
89483 | 1860 while (1) |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1861 { |
89483 | 1862 unsigned char *prev_p; |
1863 | |
1864 if (p <= stop) | |
1865 { | |
1866 if (p <= endp) | |
1867 break; | |
1868 p = GPT_ADDR; | |
1869 stop = endp; | |
1870 } | |
1871 prev_p = p; | |
1872 while (--p >= stop && ! CHAR_HEAD_P (*p)); | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
1873 c = STRING_CHAR (p); |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1874 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1875 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
|
1876 { |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1877 if (negate) |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1878 break; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1879 else |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1880 goto back_ok; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1881 } |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1882 |
89483 | 1883 if (! fastmap[*p]) |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1884 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1885 if (! ASCII_CHAR_P (c)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1886 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1887 /* 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
|
1888 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
|
1889 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
|
1890 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1891 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
|
1892 break; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1893 } |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1894 back_ok: |
89483 | 1895 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
|
1896 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1897 else |
89483 | 1898 while (1) |
1899 { | |
1900 if (p <= stop) | |
1901 { | |
1902 if (p <= endp) | |
1903 break; | |
1904 p = GPT_ADDR; | |
1905 stop = endp; | |
1906 } | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1907 |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1908 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
|
1909 { |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1910 if (negate) |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1911 break; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1912 else |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1913 goto back_unibyte_ok; |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1914 } |
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1915 |
89483 | 1916 if (!fastmap[p[-1]]) |
1917 break; | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1918 back_unibyte_ok: |
89483 | 1919 p--, pos--, pos_byte--; |
1920 } | |
88389
39b2b971cdb3
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41598
diff
changeset
|
1921 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1922 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1923 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
|
1924 immediate_quit = 0; |
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 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
|
1927 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1928 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1929 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1930 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1931 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
1932 skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1933 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1934 register unsigned int c; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1935 unsigned char fastmap[0400]; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1936 int negate = 0; |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1937 register EMACS_INT i, i_byte; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1938 int multibyte; |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1939 EMACS_INT size_byte; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1940 unsigned char *str; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1941 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1942 CHECK_STRING (string); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1943 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1944 if (NILP (lim)) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1945 XSETINT (lim, forwardp ? ZV : BEGV); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1946 else |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1947 CHECK_NUMBER_COERCE_MARKER (lim); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1948 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1949 /* 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
|
1950 if (XINT (lim) > ZV) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1951 XSETFASTINT (lim, ZV); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1952 if (XINT (lim) < BEGV) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1953 XSETFASTINT (lim, BEGV); |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1954 |
89114 | 1955 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
|
1956 return make_number (0); |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
1957 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1958 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
|
1959 && (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
|
1960 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
1961 memset (fastmap, 0, sizeof fastmap); |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1962 |
89483 | 1963 if (SBYTES (string) > SCHARS (string)) |
1964 /* As this is very rare case (syntax spec is ASCII only), don't | |
1965 consider efficiency. */ | |
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1966 string = string_make_unibyte (string); |
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1967 |
89483 | 1968 str = SDATA (string); |
1969 size_byte = SBYTES (string); | |
89103
c4712a200dcb
(skip_chars): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89072
diff
changeset
|
1970 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1971 i_byte = 0; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1972 if (i_byte < size_byte |
89483 | 1973 && SREF (string, 0) == '^') |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1974 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1975 negate = 1; i_byte++; |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1976 } |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1977 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1978 /* 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
|
1979 |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1980 while (i_byte < size_byte) |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1981 { |
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
1982 c = str[i_byte++]; |
89483 | 1983 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
|
1984 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1985 |
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1986 /* 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
|
1987 if (negate) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1988 for (i = 0; i < sizeof fastmap; i++) |
31944
05763e780521
(skip_chars): Handle negation correctly.
Kenichi Handa <handa@m17n.org>
parents:
31209
diff
changeset
|
1989 fastmap[i] ^= 1; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1990 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
1991 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1992 EMACS_INT start_point = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1993 EMACS_INT pos = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
1994 EMACS_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
|
1995 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
|
1996 |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1997 if (forwardp) |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1998 { |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
1999 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
|
2000 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
|
2001 } |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
2002 else |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
2003 { |
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
2004 endp = CHAR_POS_ADDR (XINT (lim)); |
55423
a9e10b866486
(Fmodify_syntax_entry): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54849
diff
changeset
|
2005 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
|
2006 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2007 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2008 immediate_quit = 1; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2009 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
|
2010 if (forwardp) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2011 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2012 if (multibyte) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2013 { |
89483 | 2014 while (1) |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2015 { |
89483 | 2016 int nbytes; |
2017 | |
2018 if (p >= stop) | |
2019 { | |
2020 if (p >= endp) | |
2021 break; | |
2022 p = GAP_END_ADDR; | |
2023 stop = endp; | |
2024 } | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
2025 c = STRING_CHAR_AND_LENGTH (p, nbytes); |
89483 | 2026 if (! fastmap[(int) SYNTAX (c)]) |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2027 break; |
89483 | 2028 p += nbytes, pos++, pos_byte += nbytes; |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2029 UPDATE_SYNTAX_TABLE_FORWARD (pos); |
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2030 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2031 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2032 else |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2033 { |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2034 while (1) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2035 { |
89483 | 2036 if (p >= stop) |
2037 { | |
2038 if (p >= endp) | |
50675
96dc22fa49d3
(skip_chars): Make the code faster by using the common
Kenichi Handa <handa@m17n.org>
parents:
49971
diff
changeset
|
2039 break; |
89483 | 2040 p = GAP_END_ADDR; |
2041 stop = endp; | |
2042 } | |
2043 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
|
2044 break; |
89483 | 2045 p++, pos++, pos_byte++; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2046 UPDATE_SYNTAX_TABLE_FORWARD (pos); |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2047 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2048 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2049 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2050 else |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2051 { |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2052 if (multibyte) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2053 { |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2054 while (1) |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2055 { |
89483 | 2056 unsigned char *prev_p; |
2057 | |
2058 if (p <= stop) | |
2059 { | |
2060 if (p <= endp) | |
2061 break; | |
2062 p = GPT_ADDR; | |
2063 stop = endp; | |
2064 } | |
90851 | 2065 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); |
89483 | 2066 prev_p = p; |
2067 while (--p >= stop && ! CHAR_HEAD_P (*p)); | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105877
diff
changeset
|
2068 c = STRING_CHAR (p); |
89483 | 2069 if (! fastmap[(int) SYNTAX (c)]) |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2070 break; |
89483 | 2071 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
|
2072 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2073 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2074 else |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2075 { |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2076 while (1) |
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2077 { |
89483 | 2078 if (p <= stop) |
2079 { | |
2080 if (p <= endp) | |
2081 break; | |
2082 p = GPT_ADDR; | |
2083 stop = endp; | |
2084 } | |
90846
c035421fe210
(skip_syntaxes): Synch with the trunk.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2085 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); |
89483 | 2086 if (! fastmap[(int) SYNTAX (p[-1])]) |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2087 break; |
89483 | 2088 p--, pos--, pos_byte--; |
89113
326caaedbfef
(skip_syntaxes): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89112
diff
changeset
|
2089 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2090 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2091 } |
17564
050f15e0b948
(skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents:
17466
diff
changeset
|
2092 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2093 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
|
2094 immediate_quit = 0; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2095 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2096 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
|
2097 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2098 } |
56088 | 2099 |
2100 /* Return 1 if character C belongs to one of the ISO classes | |
2101 in the list ISO_CLASSES. Each class is represented by an | |
2102 integer which is its type according to re_wctype. */ | |
2103 | |
2104 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2105 in_classes (int c, Lisp_Object iso_classes) |
56088 | 2106 { |
2107 int fits_class = 0; | |
2108 | |
107335
230cb6c59526
(skip_chars): Setup gl_state (bug#3823).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
2109 while (CONSP (iso_classes)) |
56088 | 2110 { |
2111 Lisp_Object elt; | |
2112 elt = XCAR (iso_classes); | |
2113 iso_classes = XCDR (iso_classes); | |
2114 | |
2115 if (re_iswctype (c, XFASTINT (elt))) | |
2116 fits_class = 1; | |
2117 } | |
2118 | |
2119 return fits_class; | |
2120 } | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2121 |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2122 /* 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
|
2123 FROM is the current position. |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2124 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
|
2125 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
|
2126 The comment over which we have to jump is of style STYLE |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2127 (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2128 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
|
2129 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
|
2130 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
|
2131 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
|
2132 (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
|
2133 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2134 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
|
2135 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
|
2136 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
|
2137 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
|
2138 (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
|
2139 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2140 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
|
2141 character just after the comment. |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2142 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2143 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
|
2144 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
|
2145 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2146 static int |
109139
c25c24812fb1
Convert declarations or definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
2147 forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, |
c25c24812fb1
Convert declarations or definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
2148 int nesting, int style, int prev_syntax, |
c25c24812fb1
Convert declarations or definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
2149 EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr, |
c25c24812fb1
Convert declarations or definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
2150 int *incomment_ptr) |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2151 { |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2152 register int c, c1; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2153 register enum syntaxcode code; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2154 register int syntax, other_syntax; |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2155 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2156 if (nesting <= 0) nesting = -1; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2157 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2158 /* 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
|
2159 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
|
2160 syntax = prev_syntax; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2161 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
|
2162 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2163 while (1) |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2164 { |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2165 if (from == stop) |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2166 { |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2167 *incomment_ptr = nesting; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2168 *charpos_ptr = from; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2169 *bytepos_ptr = from_byte; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2170 return 0; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2171 } |
89483 | 2172 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
|
2173 syntax = SYNTAX_WITH_FLAGS (c); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2174 code = syntax & 0xff; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2175 if (code == Sendcomment |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2176 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2177 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2178 (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
|
2179 /* 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
|
2180 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
|
2181 section */ |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2182 break; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2183 if (code == Scomment_fence |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2184 && style == ST_COMMENT_STYLE) |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2185 /* 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
|
2186 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
|
2187 section. */ |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2188 break; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2189 if (nesting > 0 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2190 && code == Scomment |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2191 && SYNTAX_FLAGS_COMMENT_NESTED (syntax) |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2192 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style) |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2193 /* 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
|
2194 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
|
2195 nesting++; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2196 INC_BOTH (from, from_byte); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2197 UPDATE_SYNTAX_TABLE_FORWARD (from); |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2198 |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2199 forw_incomment: |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2200 if (from < stop && SYNTAX_FLAGS_COMEND_FIRST (syntax) |
89483 | 2201 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2202 other_syntax = SYNTAX_WITH_FLAGS (c1), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2203 SYNTAX_FLAGS_COMEND_SECOND (other_syntax)) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2204 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, other_syntax) == style |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2205 && ((SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2206 SYNTAX_FLAGS_COMMENT_NESTED (other_syntax)) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2207 ? nesting > 0 : nesting < 0)) |
25771
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2208 { |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2209 if (--nesting <= 0) |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2210 /* 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
|
2211 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
|
2212 section */ |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2213 break; |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2214 else |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2215 { |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2216 INC_BOTH (from, from_byte); |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2217 UPDATE_SYNTAX_TABLE_FORWARD (from); |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2218 } |
21925339c7d2
(update_syntax_table, find_defun_start, back_comment,
Gerd Moellmann <gerd@gnu.org>
parents:
25663
diff
changeset
|
2219 } |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2220 if (nesting > 0 |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2221 && from < stop |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2222 && SYNTAX_FLAGS_COMSTART_FIRST (syntax) |
89483 | 2223 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2224 other_syntax = SYNTAX_WITH_FLAGS (c1), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2225 SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax) == style |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2226 && SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2227 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) || |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2228 SYNTAX_FLAGS_COMMENT_NESTED (other_syntax))) |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2229 /* 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
|
2230 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
|
2231 section */ |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2232 { |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2233 INC_BOTH (from, from_byte); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2234 UPDATE_SYNTAX_TABLE_FORWARD (from); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2235 nesting++; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2236 } |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2237 } |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2238 *charpos_ptr = from; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2239 *bytepos_ptr = from_byte; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2240 return 1; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2241 } |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2242 |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2243 DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0, |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49551
diff
changeset
|
2244 doc: /* |
48089 | 2245 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
|
2246 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
|
2247 Set point to where scanning stops. |
48089 | 2248 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
|
2249 between them, return t; otherwise return nil. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
2250 (Lisp_Object count) |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2251 { |
71739
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2252 register EMACS_INT from; |
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2253 EMACS_INT from_byte; |
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2254 register EMACS_INT stop; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
2255 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
|
2256 register enum syntaxcode code; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2257 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
|
2258 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
|
2259 int found; |
71739
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2260 EMACS_INT count1; |
a5eb5d8b1eca
(Fforward_comment): Revert the reversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71734
diff
changeset
|
2261 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
|
2262 int dummy; |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2263 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2264 CHECK_NUMBER (count); |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2265 count1 = XINT (count); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2266 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
|
2267 |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2268 immediate_quit = 1; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2269 QUIT; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2270 |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2271 from = PT; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2272 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
|
2273 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2274 SETUP_SYNTAX_TABLE (from, count1); |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2275 while (count1 > 0) |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2276 { |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2277 do |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2278 { |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2279 int comstart_first, syntax, other_syntax; |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2280 |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2281 if (from == stop) |
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2282 { |
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2283 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
|
2284 immediate_quit = 0; |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2285 return Qnil; |
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2286 } |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2287 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2288 syntax = SYNTAX_WITH_FLAGS (c); |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2289 code = SYNTAX (c); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2290 comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2291 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2292 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2293 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
|
2294 UPDATE_SYNTAX_TABLE_FORWARD (from); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2295 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
|
2296 && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2297 other_syntax = SYNTAX_WITH_FLAGS (c1), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2298 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax))) |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2299 { |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2300 /* 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
|
2301 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
|
2302 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
|
2303 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
|
2304 the comment section. */ |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2305 code = Scomment; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2306 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2307 comnested |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2308 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2309 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
|
2310 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
|
2311 } |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2312 } |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2313 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
|
2314 |
25290
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2315 if (code == Scomment_fence) |
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2316 comstyle = ST_COMMENT_STYLE; |
a80acb2a8273
(Fforward_comment): Set comstyle for Scomment_fence.
Karl Heuer <kwzh@gnu.org>
parents:
24728
diff
changeset
|
2317 else if (code != Scomment) |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2318 { |
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2319 immediate_quit = 0; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2320 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
|
2321 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
|
2322 return Qnil; |
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2323 } |
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2324 /* 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
|
2325 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
|
2326 &out_charpos, &out_bytepos, &dummy); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2327 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
|
2328 if (!found) |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2329 { |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2330 immediate_quit = 0; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2331 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
|
2332 return Qnil; |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2333 } |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2334 INC_BOTH (from, from_byte); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2335 UPDATE_SYNTAX_TABLE_FORWARD (from); |
6142
2dbc79d01191
(Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents:
5755
diff
changeset
|
2336 /* We have skipped one comment. */ |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2337 count1--; |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2338 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2339 |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2340 while (count1 < 0) |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2341 { |
18938
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2342 while (1) |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2343 { |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2344 int quoted, syntax; |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2345 |
18938
444939f3c18f
(Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents:
18738
diff
changeset
|
2346 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
|
2347 { |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2348 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
|
2349 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
|
2350 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
|
2351 } |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2352 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2353 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
|
2354 /* 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
|
2355 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
|
2356 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2357 syntax = SYNTAX_WITH_FLAGS (c); |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2358 code = SYNTAX (c); |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2359 comstyle = 0; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2360 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2361 if (code == Sendcomment) |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2362 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2363 if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2364 && 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
|
2365 && !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
|
2366 { |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2367 int other_syntax; |
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2368 /* 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
|
2369 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
|
2370 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
|
2371 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
|
2372 code = Sendcomment; |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2373 /* 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
|
2374 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
|
2375 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2376 other_syntax = SYNTAX_WITH_FLAGS (c1); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2377 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2378 comnested |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2379 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2380 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2381 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2382 if (code == Scomment_fence) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2383 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2384 /* Skip until first preceding unquoted comment_fence. */ |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2385 int found = 0; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2386 EMACS_INT ini = from, ini_byte = from_byte; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2387 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2388 while (1) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2389 { |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2390 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
|
2391 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
|
2392 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
|
2393 if (SYNTAX (c) == Scomment_fence |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2394 && !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
|
2395 { |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2396 found = 1; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2397 break; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2398 } |
70317
48f9beb0cfdc
(Fforward_comment): Detect generic comment at beginning of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70291
diff
changeset
|
2399 else if (from == stop) |
48f9beb0cfdc
(Fforward_comment): Detect generic comment at beginning of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
70291
diff
changeset
|
2400 break; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2401 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2402 if (found == 0) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2403 { |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2404 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
|
2405 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
|
2406 goto leave; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2407 } |
70291
e4dbfbc6b5c6
(Fforward_comment): Don't forget to break out of the loop
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
2408 else |
e4dbfbc6b5c6
(Fforward_comment): Don't forget to break out of the loop
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68651
diff
changeset
|
2409 /* 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
|
2410 break; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2411 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2412 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
|
2413 { |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2414 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
|
2415 &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
|
2416 if (found == -1) |
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2417 { |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2418 if (c == '\n') |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2419 /* 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
|
2420 Treat it like a whitespace. |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2421 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
|
2422 ; |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2423 else |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2424 { |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2425 /* 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
|
2426 not-quite-endcomment. */ |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2427 if (SYNTAX (c) != code) |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2428 /* It was a two-char Sendcomment. */ |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2429 INC_BOTH (from, from_byte); |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2430 goto leave; |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2431 } |
27698
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2432 } |
27719
73926d5a4d9f
(Fforward_comment): Undo the previous change, since cc-mode
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27698
diff
changeset
|
2433 else |
32086
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2434 { |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2435 /* We have skipped one comment. */ |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2436 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
|
2437 break; |
73d18e25e303
(forw_comment): Match nestedness of ender/starter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31944
diff
changeset
|
2438 } |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2439 } |
39796
dcc6aae53ac8
(update_syntax_table): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39748
diff
changeset
|
2440 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
|
2441 { |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2442 leave: |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2443 immediate_quit = 0; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2444 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
|
2445 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
|
2446 return Qnil; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2447 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2448 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2449 |
3095
ef7d99920f81
(Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3087
diff
changeset
|
2450 count1++; |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2451 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2452 |
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2453 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
|
2454 immediate_quit = 0; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2455 return Qt; |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2456 } |
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
2457 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2458 /* Return syntax code of character C if C is an ASCII character |
38047 | 2459 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
|
2460 |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2461 #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
|
2462 ((ASCII_CHAR_P (c) || !multibyte_symbol_p) \ |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2463 ? SYNTAX (c) : Ssymbol) |
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2464 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2465 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
2466 scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) |
163 | 2467 { |
2468 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
|
2469 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
|
2470 register int c, c1; |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2471 int stringterm; |
163 | 2472 int quoted; |
2473 int mathexit = 0; | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2474 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
|
2475 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
|
2476 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
|
2477 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
|
2478 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
|
2479 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
|
2480 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
|
2481 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
|
2482 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
|
2483 int temp, dummy; |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2484 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; |
163 | 2485 |
2486 if (depth > 0) min_depth = 0; | |
2487 | |
23404
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2488 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
|
2489 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
|
2490 |
529689c4a32c
(scan_lists): Bring FROM back into range BEGV...ZV.
Richard M. Stallman <rms@gnu.org>
parents:
22994
diff
changeset
|
2491 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
|
2492 |
163 | 2493 immediate_quit = 1; |
2494 QUIT; | |
2495 | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2496 SETUP_SYNTAX_TABLE (from, count); |
163 | 2497 while (count > 0) |
2498 { | |
2499 while (from < stop) | |
2500 { | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2501 int comstart_first, prefix, syntax, other_syntax; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2502 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
|
2503 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2504 syntax = SYNTAX_WITH_FLAGS (c); |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2505 code = SYNTAX_WITH_MULTIBYTE_CHECK (c); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2506 comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2507 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2508 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2509 prefix = SYNTAX_FLAGS_PREFIX (syntax); |
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2510 if (depth == min_depth) |
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2511 last_good = from; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2512 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
|
2513 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
|
2514 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
|
2515 && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2516 other_syntax = SYNTAX_WITH_FLAGS (c), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2517 SYNTAX_FLAGS_COMSTART_SECOND (other_syntax)) |
163 | 2518 && 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
|
2519 { |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2520 /* 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
|
2521 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
|
2522 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
|
2523 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
|
2524 the comment section */ |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2525 code = Scomment; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2526 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2527 comnested |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2528 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2529 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
|
2530 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
|
2531 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2532 |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2533 if (prefix) |
163 | 2534 continue; |
2535 | |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
9863
diff
changeset
|
2536 switch (SWITCH_ENUM_CAST (code)) |
163 | 2537 { |
2538 case Sescape: | |
2539 case Scharquote: | |
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2540 if (from == stop) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2541 goto lose; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2542 INC_BOTH (from, from_byte); |
163 | 2543 /* treat following character as a word constituent */ |
2544 case Sword: | |
2545 case Ssymbol: | |
2546 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
|
2547 /* This word counts as a sexp; return at end of it. */ |
163 | 2548 while (from < stop) |
2549 { | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2550 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
|
2551 |
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2552 /* 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
|
2553 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2554 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
|
2555 switch (temp) |
163 | 2556 { |
2557 case Scharquote: | |
2558 case Sescape: | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2559 INC_BOTH (from, from_byte); |
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2560 if (from == stop) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2561 goto lose; |
163 | 2562 break; |
2563 case Sword: | |
2564 case Ssymbol: | |
2565 case Squote: | |
2566 break; | |
2567 default: | |
2568 goto done; | |
2569 } | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2570 INC_BOTH (from, from_byte); |
163 | 2571 } |
2572 goto done; | |
2573 | |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2574 case Scomment_fence: |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2575 comstyle = ST_COMMENT_STYLE; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2576 /* FALLTHROUGH */ |
163 | 2577 case Scomment: |
2578 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
|
2579 UPDATE_SYNTAX_TABLE_FORWARD (from); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2580 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
|
2581 comnested, comstyle, 0, |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2582 &out_charpos, &out_bytepos, &dummy); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2583 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
|
2584 if (!found) |
163 | 2585 { |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2586 if (depth == 0) |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2587 goto done; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2588 goto lose; |
163 | 2589 } |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2590 INC_BOTH (from, from_byte); |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2591 UPDATE_SYNTAX_TABLE_FORWARD (from); |
163 | 2592 break; |
2593 | |
2594 case Smath: | |
2595 if (!sexpflag) | |
2596 break; | |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2597 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
|
2598 { |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2599 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
|
2600 } |
163 | 2601 if (mathexit) |
2602 { | |
2603 mathexit = 0; | |
2604 goto close1; | |
2605 } | |
2606 mathexit = 1; | |
2607 | |
2608 case Sopen: | |
2609 if (!++depth) goto done; | |
2610 break; | |
2611 | |
2612 case Sclose: | |
2613 close1: | |
2614 if (!--depth) goto done; | |
2615 if (depth < min_depth) | |
71988 | 2616 xsignal3 (Qscan_error, |
2617 build_string ("Containing expression ends prematurely"), | |
2618 make_number (last_good), make_number (from)); | |
163 | 2619 break; |
2620 | |
2621 case Sstring: | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2622 case Sstring_fence: |
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2623 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
|
2624 stringterm = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
163 | 2625 while (1) |
2626 { | |
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2627 if (from >= stop) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2628 goto lose; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2629 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
|
2630 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
|
2631 if (code == Sstring |
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2632 ? (c == stringterm |
945b3e6bf3e7
(scan_lists): Check that the right quote char has the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32794
diff
changeset
|
2633 && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2634 : 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
|
2635 break; |
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2636 |
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
2637 /* 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
|
2638 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
|
2639 switch (temp) |
163 | 2640 { |
2641 case Scharquote: | |
2642 case Sescape: | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2643 INC_BOTH (from, from_byte); |
163 | 2644 } |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2645 INC_BOTH (from, from_byte); |
163 | 2646 } |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2647 INC_BOTH (from, from_byte); |
163 | 2648 if (!depth && sexpflag) goto done; |
2649 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
|
2650 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
|
2651 /* 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
|
2652 break; |
163 | 2653 } |
2654 } | |
2655 | |
2656 /* 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
|
2657 if (depth) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2658 goto lose; |
163 | 2659 |
2660 immediate_quit = 0; | |
2661 return Qnil; | |
2662 | |
2663 /* End of object reached */ | |
2664 done: | |
2665 count--; | |
2666 } | |
2667 | |
2668 while (count < 0) | |
2669 { | |
2670 while (from > stop) | |
2671 { | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2672 int syntax; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2673 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
|
2674 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
|
2675 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2676 syntax= SYNTAX_WITH_FLAGS (c); |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2677 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
|
2678 if (depth == min_depth) |
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
2679 last_good = from; |
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2680 comstyle = 0; |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2681 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
4953
7545290052bf
(Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2682 if (code == Sendcomment) |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2683 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2684 if (from > stop && SYNTAX_FLAGS_COMEND_SECOND (syntax) |
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
|
2685 && prev_char_comend_first (from, from_byte) |
163 | 2686 && 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
|
2687 { |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2688 /* 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
|
2689 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
|
2690 sequence of the same style. */ |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2691 int c1, other_syntax; |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2692 DEC_BOTH (from, from_byte); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2693 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
|
2694 code = Sendcomment; |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2695 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2696 other_syntax = SYNTAX_WITH_FLAGS (c1); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2697 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2698 comnested |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2699 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
2700 } |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2701 |
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2702 /* 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
|
2703 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
|
2704 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
|
2705 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
|
2706 { |
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
|
2707 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
|
2708 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
|
2709 } |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
2710 else if (SYNTAX_FLAGS_PREFIX (syntax)) |
163 | 2711 continue; |
2712 | |
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2713 switch (SWITCH_ENUM_CAST (code)) |
163 | 2714 { |
2715 case Sword: | |
2716 case Ssymbol: | |
20674
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2717 case Sescape: |
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2718 case Scharquote: |
163 | 2719 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
|
2720 /* 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
|
2721 after passing it. */ |
163 | 2722 while (from > stop) |
2723 { | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2724 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
|
2725 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
|
2726 DEC_POS (temp_pos); |
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2727 else |
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2728 temp_pos--; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2729 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
|
2730 c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2731 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
|
2732 /* 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
|
2733 if (temp_code == Sendcomment) |
fa7d4c0ee36c
(skip_chars): Fix test for end of string, looking for `-'.
Karl Heuer <kwzh@gnu.org>
parents:
20626
diff
changeset
|
2734 goto done2; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2735 quoted = char_quoted (from - 1, temp_pos); |
163 | 2736 if (quoted) |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2737 { |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2738 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
|
2739 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
|
2740 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2741 } |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2742 c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2743 temp_code = SYNTAX_WITH_MULTIBYTE_CHECK (c1); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2744 if (! (quoted || temp_code == Sword |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2745 || temp_code == Ssymbol |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2746 || temp_code == Squote)) |
163 | 2747 goto done2; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2748 DEC_BOTH (from, from_byte); |
163 | 2749 } |
2750 goto done2; | |
2751 | |
2752 case Smath: | |
2753 if (!sexpflag) | |
2754 break; | |
20905
e646a6ae42cd
(skip_chars): Use INC_POS instead of INC_BOTH.
Richard M. Stallman <rms@gnu.org>
parents:
20766
diff
changeset
|
2755 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
|
2756 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
|
2757 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
|
2758 DEC_BOTH (from, from_byte); |
163 | 2759 if (mathexit) |
2760 { | |
2761 mathexit = 0; | |
2762 goto open2; | |
2763 } | |
2764 mathexit = 1; | |
2765 | |
2766 case Sclose: | |
2767 if (!++depth) goto done2; | |
2768 break; | |
2769 | |
2770 case Sopen: | |
2771 open2: | |
2772 if (!--depth) goto done2; | |
2773 if (depth < min_depth) | |
71988 | 2774 xsignal3 (Qscan_error, |
2775 build_string ("Containing expression ends prematurely"), | |
2776 make_number (last_good), make_number (from)); | |
163 | 2777 break; |
2778 | |
2779 case Sendcomment: | |
2780 if (!parse_sexp_ignore_comments) | |
2781 break; | |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2782 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
|
2783 &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
|
2784 /* 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
|
2785 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
|
2786 from skipping the char. |
9c61956399b2
(back_comment): Make sure we only consider comment-starters
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27080
diff
changeset
|
2787 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
|
2788 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
|
2789 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
|
2790 if (found != -1) |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2791 from = out_charpos, from_byte = out_bytepos; |
163 | 2792 break; |
2793 | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2794 case Scomment_fence: |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2795 case Sstring_fence: |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2796 while (1) |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2797 { |
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2798 if (from == stop) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2799 goto lose; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2800 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
|
2801 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2802 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
|
2803 && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
2804 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
|
2805 break; |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2806 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2807 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
|
2808 break; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2809 |
163 | 2810 case Sstring: |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
2811 stringterm = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
163 | 2812 while (1) |
2813 { | |
91806
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2814 if (from == stop) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2815 goto lose; |
54849
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2816 DEC_BOTH (from, from_byte); |
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2817 UPDATE_SYNTAX_TABLE_BACKWARD (from); |
3f107190e71f
(scan_lists): Simplify backward string scan.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53508
diff
changeset
|
2818 if (!char_quoted (from, from_byte) |
89909 | 2819 && (stringterm |
2820 == (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
|
2821 && SYNTAX_WITH_MULTIBYTE_CHECK (c) == Sstring) |
163 | 2822 break; |
2823 } | |
2824 if (!depth && sexpflag) goto done2; | |
2825 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
|
2826 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
|
2827 /* 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
|
2828 break; |
163 | 2829 } |
2830 } | |
2831 | |
2832 /* 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
|
2833 if (depth) |
6c0a55931b1c
(scan_lists): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
2834 goto lose; |
163 | 2835 |
2836 immediate_quit = 0; | |
2837 return Qnil; | |
2838 | |
2839 done2: | |
2840 count++; | |
2841 } | |
2842 | |
2843 | |
2844 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
|
2845 XSETFASTINT (val, from); |
163 | 2846 return val; |
2847 | |
2848 lose: | |
71988 | 2849 xsignal3 (Qscan_error, |
2850 build_string ("Unbalanced parentheses"), | |
2851 make_number (last_good), make_number (from)); | |
163 | 2852 } |
2853 | |
2854 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
|
2855 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
|
2856 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
|
2857 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2858 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
|
2859 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
|
2860 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
|
2861 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
|
2862 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2863 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
|
2864 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2865 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
|
2866 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
|
2867 If the depth is right but the count is not used up, nil is returned. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
2868 (Lisp_Object from, Lisp_Object count, Lisp_Object depth) |
163 | 2869 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2870 CHECK_NUMBER (from); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2871 CHECK_NUMBER (count); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2872 CHECK_NUMBER (depth); |
163 | 2873 |
2874 return scan_lists (XINT (from), XINT (count), XINT (depth), 0); | |
2875 } | |
2876 | |
2877 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
|
2878 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
|
2879 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
|
2880 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
|
2881 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2882 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
|
2883 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2884 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
|
2885 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
|
2886 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
|
2887 but before count is used up, nil is returned. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
2888 (Lisp_Object from, Lisp_Object count) |
163 | 2889 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2890 CHECK_NUMBER (from); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
2891 CHECK_NUMBER (count); |
163 | 2892 |
2893 return scan_lists (XINT (from), XINT (count), 0, 1); | |
2894 } | |
2895 | |
2896 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
|
2897 0, 0, 0, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
2898 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
|
2899 This includes chars with "quote" or "prefix" syntax (' or p). */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
2900 (void) |
163 | 2901 { |
110551
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2902 EMACS_INT beg = BEGV; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2903 EMACS_INT opoint = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2904 EMACS_INT opoint_byte = PT_BYTE; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2905 EMACS_INT pos = PT; |
f28cc7ff91f9
Fix int/EMACS_INT use in casefiddle.c and syntax.c.
Eli Zaretskii <eliz@gnu.org>
parents:
110533
diff
changeset
|
2906 EMACS_INT pos_byte = PT_BYTE; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2907 int c; |
163 | 2908 |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
2909 if (pos <= beg) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2910 { |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2911 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
|
2912 |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2913 return Qnil; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2914 } |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2915 |
22370
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2916 SETUP_SYNTAX_TABLE (pos, -1); |
1f0dc0251be3
(scan_lists): Properly skip the comment-fence character
Richard M. Stallman <rms@gnu.org>
parents:
22130
diff
changeset
|
2917 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2918 DEC_BOTH (pos, pos_byte); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2919 |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2920 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
|
2921 /* 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
|
2922 && ((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
|
2923 || SYNTAX_PREFIX (c))) |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2924 { |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2925 opoint = pos; |
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2926 opoint_byte = pos_byte; |
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2927 |
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2928 if (pos + 1 > beg) |
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2929 DEC_BOTH (pos, pos_byte); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2930 } |
163 | 2931 |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2932 SET_PT_BOTH (opoint, opoint_byte); |
163 | 2933 |
2934 return Qnil; | |
2935 } | |
2936 | |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2937 /* 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
|
2938 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
|
2939 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
|
2940 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
|
2941 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
|
2942 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
|
2943 after the beginning of a string, or after the end of a string. */ |
163 | 2944 |
3720
408c7ee69be7
(scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents:
3684
diff
changeset
|
2945 static void |
109364
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
2946 scan_sexps_forward (struct lisp_parse_state *stateptr, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
2947 EMACS_INT from, EMACS_INT from_byte, EMACS_INT end, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
2948 int targetdepth, int stopbefore, |
89a16701cde1
Convert old-style definitions
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
2949 Lisp_Object oldstate, int commentstop) |
163 | 2950 { |
2951 struct lisp_parse_state state; | |
2952 | |
2953 register enum syntaxcode code; | |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2954 int c1; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2955 int comnested; |
163 | 2956 struct level { int last, prev; }; |
2957 struct level levelstart[100]; | |
2958 register struct level *curlevel = levelstart; | |
2959 struct level *endlevel = levelstart + 100; | |
2960 register int depth; /* Paren depth of current scanning location. | |
2961 level - levelstart equals this except | |
2962 when the depth becomes negative. */ | |
2963 int mindepth; /* Lowest DEPTH value seen. */ | |
2964 int start_quoted = 0; /* Nonzero means starting after a char quote */ | |
2965 Lisp_Object tem; | |
96838
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
2966 EMACS_INT prev_from; /* Keep one character before FROM. */ |
e39a36c3dcc3
(find_start_pos, find_start_value)
Andreas Schwab <schwab@suse.de>
parents:
96752
diff
changeset
|
2967 EMACS_INT prev_from_byte; |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
2968 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
|
2969 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
|
2970 int nofence; |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
2971 int found; |
71867
c8c21ddb276e
(scan_sexps_forward): Use EMACS_INT for out_bytepos and
Andreas Schwab <schwab@suse.de>
parents:
71843
diff
changeset
|
2972 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
|
2973 int temp; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2974 |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2975 prev_from = from; |
20546
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2976 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
|
2977 if (from != BEGV) |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2978 DEC_BOTH (prev_from, prev_from_byte); |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2979 |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
2980 /* 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
|
2981 #define INC_FROM \ |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2982 do { prev_from = from; \ |
a475efff810e
(scan_sexps_forward): Additional arg FROM_BYTE. Calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
20486
diff
changeset
|
2983 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
|
2984 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
|
2985 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
|
2986 INC_BOTH (from, from_byte); \ |
48266
a404c0056619
(scan_sexps_forward): Undo last patch.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48236
diff
changeset
|
2987 if (from < end) \ |
a404c0056619
(scan_sexps_forward): Undo last patch.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48236
diff
changeset
|
2988 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
|
2989 } while (0) |
163 | 2990 |
2991 immediate_quit = 1; | |
2992 QUIT; | |
2993 | |
485 | 2994 if (NILP (oldstate)) |
163 | 2995 { |
2996 depth = 0; | |
2997 state.instring = -1; | |
2998 state.incomment = 0; | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
2999 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
|
3000 state.comstr_start = -1; /* no comment/string seen. */ |
163 | 3001 } |
3002 else | |
3003 { | |
3004 tem = Fcar (oldstate); | |
485 | 3005 if (!NILP (tem)) |
163 | 3006 depth = XINT (tem); |
3007 else | |
3008 depth = 0; | |
3009 | |
3010 oldstate = Fcdr (oldstate); | |
3011 oldstate = Fcdr (oldstate); | |
3012 oldstate = Fcdr (oldstate); | |
3013 tem = Fcar (oldstate); | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3014 /* Check whether we are inside string_fence-style string: */ |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3015 state.instring = (!NILP (tem) |
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3016 ? (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
|
3017 : -1); |
163 | 3018 |
3019 oldstate = Fcdr (oldstate); | |
3020 tem = Fcar (oldstate); | |
26272
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
3021 state.incomment = (!NILP (tem) |
1cbb1b30793d
Remove whitespace after open or in front of closing parentheses.
Gerd Moellmann <gerd@gnu.org>
parents:
26060
diff
changeset
|
3022 ? (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
|
3023 : 0); |
163 | 3024 |
3025 oldstate = Fcdr (oldstate); | |
3026 tem = Fcar (oldstate); | |
485 | 3027 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
|
3028 |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3029 /* 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
|
3030 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
|
3031 oldstate = Fcdr (oldstate); |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3032 oldstate = Fcdr (oldstate); |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3033 tem = Fcar (oldstate); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3034 state.comstyle = (NILP (tem) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3035 ? 0 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3036 : (EQ (tem, Qsyntax_table) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3037 ? ST_COMMENT_STYLE |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3038 : INTEGERP (tem) ? XINT (tem) : 1)); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3039 |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3040 oldstate = Fcdr (oldstate); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3041 tem = Fcar (oldstate); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3042 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
|
3043 oldstate = Fcdr (oldstate); |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3044 tem = Fcar (oldstate); |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3045 while (!NILP (tem)) /* >= second enclosing sexps. */ |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3046 { |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3047 /* 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
|
3048 curlevel->last = XINT (Fcar (tem)); |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3049 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
|
3050 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
|
3051 curlevel->prev = -1; |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3052 curlevel->last = -1; |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3053 tem = Fcdr (tem); |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3054 } |
163 | 3055 } |
3056 state.quoted = 0; | |
3057 mindepth = depth; | |
3058 | |
3059 curlevel->prev = -1; | |
3060 curlevel->last = -1; | |
3061 | |
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3062 SETUP_SYNTAX_TABLE (prev_from, 1); |
56067
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
3063 temp = FETCH_CHAR (prev_from_byte); |
c1e92ca4c785
(char_quoted): Avoid warning about undefined operation.
Andreas Schwab <schwab@suse.de>
parents:
55423
diff
changeset
|
3064 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
|
3065 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
|
3066 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3067 /* Enter the loop at a place appropriate for initial state. */ |
163 | 3068 |
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3069 if (state.incomment) |
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3070 goto startincomment; |
163 | 3071 if (state.instring >= 0) |
3072 { | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3073 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
|
3074 if (start_quoted) |
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3075 goto startquotedinstring; |
163 | 3076 goto startinstring; |
3077 } | |
22994
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3078 else if (start_quoted) |
85f64bf341c3
(scan_sexps_forward): Set up the syntax table scanning
Richard M. Stallman <rms@gnu.org>
parents:
22547
diff
changeset
|
3079 goto startquoted; |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3080 |
163 | 3081 while (from < end) |
3082 { | |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3083 int syntax; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3084 INC_FROM; |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3085 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
|
3086 |
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
|
3087 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
|
3088 && 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
|
3089 && (c1 = FETCH_CHAR (from_byte), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3090 syntax = SYNTAX_WITH_FLAGS (c1), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3091 SYNTAX_FLAGS_COMSTART_SECOND (syntax))) |
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
|
3092 /* 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
|
3093 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
|
3094 { |
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
|
3095 /* 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
|
3096 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
|
3097 terminates the comment section. */ |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3098 state.comstyle |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3099 = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); |
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
|
3100 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3101 comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
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
|
3102 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
|
3103 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
|
3104 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
|
3105 code = Scomment; |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3106 } |
18491
bf0d449581c8
(scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents:
18113
diff
changeset
|
3107 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
|
3108 { |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3109 /* 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
|
3110 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
|
3111 terminates the comment section. */ |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3112 state.comstyle = ST_COMMENT_STYLE; |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3113 state.incomment = -1; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3114 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
|
3115 code = Scomment; |
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3116 } |
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
|
3117 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
|
3118 { |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3119 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax, 0); |
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
|
3120 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
|
3121 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
|
3122 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
|
3123 } |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3124 |
21207
390b39d69836
(Fbackward_prefix_chars): Set point properly while scanning.
Richard M. Stallman <rms@gnu.org>
parents:
21011
diff
changeset
|
3125 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) |
163 | 3126 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
|
3127 switch (SWITCH_ENUM_CAST (code)) |
163 | 3128 { |
3129 case Sescape: | |
3130 case Scharquote: | |
3131 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
|
3132 curlevel->last = prev_from; |
163 | 3133 startquoted: |
3134 if (from == end) goto endquoted; | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3135 INC_FROM; |
163 | 3136 goto symstarted; |
3137 /* treat following character as a word constituent */ | |
3138 case Sword: | |
3139 case Ssymbol: | |
3140 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
|
3141 curlevel->last = prev_from; |
163 | 3142 symstarted: |
3143 while (from < end) | |
3144 { | |
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3145 /* 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
|
3146 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
|
3147 temp = SYNTAX (temp); |
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3148 switch (temp) |
163 | 3149 { |
3150 case Scharquote: | |
3151 case Sescape: | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3152 INC_FROM; |
163 | 3153 if (from == end) goto endquoted; |
3154 break; | |
3155 case Sword: | |
3156 case Ssymbol: | |
3157 case Squote: | |
3158 break; | |
3159 default: | |
3160 goto symdone; | |
3161 } | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3162 INC_FROM; |
163 | 3163 } |
3164 symdone: | |
3165 curlevel->prev = curlevel->last; | |
3166 break; | |
3167 | |
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
|
3168 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
|
3169 case Scomment: |
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3170 if (commentstop || boundary_stop) goto done; |
9475
c15caadae3c4
(scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents:
9411
diff
changeset
|
3171 startincomment: |
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3172 /* 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
|
3173 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
|
3174 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
|
3175 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
|
3176 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
|
3177 state.incomment, state.comstyle, |
29821
819dfcbd36c7
(describe_syntax): Recognize the `n'estable bit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29757
diff
changeset
|
3178 (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
|
3179 ? 0 : prev_from_syntax, |
25445
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3180 &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
|
3181 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
|
3182 /* 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
|
3183 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
|
3184 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
|
3185 if (!found) goto done; |
29823
5a736b07dbf2
(scan_sexps_forward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29821
diff
changeset
|
3186 INC_FROM; |
163 | 3187 state.incomment = 0; |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3188 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
|
3189 if (boundary_stop) goto done; |
163 | 3190 break; |
3191 | |
3192 case Sopen: | |
3193 if (stopbefore) goto stop; /* this arg means stop at sexp start */ | |
3194 depth++; | |
3195 /* 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
|
3196 curlevel->last = prev_from; |
163 | 3197 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
|
3198 curlevel--; /* error ("Nesting too deep for parser"); */ |
163 | 3199 curlevel->prev = -1; |
3200 curlevel->last = -1; | |
12894
b2a75405de3c
(scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12870
diff
changeset
|
3201 if (targetdepth == depth) goto done; |
163 | 3202 break; |
3203 | |
3204 case Sclose: | |
3205 depth--; | |
3206 if (depth < mindepth) | |
3207 mindepth = depth; | |
3208 if (curlevel != levelstart) | |
3209 curlevel--; | |
3210 curlevel->prev = curlevel->last; | |
12894
b2a75405de3c
(scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12870
diff
changeset
|
3211 if (targetdepth == depth) goto done; |
163 | 3212 break; |
3213 | |
3214 case Sstring: | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3215 case Sstring_fence: |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3216 state.comstr_start = from - 1; |
163 | 3217 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
|
3218 curlevel->last = prev_from; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3219 state.instring = (code == Sstring |
89063
2054397a36be
(char_quoted): Use FETCH_CHAR_AS_MULTIBYTE to convert
Kenichi Handa <handa@m17n.org>
parents:
89010
diff
changeset
|
3220 ? (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
|
3221 : ST_STRING_STYLE); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3222 if (boundary_stop) goto done; |
163 | 3223 startinstring: |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3224 { |
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3225 nofence = state.instring != ST_STRING_STYLE; |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3226 |
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3227 while (1) |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3228 { |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3229 int c; |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3230 |
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3231 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
|
3232 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
|
3233 /* 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
|
3234 temp = SYNTAX (c); |
24148
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3235 |
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3236 /* 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
|
3237 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
|
3238 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
|
3239 if (nofence && c == state.instring && temp == Sstring) |
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3240 break; |
b69751ec40fe
(scan_sexps_forward): Delete duplicate code
Karl Heuer <kwzh@gnu.org>
parents:
23503
diff
changeset
|
3241 |
22006
31c39cdc9e11
(scan_lists, scan_sexps_forward): Move complex expressions
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
3242 switch (temp) |
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3243 { |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3244 case Sstring_fence: |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3245 if (!nofence) goto string_end; |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3246 break; |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3247 case Scharquote: |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3248 case Sescape: |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3249 INC_FROM; |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3250 startquotedinstring: |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3251 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
|
3252 } |
20475
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3253 INC_FROM; |
efbebc38e077
Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents:
20330
diff
changeset
|
3254 } |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3255 } |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3256 string_end: |
163 | 3257 state.instring = -1; |
3258 curlevel->prev = curlevel->last; | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3259 INC_FROM; |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3260 if (boundary_stop) goto done; |
163 | 3261 break; |
3262 | |
3263 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
|
3264 /* 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
|
3265 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
|
3266 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
|
3267 /* Ignore whitespace, punctuation, quote, endcomment. */ |
163 | 3268 break; |
3269 } | |
3270 } | |
3271 goto done; | |
3272 | |
3273 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
|
3274 from = prev_from; /* We have just fetched the char that starts it; */ |
163 | 3275 goto done; /* but return the position before it. */ |
3276 | |
3277 endquoted: | |
3278 state.quoted = 1; | |
3279 done: | |
3280 state.depth = depth; | |
3281 state.mindepth = mindepth; | |
3282 state.thislevelstart = curlevel->prev; | |
3283 state.prevlevelstart | |
3284 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last; | |
3285 state.location = from; | |
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3286 state.levelstarts = Qnil; |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3287 while (--curlevel >= levelstart) |
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3288 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
|
3289 state.levelstarts); |
163 | 3290 immediate_quit = 0; |
3291 | |
1085
91a456e52db1
(scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents:
726
diff
changeset
|
3292 *stateptr = state; |
163 | 3293 } |
3294 | |
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
3295 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
|
3296 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
|
3297 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
|
3298 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
|
3299 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
|
3300 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
|
3301 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
|
3302 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
|
3303 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
|
3304 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
|
3305 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
|
3306 (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
|
3307 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
|
3308 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
|
3309 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
|
3310 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
|
3311 6. the minimum paren-depth encountered during this scan. |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3312 7. style of comment, if any. |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39796
diff
changeset
|
3313 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
|
3314 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
|
3315 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
|
3316 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
|
3317 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
|
3318 any character that starts a sexp. |
66525
aaac09f838e0
(Fparse_partial_sexp): Fix docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65215
diff
changeset
|
3319 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
|
3320 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
|
3321 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
|
3322 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
|
3323 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
|
3324 string, or after end of a comment or a string. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
3325 (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) |
163 | 3326 { |
3327 struct lisp_parse_state state; | |
3328 int target; | |
3329 | |
485 | 3330 if (!NILP (targetdepth)) |
163 | 3331 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40286
diff
changeset
|
3332 CHECK_NUMBER (targetdepth); |
163 | 3333 target = XINT (targetdepth); |
3334 } | |
3335 else | |
3336 target = -100000; /* We won't reach this depth */ | |
3337 | |
3338 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
|
3339 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
|
3340 XINT (to), |
3568
3ee951a22a80
(Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents:
3095
diff
changeset
|
3341 target, !NILP (stopbefore), oldstate, |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3342 (NILP (commentstop) |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3343 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1))); |
163 | 3344 |
3345 SET_PT (state.location); | |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3346 |
163 | 3347 return Fcons (make_number (state.depth), |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3348 Fcons (state.prevlevelstart < 0 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3349 ? Qnil : make_number (state.prevlevelstart), |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3350 Fcons (state.thislevelstart < 0 |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3351 ? Qnil : make_number (state.thislevelstart), |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3352 Fcons (state.instring >= 0 |
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3353 ? (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
|
3354 ? 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
|
3355 Fcons (state.incomment < 0 ? Qt : |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3356 (state.incomment == 0 ? Qnil : |
d678b229c05a
(lisp_parse_state, back_comment, Fmodify_syntax_entry)
Richard M. Stallman <rms@gnu.org>
parents:
25401
diff
changeset
|
3357 make_number (state.incomment)), |
163 | 3358 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
|
3359 Fcons (make_number (state.mindepth), |
47942
080b4586492b
Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
47872
diff
changeset
|
3360 Fcons ((state.comstyle |
20486
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3361 ? (state.comstyle == ST_COMMENT_STYLE |
109757
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3362 ? Qsyntax_table |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3363 : make_number (state.comstyle)) |
818e325e0469
Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
109364
diff
changeset
|
3364 : Qnil), |
24728
e94104cf5891
(Fparse_partial_sexp): Correct test for element 8 to be
Dave Love <fx@gnu.org>
parents:
24148
diff
changeset
|
3365 Fcons (((state.incomment |
e94104cf5891
(Fparse_partial_sexp): Correct test for element 8 to be
Dave Love <fx@gnu.org>
parents:
24148
diff
changeset
|
3366 || (state.instring >= 0)) |
20486
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3367 ? make_number (state.comstr_start) |
26d12c66acc1
(Fparse_partial_sexp): Return nil for 9th element
Richard M. Stallman <rms@gnu.org>
parents:
20475
diff
changeset
|
3368 : Qnil), |
22394
5e1f0caf1873
(struct lisp_parse_state): New field, levelstarts.
Richard M. Stallman <rms@gnu.org>
parents:
22370
diff
changeset
|
3369 Fcons (state.levelstarts, Qnil)))))))))); |
163 | 3370 } |
3371 | |
21514 | 3372 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3373 init_syntax_once (void) |
163 | 3374 { |
17126
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3375 register int i, c; |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3376 Lisp_Object temp; |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3377 |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3378 /* This has to be done here, before we call Fmake_char_table. */ |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3379 Qsyntax_table = intern_c_string ("syntax-table"); |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3380 staticpro (&Qsyntax_table); |
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3381 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3382 /* Intern_C_String this now in case it isn't already done. |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3383 Setting this variable twice is harmless. |
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3384 But don't staticpro it here--that is done in alloc.c. */ |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3385 Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3386 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3387 /* 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
|
3388 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
|
3389 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
|
3390 XVECTOR (Vsyntax_code_object)->contents[i] |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3391 = Fcons (make_number (i), Qnil); |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3392 |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3393 /* 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
|
3394 create syntax tables. */ |
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3395 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
|
3396 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3397 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
|
3398 |
13218
d2fc560c7740
(Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13144
diff
changeset
|
3399 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); |
163 | 3400 |
71395
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3401 /* 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
|
3402 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
|
3403 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
|
3404 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
|
3405 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
|
3406 |
923b7f99b0d7
(init_syntax_once): Give most control chars' syntax Spunct.
Richard M. Stallman <rms@gnu.org>
parents:
70317
diff
changeset
|
3407 /* 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
|
3408 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
|
3409 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
|
3410 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
|
3411 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
|
3412 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
|
3413 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
|
3414 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3415 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; |
163 | 3416 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
|
3417 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
163 | 3418 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
|
3419 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); |
163 | 3420 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
|
3421 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
|
3422 |
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3423 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
|
3424 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '%', temp); |
163 | 3425 |
13144
fd14ccddb85a
(describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents:
12894
diff
changeset
|
3426 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
|
3427 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
|
3428 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
|
3429 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
|
3430 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
|
3431 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
|
3432 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
|
3433 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
|
3434 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
|
3435 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
|
3436 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
|
3437 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
|
3438 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
|
3439 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
|
3440 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
|
3441 Fcons (make_number ((int) Sescape), Qnil)); |
163 | 3442 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3443 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol]; |
163 | 3444 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
|
3445 { |
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3446 c = "_-+*/&|<>="[i]; |
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3447 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
|
3448 } |
163 | 3449 |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3450 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; |
163 | 3451 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
|
3452 { |
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3453 c = ".,;:?!#@~^'`"[i]; |
f8d7263cce09
(init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents:
17109
diff
changeset
|
3454 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
|
3455 } |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3456 |
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3457 /* All multibyte characters have syntax `word' by default. */ |
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3458 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
|
3459 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); |
163 | 3460 } |
3461 | |
21514 | 3462 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
3463 syms_of_syntax (void) |
163 | 3464 { |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3465 Qsyntax_table_p = intern_c_string ("syntax-table-p"); |
163 | 3466 staticpro (&Qsyntax_table_p); |
3467 | |
17044
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3468 staticpro (&Vsyntax_code_object); |
f07c36097f33
Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents:
16992
diff
changeset
|
3469 |
64319
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3470 staticpro (&gl_state.object); |
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3471 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
|
3472 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
|
3473 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
|
3474 |
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3475 /* Defined in regex.c */ |
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3476 staticpro (&re_match_object); |
6ba9b52e77fc
(syms_of_syntax): Staticpro lisp objects in gl_state.
Kim F. Storm <storm@cua.dk>
parents:
64084
diff
changeset
|
3477 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3478 Qscan_error = intern_c_string ("scan-error"); |
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3479 staticpro (&Qscan_error); |
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3480 Fput (Qscan_error, Qerror_conditions, |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3481 pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); |
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3482 Fput (Qscan_error, Qerror_message, |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
3483 make_pure_c_string ("Scan error")); |
16992
ff7346c31184
(scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents:
16039
diff
changeset
|
3484 |
163 | 3485 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
|
3486 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); |
163 | 3487 |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3488 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
|
3489 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
|
3490 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
|
3491 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
|
3492 `syntax-table' property. */); |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3493 |
163 | 3494 words_include_escapes = 0; |
3495 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
|
3496 doc: /* Non-nil means `forward-word', etc., should treat escape chars part of words. */); |
163 | 3497 |
27812
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3498 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
|
3499 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
|
3500 multibyte_syntax_as_symbol = 0; |
e2216823484d
(multibyte_syntax_as_symbol): New variable.
Kenichi Handa <handa@m17n.org>
parents:
27719
diff
changeset
|
3501 |
28302
27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28269
diff
changeset
|
3502 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
|
3503 &open_paren_in_column_0_is_defun_start, |
49551 | 3504 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
|
3505 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
|
3506 |
89483 | 3507 |
3508 DEFVAR_LISP ("find-word-boundary-function-table", | |
3509 &Vfind_word_boundary_function_table, | |
88970
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3510 doc: /* |
89483 | 3511 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
|
3512 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
|
3513 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
|
3514 |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3515 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
|
3516 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
|
3517 character of that word. |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3518 |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3519 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
|
3520 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
|
3521 character of that word. |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3522 |
a65b3bd9379c
(Vnext_word_boundary_function_table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88935
diff
changeset
|
3523 In both cases, LIMIT bounds the search. */); |
89483 | 3524 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
|
3525 |
163 | 3526 defsubr (&Ssyntax_table_p); |
3527 defsubr (&Ssyntax_table); | |
3528 defsubr (&Sstandard_syntax_table); | |
3529 defsubr (&Scopy_syntax_table); | |
3530 defsubr (&Sset_syntax_table); | |
3531 defsubr (&Schar_syntax); | |
7968
a6372621abd9
(Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7924
diff
changeset
|
3532 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
|
3533 defsubr (&Sstring_to_syntax); |
163 | 3534 defsubr (&Smodify_syntax_entry); |
40663
046e69b1b128
(describe_syntax): New wrapper.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40656
diff
changeset
|
3535 defsubr (&Sinternal_describe_syntax_value); |
163 | 3536 |
3537 defsubr (&Sforward_word); | |
3538 | |
17464
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3539 defsubr (&Sskip_chars_forward); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3540 defsubr (&Sskip_chars_backward); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3541 defsubr (&Sskip_syntax_forward); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3542 defsubr (&Sskip_syntax_backward); |
36483a1ada24
(SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents:
17126
diff
changeset
|
3543 |
1998
656f4297962e
(describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents:
1394
diff
changeset
|
3544 defsubr (&Sforward_comment); |
163 | 3545 defsubr (&Sscan_lists); |
3546 defsubr (&Sscan_sexps); | |
3547 defsubr (&Sbackward_prefix_chars); | |
3548 defsubr (&Sparse_partial_sexp); | |
3549 } | |
52401 | 3550 |
3551 /* arch-tag: 3e297b9f-088e-4b64-8f4c-fb0b3443e412 | |
3552 (do not change this comment) */ |