annotate src/syntax.c @ 20483:141c2d41d39c

(toggle-enable-multibyte-characters): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sun, 21 Dec 1997 01:49:03 +0000
parents efbebc38e077
children 26d12c66acc1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
17466
c6ba5208968b Update copyright year.
Richard M. Stallman <rms@gnu.org>
parents: 17464
diff changeset
2 Copyright (C) 1985, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
726
5f08efa38dd0 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 any later version.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 GNU General Public License for more details.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14087
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14087
diff changeset
19 Boston, MA 02111-1307, USA. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 4458
diff changeset
22 #include <config.h>
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 #include <ctype.h>
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 #include "lisp.h"
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 #include "commands.h"
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include "buffer.h"
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
27 #include "charset.h"
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
28
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
29 /* 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
30 #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
31
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 #include "syntax.h"
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
33 #include "intervals.h"
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
34
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
35 /* 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
36 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
37 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
38
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
39 #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
40 #define ST_STRING_STYLE (256 + 2)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
41 #include "category.h"
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
43 Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
45 static void scan_sexps_forward ();
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
46 static int char_quoted ();
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
47
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 int words_include_escapes;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
49 int parse_sexp_lookup_properties;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
51 /* 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
52 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
53 only very temporarily. */
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
54 Lisp_Object syntax_temp;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
55
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
56 /* 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
57
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
58 struct lisp_parse_state
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
59 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
60 int depth; /* Depth at end of parsing. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
61 int instring; /* -1 if not within string, else desired terminator. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
62 int incomment; /* Nonzero if within a comment at end of parsing. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
63 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
64 int quoted; /* Nonzero if just after an escape char at end of parsing */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
65 int thislevelstart; /* Char number of most recent start-of-expression at current level */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
66 int prevlevelstart; /* Char number of start of containing expression */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
67 int location; /* Char number at which parsing stopped. */
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
68 int mindepth; /* Minimum depth seen while scanning. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
69 int comstr_start; /* Position just after last comment/string starter. */
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
70 };
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
71
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
72 /* 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
73 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
74 find_start_value is the defun start position found for it.
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
75 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
76 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
77 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
78
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
79 static int find_start_pos;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
80 static int find_start_value;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
81 static struct buffer *find_start_buffer;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
82 static int find_start_begv;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
83 static int find_start_modiff;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
84
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
85
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
86 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
87
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
88 INTERVAL interval_of ();
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
89 #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
90 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
91
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
92 /*
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
93 Update gl_state to an appropriate interval which contains POS. The
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
94 sign of COUNT give the relative position of POS wrt the previously
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
95 valid interval. If INIT, only [be]_property fields of gl_state are
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
96 valid at start, the rest is filled basing on OBJECT.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
97
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
98 `gl_state.*_i' are the intervals, and pos is further in the search
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
99 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
100 current syntax-table basing on the property of this interval, and
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
101 update the interval to start further than POS - or be
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
102 NULL_INTERVAL. We also update lim_property to be the next value of
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
103 pos to call this subroutine again - or be before/after the
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
104 start/end of OBJECT. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
105
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
106 void
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
107 update_syntax_table (pos, count, init, object)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
108 int pos, count, init;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
109 Lisp_Object object;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
110 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
111 Lisp_Object tmp_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
112 int cnt = 0, doing_extra = 0, invalidate = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
113 INTERVAL i, oldi;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
114
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
115 if (init)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
116 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
117 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
118 gl_state.stop = gl_state.e_property;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
119 gl_state.forward_i = interval_of (pos, object);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
120 i = gl_state.backward_i = gl_state.forward_i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
121 gl_state.left_ok = gl_state.right_ok = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
122 invalidate = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
123 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
124 return;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
125 gl_state.b_property = i->position - 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
126 gl_state.e_property = INTERVAL_LAST_POS (i);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
127 goto update;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
128 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
129 oldi = i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
130
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
131 /* We are guarantied to be called with pos either in i, of further off. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
132 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
133 error ("Error in syntax_table logic for to-the-end intervals");
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
134 else if (pos < i->position) /* Move left. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
135 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
136 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
137 error ("Error in syntax_table logic for intervals <-.");
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
138 /* Update the interval. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
139 i = update_interval (i, pos);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
140 if (oldi->position != INTERVAL_LAST_POS (i))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
141 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
142 invalidate = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
143 gl_state.right_ok = 1; /* Invalidate the other end. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
144 gl_state.forward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
145 gl_state.e_property = INTERVAL_LAST_POS (i);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
146 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
147 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
148 else if (pos >= INTERVAL_LAST_POS (i)) /* Move right. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
149 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
150 if (count < 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
151 error ("Error in syntax_table logic for intervals ->.");
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
152 /* Update the interval. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
153 i = update_interval (i, pos);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
154 if (i->position != INTERVAL_LAST_POS (oldi))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
155 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
156 invalidate = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
157 gl_state.left_ok = 1; /* Invalidate the other end. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
158 gl_state.backward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
159 gl_state.b_property = i->position - 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
160 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
161 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
162 else if (count > 0 ? gl_state.right_ok : gl_state.left_ok)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
163 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
164 /* We do not need to recalculate tmp_table. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
165 tmp_table = gl_state.old_prop;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
166 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
167
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
168 update:
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
169 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
170
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
171 if (invalidate)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
172 invalidate = !EQ (tmp_table, gl_state.old_prop); /* Need to invalidate? */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
173
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
174 if (invalidate) /* Did not get to adjacent interval. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
175 { /* with the same table => */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
176 /* invalidate the old range. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
177 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
178 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
179 gl_state.backward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
180 gl_state.left_ok = 1; /* Invalidate the other end. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
181 gl_state.b_property = i->position - 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
182 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
183 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
184 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
185 gl_state.forward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
186 gl_state.right_ok = 1; /* Invalidate the other end. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
187 gl_state.e_property = INTERVAL_LAST_POS (i);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
188 }
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
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
191 gl_state.current_syntax_table = tmp_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
192 gl_state.old_prop = tmp_table;
18613
614b916ff5bf Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents: 18491
diff changeset
193 if (EQ (Fsyntax_table_p (tmp_table), Qt))
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
194 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
195 gl_state.use_global = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
196 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
197 else if (CONSP (tmp_table))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
198 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
199 gl_state.use_global = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
200 gl_state.global_code = tmp_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
201 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
202 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
203 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
204 gl_state.use_global = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
205 gl_state.current_syntax_table = current_buffer->syntax_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
206 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
207
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
208 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
209 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
210 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
211 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
212 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
213 gl_state.right_ok = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
214 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
215 gl_state.left_ok = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
216 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
217 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
218 else if (cnt == INTERVALS_AT_ONCE)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
219 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
220 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
221 gl_state.right_ok = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
222 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
223 gl_state.left_ok = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
224 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
225 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
226 cnt++;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
227 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
228 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
229 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
230 { /* This property goes to the end. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
231 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
232 gl_state.e_property = gl_state.stop;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
233 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
234 gl_state.b_property = gl_state.start;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
235 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
236 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
237 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
238 if (count > 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
239 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
240 gl_state.e_property = i->position;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
241 gl_state.forward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
242 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
243 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
244 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
245 gl_state.b_property = i->position + LENGTH (i) - 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
246 gl_state.backward_i = i;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
247 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
248 }
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
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
251 /* Returns TRUE if char at POS is quoted.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
252 Global syntax-table data should be set up already to be good at pos
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
253 or after. On return global syntax data is good for lookup at POS. */
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 static int
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
256 char_quoted (pos)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
257 register int pos;
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 register enum syntaxcode code;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
260 register int beg = BEGV;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
261 register int quoted = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
262 int temp_pos = pos;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
263
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
264 DEC_POS (temp_pos);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
265 while (temp_pos >= beg
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
266 && ( UPDATE_SYNTAX_TABLE_BACKWARD (temp_pos), 1)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
267 && ((code = SYNTAX (FETCH_CHAR (temp_pos))) == Scharquote
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
268 || code == Sescape))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
269 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
270 temp_pos--, quoted = !quoted;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
271 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
272 UPDATE_SYNTAX_TABLE (pos);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
273 return quoted;
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
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
276 /* Find a defun-start that is the last one before POS (or nearly the last).
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
277 We record what we find, so that another call in the same area
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
278 can return the same value right away.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
279
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
280 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
281 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
282 update the global data. */
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
283
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
284 static int
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
285 find_defun_start (pos)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
286 int pos;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
287 {
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
288 int tem;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
289 int shortage;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
290
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
291 /* 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
292 if (current_buffer == find_start_buffer
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
293 /* 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
294 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
295 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
296 && pos <= find_start_pos + 1000
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
297 && pos >= find_start_value
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
298 && BEGV == find_start_begv
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
299 && MODIFF == find_start_modiff)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
300 return find_start_value;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
301
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
302 /* Back up to start of line. */
9411
0b9c70f56cf8 * syntax.c (find_defun_start): Call scan_buffer with new args.
Jim Blandy <jimb@redhat.com>
parents: 9333
diff changeset
303 tem = scan_buffer ('\n', pos, BEGV, -1, &shortage, 1);
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
304
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
305 /* 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
306 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
307 syntax-tables. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
308 gl_state.current_syntax_table = current_buffer->syntax_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
309 gl_state.use_global = 0;
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
310 while (tem > BEGV)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
311 {
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
312 /* Open-paren at start of line means we found our defun-start. */
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
313 if (SYNTAX (FETCH_CHAR (tem)) == Sopen)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
314 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
315 SETUP_SYNTAX_TABLE (tem + 1, -1); /* Try again... */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
316 if (SYNTAX (FETCH_CHAR (tem)) == Sopen)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
317 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
318 /* Now fallback to the default value. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
319 gl_state.current_syntax_table = current_buffer->syntax_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
320 gl_state.use_global = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
321 }
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
322 /* Move to beg of previous line. */
9411
0b9c70f56cf8 * syntax.c (find_defun_start): Call scan_buffer with new args.
Jim Blandy <jimb@redhat.com>
parents: 9333
diff changeset
323 tem = scan_buffer ('\n', tem, BEGV, -2, &shortage, 1);
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
324 }
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
325
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
326 /* Record what we found, for the next try. */
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
327 find_start_value = tem;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
328 find_start_buffer = current_buffer;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
329 find_start_modiff = MODIFF;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
330 find_start_begv = BEGV;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
331 find_start_pos = pos;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
332
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
333 return find_start_value;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
334 }
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
335
20330
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
336 /* Checks whether FROM is at the end of a comment;
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
337 and if so, returns position of the start of the comment.
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
338 But does not move back before STOP.
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
339 Returns -1 if there is no comment ending at FROM.
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
340
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
341 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
342 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
343
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
344 static int
18079
5fbb5aef5649 (back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents: 17786
diff changeset
345 back_comment (from, stop, comstyle)
5fbb5aef5649 (back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents: 17786
diff changeset
346 int from, stop, comstyle;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
347 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
348 /* 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
349 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
350 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
351 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
352 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
353
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
354 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
355 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
356 PARITY is current parity of 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
357 int parity = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
358 int my_stringend = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
359 int string_lossage = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
360 int comment_end = from;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
361 int comstart_pos = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
362 int comstart_parity = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
363 int scanstart = from - 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
364 register enum syntaxcode code;
18079
5fbb5aef5649 (back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents: 17786
diff changeset
365 int c;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
366
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
367 /* 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
368 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
369 while (from != stop)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
370 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
371 /* Move back and examine a character. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
372 DEC_POS (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
373 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
374
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
375 c = FETCH_CHAR (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
376 code = SYNTAX (c);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
377
20330
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
378 /* If this char is the second of a 2-char comment end sequence,
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
379 back up and give the pair the appropriate syntax. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
380 if (from > stop && SYNTAX_COMEND_SECOND (c)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
381 && SYNTAX_COMEND_FIRST (FETCH_CHAR (from - 1)))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
382 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
383 code = Sendcomment;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
384 DEC_POS (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
385 /* This is apparently the best we can do: */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
386 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
387 c = FETCH_CHAR (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
388 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
389
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
390 /* If this char starts a 2-char comment start sequence,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
391 treat it like a 1-char comment starter. */
20330
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
392 if (from < scanstart && SYNTAX_COMSTART_FIRST (c)
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
393 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from + 1))
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
394 && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (from + 1)))
f76b9c0ebc4b (back_comment): Handle 2-char comment starts
Karl Heuer <kwzh@gnu.org>
parents: 20292
diff changeset
395 code = Scomment;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
396
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
397 /* Ignore escaped characters. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
398 if (char_quoted (from))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
399 continue;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
400
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
401 /* Track parity of quotes. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
402 if (code == Sstring)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
403 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
404 parity ^= 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
405 if (my_stringend == 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
406 my_stringend = c;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
407 /* If we have two kinds of string delimiters.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
408 There's no way to grok this scanning backwards. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
409 else if (my_stringend != c)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
410 string_lossage = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
411 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
412
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
413 if (code == Sstring_fence || code == Scomment_fence)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
414 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
415 parity ^= 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
416 if (my_stringend == 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
417 my_stringend =
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
418 code == Sstring_fence ? ST_STRING_STYLE : ST_COMMENT_STYLE;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
419 /* If we have two kinds of string delimiters.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
420 There's no way to grok this scanning backwards. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
421 else if (my_stringend != (code == Sstring_fence
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
422 ? ST_STRING_STYLE : ST_COMMENT_STYLE))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
423 string_lossage = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
424 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
425
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
426 /* Record comment-starters according to that
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
427 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
428 if (code == Scomment)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
429 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
430 comstart_parity = parity;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
431 comstart_pos = from;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
432 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
433
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
434 /* If we find another earlier comment-ender,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
435 any comment-starts earlier than that don't count
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
436 (because they go with the earlier comment-ender). */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
437 if (code == Sendcomment
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
438 && SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)) == comstyle)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
439 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
440
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
441 /* Assume a defun-start point is outside of strings. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
442 if (code == Sopen
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
443 && (from == stop || FETCH_CHAR (from - 1) == '\n'))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
444 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
445 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
446
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
447 if (comstart_pos == 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
448 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
449 from = comment_end;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
450 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
451 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
452 /* If the earliest comment starter
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
453 is followed by uniform paired string quotes or none,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
454 we know it can't be inside a string
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
455 since if it were then the comment ender would be inside one.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
456 So it does start a comment. Skip back to it. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
457 else if (comstart_parity == 0 && !string_lossage)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
458 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
459 from = comstart_pos;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
460 /* Globals are correct now. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
461 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
462 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
463 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
464 /* 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
465 together. Decode this going forwards.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
466 Scan fwd from the previous comment ender
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
467 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
468 last passed a comment starter. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
469 struct lisp_parse_state state;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
470 scan_sexps_forward (&state, find_defun_start (comment_end),
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
471 comment_end - 1, -10000, 0, Qnil, 0);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
472 if (state.incomment)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
473 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
474 /* scan_sexps_forward changed the direction of search in
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
475 global variables, so we need to update it completely. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
476
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
477 from = state.comstr_start;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
478 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
479 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
480 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
481 from = comment_end;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
482 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
483 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
484 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
485
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
486 return from;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
487 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
488
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0,
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
490 "Return t if OBJECT is a syntax table.\n\
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
491 Currently, any char-table counts as a syntax table.")
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
492 (object)
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
493 Lisp_Object object;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 {
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
495 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
496 && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 return Qt;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
501 static void
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 check_syntax_table (obj)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 Lisp_Object obj;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 {
13513
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
505 if (!(CHAR_TABLE_P (obj)
18113
9f7fdb0f76f3 (Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents: 18080
diff changeset
506 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table)))
13513
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
507 wrong_type_argument (Qsyntax_table_p, obj);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 "Return the current syntax table.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 This is the one specified by the current buffer.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 return current_buffer->syntax_table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 DEFUN ("standard-syntax-table", Fstandard_syntax_table,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 Sstandard_syntax_table, 0, 0, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 "Return the standard syntax table.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 This is the one used for new buffers.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 return Vstandard_syntax_table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 "Construct a new syntax table and return it.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 It is a copy of the TABLE, which defaults to the standard syntax table.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (table)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 Lisp_Object table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
533 Lisp_Object copy;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
534
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
535 if (!NILP (table))
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
536 check_syntax_table (table);
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
537 else
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
538 table = Vstandard_syntax_table;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
540 copy = Fcopy_sequence (table);
14661
46ba65e7976c (Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
541
46ba65e7976c (Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
542 /* 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
543 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
544 XCHAR_TABLE (copy)->defalt = Qnil;
46ba65e7976c (Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
545
46ba65e7976c (Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
546 /* 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
547 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
548 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
549 if (NILP (XCHAR_TABLE (copy)->parent))
46ba65e7976c (Fcopy_syntax_table): Set default to nil.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
550 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
551 return copy;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 "Select a new syntax table for the current buffer.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 One argument, a syntax table.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 (table)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 Lisp_Object table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
560 check_syntax_table (table);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 current_buffer->syntax_table = table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 /* Indicate that this buffer now has a specified syntax table. */
3684
2be7629a9e17 (Fset_syntax_table): Add XFASTINT.
Richard M. Stallman <rms@gnu.org>
parents: 3609
diff changeset
563 current_buffer->local_var_flags
2be7629a9e17 (Fset_syntax_table): Add XFASTINT.
Richard M. Stallman <rms@gnu.org>
parents: 3609
diff changeset
564 |= XFASTINT (buffer_local_flags.syntax_table);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 return table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 /* Convert a letter which signifies a syntax code
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 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
570 This is used by modify-syntax-entry, and other things. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 unsigned char syntax_spec_code[0400] =
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 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
577 (char) Swhitespace, (char) Scomment_fence, (char) Sstring, 0377,
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (char) Smath, 0377, 0377, (char) Squote,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (char) Sopen, (char) Sclose, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 0377, (char) Swhitespace, (char) Spunct, (char) Scharquote,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (char) Scomment, 0377, (char) Sendcomment, 0377,
5442
8cbae747a768 (describe_syntax): Handle Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 5339
diff changeset
584 (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 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
591 0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 };
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
594 /* Indexed by syntax code, give the letter that describes it. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
596 char syntax_code_spec[16] =
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
598 ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@',
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
599 '!', '|'
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 };
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
601
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
602 /* 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
603 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
604 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
605 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
606 compact listing. */
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
607 static Lisp_Object Vsyntax_code_object;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
608
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
610 /* Look up the value for CHARACTER in syntax table TABLE's parent
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
611 and its parents. SYNTAX_ENTRY calls this, when TABLE itself has nil
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
612 for CHARACTER. It's actually used only when not compiled with GCC. */
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
613
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
614 Lisp_Object
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
615 syntax_parent_lookup (table, character)
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
616 Lisp_Object table;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
617 int character;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
618 {
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
619 Lisp_Object value;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
620
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
621 while (1)
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
622 {
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
623 table = XCHAR_TABLE (table)->parent;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
624 if (NILP (table))
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
625 return Qnil;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
626
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
627 value = XCHAR_TABLE (table)->contents[character];
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
628 if (!NILP (value))
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
629 return value;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
630 }
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
631 }
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
632
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 DEFUN ("char-syntax", Fchar_syntax, Schar_syntax, 1, 1, 0,
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
634 "Return the syntax code of CHARACTER, described by a character.\n\
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
635 For example, if CHARACTER is a word constituent,\n\
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
636 the character `w' is returned.\n\
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 The characters that correspond to various syntax codes\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 are listed in the documentation of `modify-syntax-entry'.")
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
639 (character)
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
640 Lisp_Object character;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
642 int char_int;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
643 gl_state.current_syntax_table = current_buffer->syntax_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
644
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
645 gl_state.use_global = 0;
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
646 CHECK_NUMBER (character, 0);
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
647 char_int = XINT (character);
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
648 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
649 }
a6372621abd9 (Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7924
diff changeset
650
a6372621abd9 (Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7924
diff changeset
651 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
652 "Return the matching parenthesis of CHARACTER, or nil if none.")
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
653 (character)
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
654 Lisp_Object character;
7968
a6372621abd9 (Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7924
diff changeset
655 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
656 int char_int, code;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
657 gl_state.current_syntax_table = current_buffer->syntax_table;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
658 gl_state.use_global = 0;
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
659 CHECK_NUMBER (character, 0);
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
660 char_int = XINT (character);
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
661 code = SYNTAX (char_int);
7975
49dc4ea976a0 (Fmatching_paren): Fix typo.
Richard M. Stallman <rms@gnu.org>
parents: 7968
diff changeset
662 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
663 return SYNTAX_MATCH (char_int);
7968
a6372621abd9 (Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7924
diff changeset
664 return Qnil;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 /* This comment supplies the doc string for modify-syntax-entry,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 for make-docfile to see. We cannot put this in the real DEFUN
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 due to limits in the Unix cpp.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670
4141
373bff27d0d6 * syntax.c (Fmodify_syntax_entry): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 3794
diff changeset
671 DEFUN ("modify-syntax-entry", foo, bar, 2, 3, 0,
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 "Set syntax for character CHAR according to string S.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 The syntax is changed only for table TABLE, which defaults to\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 the current buffer's syntax table.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 The first character of S should be one of the following:\n\
624
2bb7f23b7ea5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
676 Space or - whitespace syntax. w word constituent.\n\
2bb7f23b7ea5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
677 _ symbol constituent. . punctuation.\n\
2bb7f23b7ea5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
678 ( open-parenthesis. ) close-parenthesis.\n\
2bb7f23b7ea5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
679 \" string quote. \\ escape.\n\
2bb7f23b7ea5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
680 $ paired delimiter. ' expression quote or prefix operator.\n\
5339
b589e807c0b3 (Fmodify_syntax_entry): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4953
diff changeset
681 < comment starter. > comment ender.\n\
5442
8cbae747a768 (describe_syntax): Handle Sinherit.
Richard M. Stallman <rms@gnu.org>
parents: 5339
diff changeset
682 / character-quote. @ inherit from `standard-syntax-table'.\n\
5339
b589e807c0b3 (Fmodify_syntax_entry): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4953
diff changeset
683 \n\
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 Only single-character comment start and end sequences are represented thus.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 Two-character sequences are represented as described below.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 The second character of S is the matching parenthesis,\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 used only if the first character is `(' or `)'.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 Any additional characters are flags.\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
689 Defined flags are the characters 1, 2, 3, 4, b, and p.\n\
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
690 1 means CHAR is the start of a two-char comment start sequence.\n\
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
691 2 means CHAR is the second character of such a sequence.\n\
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
692 3 means CHAR is the start of a two-char comment end sequence.\n\
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
693 4 means CHAR is the second character of such a sequence.\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
694 \n\
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
695 There can be up to two orthogonal comment sequences. This is to support\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
696 language modes such as C++. By default, all comment sequences are of style\n\
5339
b589e807c0b3 (Fmodify_syntax_entry): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4953
diff changeset
697 a, but you can set the comment sequence style to b (on the second character\n\
b589e807c0b3 (Fmodify_syntax_entry): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4953
diff changeset
698 of a comment-start, or the first character of a comment-end sequence) using\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
699 this flag:\n\
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
700 b means CHAR is part of comment sequence b.\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
701 \n\
14087
1709d9f11c66 (Fsyntax_table_p, Fchar_syntax, Fmatching_paren, Fmodify_syntax_entry):
Erik Naggum <erik@naggum.no>
parents: 13513
diff changeset
702 p means CHAR is a prefix character for `backward-prefix-chars';\n\
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
703 such characters are treated as whitespace when they occur\n\
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 between expressions.")
4141
373bff27d0d6 * syntax.c (Fmodify_syntax_entry): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 3794
diff changeset
705 (char, s, table)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 /* I really don't know why this is interactive
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 help-form should at least be made useful whilst reading the second arg
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 "cSet syntax for character: \nsSet syntax for %s to: ",
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 0 /* See immediately above */)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (c, newentry, syntax_table)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 Lisp_Object c, newentry, syntax_table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
717 register unsigned char *p;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 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
719 int val;
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
720 Lisp_Object match;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 CHECK_NUMBER (c, 0);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 CHECK_STRING (newentry, 1);
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
724
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
725 if (NILP (syntax_table))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 syntax_table = current_buffer->syntax_table;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 else
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
728 check_syntax_table (syntax_table);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 p = XSTRING (newentry)->data;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 code = (enum syntaxcode) syntax_spec_code[*p++];
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 if (((int) code & 0377) == 0377)
18613
614b916ff5bf Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents: 18491
diff changeset
733 error ("invalid syntax description letter: %c", p[-1]);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
735 if (code == Sinherit)
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
736 {
18113
9f7fdb0f76f3 (Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents: 18080
diff changeset
737 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Qnil);
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
738 return Qnil;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
739 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
741 if (*p)
13513
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
742 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
743 int len;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
744 int character = STRING_CHAR_AND_LENGTH (p, XSTRING (newentry)->size - 1,
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
745 len);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
746 XSETINT (match, character);
13513
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
747 if (XFASTINT (match) == ' ')
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
748 match = Qnil;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
749 p += len;
13513
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
750 }
907544cb2c7d (check_syntax_table): Check the purpose slot.
Richard M. Stallman <rms@gnu.org>
parents: 13218
diff changeset
751 else
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
752 match = Qnil;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
753
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
754 val = (int) code;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 while (*p)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 switch (*p++)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 case '1':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
759 val |= 1 << 16;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 case '2':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
763 val |= 1 << 17;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 case '3':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
767 val |= 1 << 18;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 case '4':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
771 val |= 1 << 19;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 case 'p':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
775 val |= 1 << 20;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 break;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
777
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
778 case 'b':
9333
925795f1a594 (Fmodify_syntax_entry): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents: 9320
diff changeset
779 val |= 1 << 21;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
780 break;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
783 if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
784 newentry = XVECTOR (Vsyntax_code_object)->contents[val];
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
785 else
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
786 /* Since we can't use a shared object, let's make a new one. */
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
787 newentry = Fcons (make_number (val), match);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
788
18113
9f7fdb0f76f3 (Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents: 18080
diff changeset
789 SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), newentry);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 /* Dump syntax table to buffer in human-readable format */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
796 static void
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 describe_syntax (value)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798 Lisp_Object value;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 register enum syntaxcode code;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
801 char desc, match, start1, start2, end1, end2, prefix, comstyle;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 char str[2];
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
803 Lisp_Object first, match_lisp;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 Findent_to (make_number (16), make_number (1));
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
807 if (NILP (value))
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
808 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
809 insert_string ("default\n");
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
810 return;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
811 }
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
812
17109
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
813 if (CHAR_TABLE_P (value))
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
814 {
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
815 insert_string ("deeper char-table ...\n");
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
816 return;
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
817 }
dfe4f98935c4 (describe_syntax): Handle the case that the argument
Kenichi Handa <handa@m17n.org>
parents: 17044
diff changeset
818
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
819 if (!CONSP (value))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
821 insert_string ("invalid\n");
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822 return;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
825 first = XCONS (value)->car;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
826 match_lisp = XCONS (value)->cdr;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
827
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
828 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
829 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
830 insert_string ("invalid\n");
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
831 return;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
832 }
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
833
18113
9f7fdb0f76f3 (Fsyntax_table_p, check_syntax_table): Use EQ.
Richard M. Stallman <rms@gnu.org>
parents: 18080
diff changeset
834 code = (enum syntaxcode) (XINT (first) & 0377);
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
835 start1 = (XINT (first) >> 16) & 1;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
836 start2 = (XINT (first) >> 17) & 1;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
837 end1 = (XINT (first) >> 18) & 1;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
838 end2 = (XINT (first) >> 19) & 1;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
839 prefix = (XINT (first) >> 20) & 1;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
840 comstyle = (XINT (first) >> 21) & 1;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 if ((int) code < 0 || (int) code >= (int) Smax)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 insert_string ("invalid");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 return;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 desc = syntax_code_spec[(int) code];
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 str[0] = desc, str[1] = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 insert (str, 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
852 if (NILP (match_lisp))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
853 insert (" ", 1);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
854 else
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
855 insert_char (XINT (match_lisp));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 if (start1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 insert ("1", 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 if (start2)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 insert ("2", 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 if (end1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 insert ("3", 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864 if (end2)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865 insert ("4", 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867 if (prefix)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868 insert ("p", 1);
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
869 if (comstyle)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
870 insert ("b", 1);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
871
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872 insert_string ("\twhich means: ");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
873
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
874 switch (SWITCH_ENUM_CAST (code))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876 case Swhitespace:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 insert_string ("whitespace"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 case Spunct:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 insert_string ("punctuation"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881 insert_string ("word"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 insert_string ("symbol"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884 case Sopen:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 insert_string ("open"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 case Sclose:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887 insert_string ("close"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 case Squote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 insert_string ("quote"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 case Sstring:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 insert_string ("string"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 case Smath:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 insert_string ("math"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 case Sescape:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 insert_string ("escape"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
897 insert_string ("charquote"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 case Scomment:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899 insert_string ("comment"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 case Sendcomment:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 insert_string ("endcomment"); break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
902 default:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 insert_string ("invalid");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 return;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
907 if (!NILP (match_lisp))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
908 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
909 insert_string (", matches ");
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
910 insert_char (XINT (match_lisp));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
911 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
912
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
913 if (start1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
914 insert_string (",\n\t is the first character of a comment-start sequence");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915 if (start2)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916 insert_string (",\n\t is the second character of a comment-start sequence");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918 if (end1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 insert_string (",\n\t is the first character of a comment-end sequence");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 if (end2)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 insert_string (",\n\t is the second character of a comment-end sequence");
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
922 if (comstyle)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
923 insert_string (" (comment style b)");
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
924
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925 if (prefix)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926 insert_string (",\n\t is a prefix character for `backward-prefix-chars'");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 insert_string ("\n");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
931 static Lisp_Object
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932 describe_syntax_1 (vector)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 Lisp_Object vector;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 struct buffer *old = current_buffer;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 set_buffer_internal (XBUFFER (Vstandard_output));
17786
90d9682afa28 (describe_syntax_1): Pass new args to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 17585
diff changeset
937 describe_vector (vector, Qnil, describe_syntax, 0, Qnil, Qnil, (int *) 0, 0);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
938 while (! NILP (XCHAR_TABLE (vector)->parent))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
939 {
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
940 vector = XCHAR_TABLE (vector)->parent;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
941 insert_string ("\nThe parent syntax table is:");
17786
90d9682afa28 (describe_syntax_1): Pass new args to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 17585
diff changeset
942 describe_vector (vector, Qnil, describe_syntax, 0, Qnil, Qnil,
90d9682afa28 (describe_syntax_1): Pass new args to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 17585
diff changeset
943 (int *) 0, 0);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
944 }
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
945
9863
f918fd077a9f (describe_syntax_1): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 9475
diff changeset
946 call0 (intern ("help-mode"));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
947 set_buffer_internal (old);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
948 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
949 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951 DEFUN ("describe-syntax", Fdescribe_syntax, Sdescribe_syntax, 0, 0, "",
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 "Describe the syntax specifications in the syntax table.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
953 The descriptions are inserted in a buffer, which is then displayed.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
954 ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
956 internal_with_output_to_temp_buffer
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
957 ("*Help*", describe_syntax_1, current_buffer->syntax_table);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
958
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
962 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
963
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 /* Return the position across COUNT words from FROM.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965 If that many words cannot be found before the end of the buffer, return 0.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 COUNT negative means scan backward and stop at word beginning. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 scan_words (from, count)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 register int from, count;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 register int beg = BEGV;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 register int end = ZV;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
973 register enum syntaxcode code;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
974 int ch0, ch1;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
975 int temp_pos;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
977 immediate_quit = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
978 QUIT;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
979
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
980 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
981
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 while (count > 0)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
986 if (from == end)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 return 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
991 UPDATE_SYNTAX_TABLE_FORWARD (from);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
992 ch0 = FETCH_CHAR (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
993 code = SYNTAX (ch0);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
994 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 if (words_include_escapes
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 && (code == Sescape || code == Scharquote))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 if (code == Sword)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1001 /* 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
1002 position of the next character. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 if (from == end) break;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1006 UPDATE_SYNTAX_TABLE_FORWARD (from);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1007 ch1 = FETCH_CHAR (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1008 code = SYNTAX (ch1);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009 if (!(words_include_escapes
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 && (code == Sescape || code == Scharquote)))
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1011 if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1012 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1013 INC_POS (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1014 ch0 = ch1;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 count--;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018 while (count < 0)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1019 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022 if (from == beg)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025 return 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1027 DEC_POS (from);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1028 UPDATE_SYNTAX_TABLE_BACKWARD (from);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1029 ch1 = FETCH_CHAR (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1030 code = SYNTAX (ch1);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1031 if (words_include_escapes
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1032 && (code == Sescape || code == Scharquote))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1033 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1034 if (code == Sword)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1037 /* 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
1038 position of it. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 if (from == beg) break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1042 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1043 DEC_POS (temp_pos);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1044 UPDATE_SYNTAX_TABLE_BACKWARD (from);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1045 ch0 = FETCH_CHAR (temp_pos);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1046 code = SYNTAX (ch0);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047 if (!(words_include_escapes
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048 && (code == Sescape || code == Scharquote)))
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1049 if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1051 from = temp_pos;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1052 ch1 = ch0;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1053 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1054 count++;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1055 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1056
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1057 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1058
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1059 return from;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1060 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1061
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1062 DEFUN ("forward-word", Fforward_word, Sforward_word, 1, 1, "p",
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063 "Move point forward ARG words (backward if ARG is negative).\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1064 Normally returns t.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065 If an edge of the buffer is reached, point is left there\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1066 and nil is returned.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1067 (count)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1068 Lisp_Object count;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1069 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1070 int val;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071 CHECK_NUMBER (count, 0);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072
16039
855c8d8ba0f0 Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents: 14661
diff changeset
1073 if (!(val = scan_words (PT, XINT (count))))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1074 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075 SET_PT (XINT (count) > 0 ? ZV : BEGV);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1078 SET_PT (val);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 return Qt;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1081
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1082 Lisp_Object skip_chars ();
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1083
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1084 DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1085 "Move point forward, stopping before a char not in STRING, or at pos LIM.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1086 STRING is like the inside of a `[...]' in a regular expression\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1087 except that `]' is never special and `\\' quotes `^', `-' or `\\'.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1088 Thus, with arg \"a-zA-Z\", this skips letters stopping before first nonletter.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1089 With arg \"^a-zA-Z\", skips nonletters stopping before first letter.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1090 Returns the distance traveled, either zero or positive.")
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1091 (string, lim)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1092 Lisp_Object string, lim;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1093 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1094 return skip_chars (1, 0, string, lim);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1095 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1096
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1097 DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1098 "Move point backward, stopping after a char not in STRING, or at pos LIM.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1099 See `skip-chars-forward' for details.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1100 Returns the distance traveled, either zero or negative.")
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1101 (string, lim)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1102 Lisp_Object string, lim;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1103 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1104 return skip_chars (0, 0, string, lim);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1105 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1106
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1107 DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1108 "Move point forward across chars in specified syntax classes.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1109 SYNTAX is a string of syntax code characters.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1110 Stop before a char whose syntax is not in SYNTAX, or at position LIM.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1111 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1112 This function returns the distance traveled, either zero or positive.")
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1113 (syntax, lim)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1114 Lisp_Object syntax, lim;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1115 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1116 return skip_chars (1, 1, syntax, lim);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1117 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1118
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1119 DEFUN ("skip-syntax-backward", Fskip_syntax_backward, Sskip_syntax_backward, 1, 2, 0,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1120 "Move point backward across chars in specified syntax classes.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1121 SYNTAX is a string of syntax code characters.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1122 Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1123 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1124 This function returns the distance traveled, either zero or negative.")
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1125 (syntax, lim)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1126 Lisp_Object syntax, lim;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1127 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1128 return skip_chars (0, 1, syntax, lim);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1129 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1130
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1131 Lisp_Object
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1132 skip_chars (forwardp, syntaxp, string, lim)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1133 int forwardp, syntaxp;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1134 Lisp_Object string, lim;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1135 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1136 register unsigned char *p, *pend;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1137 register unsigned int c;
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1138 register int ch;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1139 unsigned char fastmap[0400];
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1140 /* If SYNTAXP is 0, STRING may contain multi-byte form of characters
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1141 of which codes don't fit in FASTMAP. In that case, we set the
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1142 first byte of multibyte form (i.e. base leading-code) in FASTMAP
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1143 and set the actual ranges of characters in CHAR_RANGES. In the
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1144 form "X-Y" of STRING, both X and Y must belong to the same
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1145 character set because a range striding across character sets is
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1146 meaningless. */
20292
2befa7396e42 (skip_chars): Check type of `string' before using it.
Karl Heuer <kwzh@gnu.org>
parents: 18938
diff changeset
1147 int *char_ranges;
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1148 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
1149 int negate = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1150 register int i;
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1151 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1152
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1153 CHECK_STRING (string, 0);
20292
2befa7396e42 (skip_chars): Check type of `string' before using it.
Karl Heuer <kwzh@gnu.org>
parents: 18938
diff changeset
1154 char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1155
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1156 if (NILP (lim))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1157 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
1158 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1159 CHECK_NUMBER_COERCE_MARKER (lim, 1);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1160
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1161 /* 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
1162 /* jla turned this off, for no known reason.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1163 bfox turned the ZV part on, and rms turned the
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1164 BEGV part back on. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1165 if (XINT (lim) > ZV)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1166 XSETFASTINT (lim, ZV);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1167 if (XINT (lim) < BEGV)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1168 XSETFASTINT (lim, BEGV);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1169
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1170 p = XSTRING (string)->data;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1171 pend = p + XSTRING (string)->size;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1172 bzero (fastmap, sizeof fastmap);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1173
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1174 if (p != pend && *p == '^')
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1175 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1176 negate = 1; p++;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1177 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1178
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1179 /* Find the characters specified and set their elements of fastmap.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1180 If syntaxp, each character counts as itself.
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1181 Otherwise, handle backslashes and ranges specially. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1182
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1183 while (p != pend)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1184 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1185 c = *p;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1186 if (multibyte)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1187 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1188 ch = STRING_CHAR (p, pend - p);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1189 p += BYTES_BY_CHAR_HEAD (*p);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1190 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1191 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1192 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1193 ch = c;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1194 p++;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1195 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1196 if (syntaxp)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1197 fastmap[syntax_spec_code[c]] = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1198 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1199 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1200 if (c == '\\')
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1201 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1202 if (p == pend) break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1203 c = *p++;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1204 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1205 if (p != pend && *p == '-')
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1206 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1207 unsigned int ch2;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1208
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1209 p++;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1210 if (p == pend) break;
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1211 if (SINGLE_BYTE_CHAR_P (ch))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1212 while (c <= *p)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1213 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1214 fastmap[c] = 1;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1215 c++;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1216 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1217 else
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1218 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1219 fastmap[c] = 1; /* C is the base leading-code. */
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1220 ch2 = STRING_CHAR (p, pend - p);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1221 if (ch <= ch2)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1222 char_ranges[n_char_ranges++] = ch,
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1223 char_ranges[n_char_ranges++] = ch2;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1224 }
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1225 p += multibyte ? BYTES_BY_CHAR_HEAD (*p) : 1;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1226 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1227 else
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1228 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1229 fastmap[c] = 1;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1230 if (!SINGLE_BYTE_CHAR_P (ch))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1231 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1232 char_ranges[n_char_ranges++] = ch;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1233 char_ranges[n_char_ranges++] = ch;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1234 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1235 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1236 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1237 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1238
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1239 /* If ^ was the first character, complement the fastmap. In
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1240 addition, as all multibyte characters have possibility of
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1241 matching, set all entries for base leading codes, which is
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1242 harmless even if SYNTAXP is 1. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1243
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1244 if (negate)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1245 for (i = 0; i < sizeof fastmap; i++)
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1246 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1247 if (!multibyte || !BASE_LEADING_CODE_P (i))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1248 fastmap[i] ^= 1;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1249 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1250 fastmap[i] = 1;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1251 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1252
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1253 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1254 int start_point = PT;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1255 int pos = PT;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1256
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1257 immediate_quit = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1258 if (syntaxp)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1259 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1260 SETUP_SYNTAX_TABLE (pos, forwardp ? 1 : -1);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1261 if (forwardp)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1262 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1263 if (multibyte)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1264 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1265 while (pos < XINT (lim)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1266 && fastmap[(int) SYNTAX (FETCH_CHAR (pos))])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1267 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1268 INC_POS (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1269 UPDATE_SYNTAX_TABLE_FORWARD (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1270 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1271 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1272 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1273 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1274 while (pos < XINT (lim)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1275 && fastmap[(int) SYNTAX (FETCH_BYTE (pos))])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1276 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1277 pos++;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1278 UPDATE_SYNTAX_TABLE_FORWARD (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1279 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1280 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1281 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1282 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1283 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1284 if (multibyte)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1285 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1286 while (pos > XINT (lim))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1287 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1288 int savepos = pos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1289 DEC_POS (pos);
17585
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1290 UPDATE_SYNTAX_TABLE_BACKWARD (pos);
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1291 if (!fastmap[(int) SYNTAX (FETCH_CHAR (pos))])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1292 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1293 pos = savepos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1294 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1295 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1296 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1297 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1298 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1299 {
17585
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1300 while (pos > XINT (lim))
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1301 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1302 pos--;
17585
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1303 UPDATE_SYNTAX_TABLE_BACKWARD (pos);
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1304 if (!fastmap[(int) SYNTAX (FETCH_BYTE (pos))])
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1305 {
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1306 pos++;
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1307 break;
aefc22e52046 (skip_chars): Fix previous change in syntax/backward case.
Richard M. Stallman <rms@gnu.org>
parents: 17564
diff changeset
1308 }
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1309 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1310 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1311 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1312 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1313 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1314 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1315 if (forwardp)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1316 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1317 if (multibyte)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1318 while (pos < XINT (lim) && fastmap[(c = FETCH_BYTE (pos))])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1319 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1320 if (!BASE_LEADING_CODE_P (c))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1321 pos++;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1322 else if (n_char_ranges)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1323 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1324 /* We much check CHAR_RANGES for a multibyte
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1325 character. */
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1326 ch = FETCH_MULTIBYTE_CHAR (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1327 for (i = 0; i < n_char_ranges; i += 2)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1328 if ((ch >= char_ranges[i] && ch <= char_ranges[i + 1]))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1329 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1330 if (!(negate ^ (i < n_char_ranges)))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1331 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1332
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1333 INC_POS (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1334 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1335 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1336 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1337 if (!negate) break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1338 INC_POS (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1339 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1340 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1341 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1342 while (pos < XINT (lim) && fastmap[FETCH_BYTE (pos)])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1343 pos++;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1344 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1345 else
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1346 {
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1347 if (multibyte)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1348 while (pos > XINT (lim))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1349 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1350 int savepos = pos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1351 DEC_POS (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1352 if (fastmap[(c = FETCH_BYTE (pos))])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1353 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1354 if (!BASE_LEADING_CODE_P (c))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1355 ;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1356 else if (n_char_ranges)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1357 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1358 /* We much check CHAR_RANGES for a multibyte
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1359 character. */
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1360 ch = FETCH_MULTIBYTE_CHAR (pos);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1361 for (i = 0; i < n_char_ranges; i += 2)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1362 if (ch >= char_ranges[i] && ch <= char_ranges[i + 1])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1363 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1364 if (!(negate ^ (i < n_char_ranges)))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1365 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1366 pos = savepos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1367 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1368 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1369 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1370 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1371 if (!negate)
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1372 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1373 pos = savepos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1374 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1375 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1376 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1377 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1378 {
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1379 pos = savepos;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1380 break;
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1381 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1382 }
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1383 else
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1384 while (pos > XINT (lim) && fastmap[FETCH_BYTE (pos - 1)])
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1385 pos--;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1386 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1387 }
17564
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1388
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1389 if (multibyte
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1390 /* INC_POS or DEC_POS might have moved POS over LIM. */
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1391 && (forwardp ? (pos > XINT (lim)) : (pos < XINT (lim))))
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1392 pos = XINT (lim);
050f15e0b948 (skip_chars): Merge mule changes back in.
Richard M. Stallman <rms@gnu.org>
parents: 17466
diff changeset
1393
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1394 SET_PT (pos);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1395 immediate_quit = 0;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1396
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1397 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
1398 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1399 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1400
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1401 DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0,
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1402 "Move forward across up to N comments. If N is negative, move backward.\n\
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1403 Stop scanning if we find something other than a comment or whitespace.\n\
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
1404 Set point to where scanning stops.\n\
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1405 If N comments are found as expected, with nothing except whitespace\n\
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1406 between them, return t; otherwise return nil.")
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1407 (count)
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1408 Lisp_Object count;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1409 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1410 register int from;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1411 register int stop;
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1412 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
1413 register enum syntaxcode code;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1414 int comstyle = 0; /* style of comment encountered */
3087
ea0cb469490e (Fforward_comment): Fix last change.
Richard M. Stallman <rms@gnu.org>
parents: 3086
diff changeset
1415 int found;
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1416 int count1;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1417 int temp_pos;
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1418
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1419 CHECK_NUMBER (count, 0);
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1420 count1 = XINT (count);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1421 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
1422
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1423 immediate_quit = 1;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1424 QUIT;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1425
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1426 from = PT;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1427
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1428 SETUP_SYNTAX_TABLE (from, count1);
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1429 while (count1 > 0)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1430 {
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1431 do
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1432 {
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1433 if (from == stop)
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1434 {
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1435 SET_PT (from);
10947
e805ef6b931c (Fforward_comment): Always clear immediate_quit for return.
Richard M. Stallman <rms@gnu.org>
parents: 10457
diff changeset
1436 immediate_quit = 0;
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1437 return Qnil;
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1438 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1439 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
1440 c = FETCH_CHAR (from);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1441 code = SYNTAX (c);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1442 INC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1443 comstyle = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1444 if (from < stop && SYNTAX_COMSTART_FIRST (c)
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1445 && (c1 = FETCH_CHAR (from),
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1446 SYNTAX_COMSTART_SECOND (c1)))
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1447 {
4953
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1448 /* We have encountered a comment start sequence and we
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1449 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
1450 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
1451 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
1452 the comment section. */
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1453 code = Scomment;
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1454 comstyle = SYNTAX_COMMENT_STYLE (c1);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1455 INC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1456 }
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1457 }
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1458 while (code == Swhitespace || code == Sendcomment);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1459 if (code != Scomment && code != Scomment_fence)
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1460 {
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1461 immediate_quit = 0;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1462 DEC_POS (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1463 SET_PT (from);
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1464 return Qnil;
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1465 }
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1466 /* We're at the start of a comment. */
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1467 while (1)
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1468 {
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1469 if (from == stop)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1470 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1471 immediate_quit = 0;
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1472 SET_PT (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1473 return Qnil;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1474 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1475 UPDATE_SYNTAX_TABLE_FORWARD (from);
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1476 c = FETCH_CHAR (from);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1477 INC_POS (from);
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1478 if (SYNTAX (c) == Sendcomment
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1479 && SYNTAX_COMMENT_STYLE (c) == comstyle)
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1480 /* we have encountered a comment end of the same style
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1481 as the comment sequence which began this comment
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1482 section */
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1483 break;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1484 if (SYNTAX (c) == Scomment_fence
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1485 && comstyle == ST_COMMENT_STYLE)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1486 /* we have encountered a comment end of the same style
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1487 as the comment sequence which began this comment
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1488 section. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1489 break;
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1490 if (from < stop && SYNTAX_COMEND_FIRST (c)
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1491 && (c1 = FETCH_CHAR (from),
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1492 SYNTAX_COMEND_SECOND (c1))
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1493 && SYNTAX_COMMENT_STYLE (c) == comstyle)
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1494 /* we have encountered a comment end of the same style
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1495 as the comment sequence which began this comment
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1496 section */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1497 { INC_POS (from); break; }
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1498 }
6142
2dbc79d01191 (Fforward_comment): Do the right thing at eob.
Karl Heuer <kwzh@gnu.org>
parents: 5755
diff changeset
1499 /* We have skipped one comment. */
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1500 count1--;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1501 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1502
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1503 while (count1 < 0)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1504 {
18938
444939f3c18f (Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents: 18738
diff changeset
1505 while (1)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1506 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1507 int quoted;
18938
444939f3c18f (Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents: 18738
diff changeset
1508 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
1509 {
444939f3c18f (Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents: 18738
diff changeset
1510 SET_PT (stop);
444939f3c18f (Fforward_comment): When count1 is negative, return nil if FROM reaches STOP.
Richard M. Stallman <rms@gnu.org>
parents: 18738
diff changeset
1511 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
1512 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
1513 }
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1514
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1515 DEC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1516 quoted = char_quoted (from);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1517 if (quoted)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1518 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1519 DEC_POS (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1520 goto leave; /* ????? XXXXX */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1521 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1522 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1523 c = FETCH_CHAR (from);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1524 code = SYNTAX (c);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1525 comstyle = 0;
4953
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1526 if (code == Sendcomment)
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1527 comstyle = SYNTAX_COMMENT_STYLE (c);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1528 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1529 DEC_POS (temp_pos);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1530 if (from > stop && SYNTAX_COMEND_SECOND (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1531 && (c1 = FETCH_CHAR (temp_pos),
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1532 SYNTAX_COMEND_FIRST (c1))
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1533 && !char_quoted (temp_pos))
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1534 {
4953
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1535 /* 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
1536 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
1537 sequence of the same style. */
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1538 code = Sendcomment;
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1539 comstyle = SYNTAX_COMMENT_STYLE (c1);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1540 from = temp_pos;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1541 }
18080
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1542 if (from > stop && SYNTAX_COMSTART_SECOND (c)
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1543 && (c1 = FETCH_CHAR (temp_pos),
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1544 SYNTAX_COMSTART_FIRST (c1))
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1545 && !char_quoted (temp_pos))
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1546 {
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1547 /* We must record the comment style encountered so that
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1548 later, we can match only the proper comment begin
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1549 sequence of the same style. */
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1550 code = Scomment;
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1551 from = temp_pos;
55e03c524041 (Fforward_comment): Handle unmatched two-character comment starters.
Richard M. Stallman <rms@gnu.org>
parents: 18079
diff changeset
1552 }
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1553
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1554 if (code == Scomment_fence)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1555 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1556 /* Skip until first preceding unquoted comment_fence. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1557 int found = 0, ini = from;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1558
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1559 while (--from != stop)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1560 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1561 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
1562 c = FETCH_CHAR (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1563 if (SYNTAX (c) == Scomment_fence && !char_quoted (from))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1564 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1565 found = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1566 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1567 }
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 if (found == 0)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1570 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1571 from = ini; /* Set point to ini + 1. */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1572 goto leave;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1573 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1574 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1575 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
1576 {
3794
ea9d3f2cd5fa (scan_lists, Fforward_comment): #if 0 the code
Richard M. Stallman <rms@gnu.org>
parents: 3720
diff changeset
1577 #if 0
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1578 if (code != SYNTAX (c))
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1579 /* For a two-char comment ender, we can assume
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1580 it does end a comment. So scan back in a simple way. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1581 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1582 if (from != stop) DEC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1583 while (1)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1584 {
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1585 if ((c = FETCH_CHAR (from),
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1586 SYNTAX (c) == Scomment)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1587 && SYNTAX_COMMENT_STYLE (c) == comstyle)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1588 break;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1589 if (from == stop)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1590 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1591 immediate_quit = 0;
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
1592 SET_PT (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1593 return Qnil;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1594 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1595 DEC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1596 if (SYNTAX_COMSTART_SECOND (c)
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1597 && (c1 = FETCH_CHAR (from),
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
1598 SYNTAX_COMSTART_FIRST (c1))
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1599 && SYNTAX_COMMENT_STYLE (c) == comstyle
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1600 && !char_quoted (from))
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1601 break;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1602 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1603 break;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1604 }
3794
ea9d3f2cd5fa (scan_lists, Fforward_comment): #if 0 the code
Richard M. Stallman <rms@gnu.org>
parents: 3720
diff changeset
1605 #endif /* 0 */
18079
5fbb5aef5649 (back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents: 17786
diff changeset
1606 found = back_comment (from, stop, comstyle);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1607 if (found != -1) from = found;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1608 #if 0
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1609 /* Look back, counting the parity of string-quotes,
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1610 and recording the comment-starters seen.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1611 When we reach a safe place, assume that's not in a string;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1612 then step the main scan to the earliest comment-starter seen
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1613 an even number of string quotes away from the safe place.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1614
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1615 OFROM[I] is position of the earliest comment-starter seen
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1616 which is I+2X quotes from the comment-end.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1617 PARITY is current parity of quotes from the comment end. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1618 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1619 int parity = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1620 char my_stringend = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1621 int string_lossage = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1622 int comment_end = from;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1623 int comstart_pos = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1624 int comstart_parity = 0;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1625 int scanstart = from;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1626
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1627 DEC_POS (scanstart);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1628 /* At beginning of range to scan, we're outside of strings;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1629 that determines quote parity to the comment-end. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1630 while (from != stop)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1631 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1632 /* Move back and examine a character. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1633 DEC_POS (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1634
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1635 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1636 c = FETCH_CHAR (from);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1637 code = SYNTAX (c);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1638
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1639 /* If this char is the second of a 2-char comment sequence,
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1640 back up and give the pair the appropriate syntax. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1641 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1642 DEC_POS (temp_pos);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1643 if (from > stop && SYNTAX_COMEND_SECOND (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1644 && (c1 = FETCH_CHAR (temp_pos),
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1645 SYNTAX_COMEND_FIRST (c1)))
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1646 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1647 code = Sendcomment;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1648 from = temp_pos;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1649 c = c1;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1650 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1651
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1652 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1653 INC_POS (temp_pos);
8045
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
1654 /* If this char starts a 2-char comment start sequence,
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
1655 treat it like a 1-char comment starter. */
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
1656 if (from < scanstart && SYNTAX_COMSTART_FIRST (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1657 && (c1 = FETCH_CHAR (temp_pos),
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1658 SYNTAX_COMSTART_SECOND (c1))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1659 && comstyle == SYNTAX_COMMENT_STYLE (c1))
8045
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
1660 code = Scomment;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1661
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1662 /* Ignore escaped characters. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1663 if (char_quoted (from))
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1664 continue;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1665
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1666 /* Track parity of quotes. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1667 if (code == Sstring)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1668 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1669 parity ^= 1;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1670 if (my_stringend == 0)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1671 my_stringend = c;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1672 /* If we have two kinds of string delimiters.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1673 There's no way to grok this scanning backwards. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1674 else if (my_stringend != c)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1675 string_lossage = 1;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1676 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1677
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1678 /* Record comment-starters according to that
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1679 quote-parity to the comment-end. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1680 if (code == Scomment)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1681 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1682 comstart_parity = parity;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1683 comstart_pos = from;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1684 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1685
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1686 /* If we find another earlier comment-ender,
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3568
diff changeset
1687 any comment-starts earlier than that don't count
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1688 (because they go with the earlier comment-ender). */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1689 if (code == Sendcomment
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1690 && SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)) == comstyle)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1691 break;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1692
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1693 /* Assume a defun-start point is outside of strings. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1694 if (code == Sopen
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1695 && (from == stop || FETCH_BYTE (from - 1) == '\n'))
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1696 break;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1697 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1698
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1699 if (comstart_pos == 0)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1700 from = comment_end;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1701 /* If the earliest comment starter
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1702 is followed by uniform paired string quotes or none,
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1703 we know it can't be inside a string
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1704 since if it were then the comment ender would be inside one.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1705 So it does start a comment. Skip back to it. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1706 else if (comstart_parity == 0 && !string_lossage)
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1707 from = comstart_pos;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1708 else
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1709 {
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1710 /* We had two kinds of string delimiters mixed up
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1711 together. Decode this going forwards.
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1712 Scan fwd from the previous comment ender
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1713 to the one in question; this records where we
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1714 last passed a comment starter. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1715 struct lisp_parse_state state;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1716 scan_sexps_forward (&state, find_defun_start (comment_end),
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
1717 comment_end - 1, -10000, 0, Qnil, 0);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1718 if (state.incomment)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1719 from = state.comstr_start;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1720 else
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1721 /* We can't grok this as a comment; scan it normally. */
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1722 from = comment_end;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1723 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1724 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1725 #endif /* 0 */
4953
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1726 /* We have skipped one comment. */
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1727 break;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1728 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1729 else if (code != Swhitespace && code != Scomment)
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1730 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1731 leave:
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1732 immediate_quit = 0;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1733 INC_POS (from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1734 SET_PT (from);
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1735 return Qnil;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1736 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1737 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1738
3095
ef7d99920f81 (Fforward_comment): Arg is a Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents: 3087
diff changeset
1739 count1++;
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1740 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1741
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1742 SET_PT (from);
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1743 immediate_quit = 0;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1744 return Qt;
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1745 }
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
1746
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747 Lisp_Object
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1748 scan_lists (from, count, depth, sexpflag)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 register int from;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 int count, depth, sexpflag;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752 Lisp_Object val;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1753 register int stop = count > 0 ? ZV : BEGV;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1754 register int c, c1;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1755 int stringterm;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 int quoted;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 int mathexit = 0;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1758 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
1759 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
1760 int comstyle = 0; /* style of comment encountered */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1761 int temp_pos;
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1762 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
1763 int found;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765 if (depth > 0) min_depth = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1766
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767 immediate_quit = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768 QUIT;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1770 SETUP_SYNTAX_TABLE (from, count);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771 while (count > 0)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773 while (from < stop)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1775 UPDATE_SYNTAX_TABLE_FORWARD (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 c = FETCH_CHAR (from);
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1777 code = SYNTAX (c);
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1778 if (depth == min_depth)
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1779 last_good = from;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1780 INC_POS (from);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1781 UPDATE_SYNTAX_TABLE_FORWARD (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 if (from < stop && SYNTAX_COMSTART_FIRST (c)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784 && 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
1785 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1786 /* 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
1787 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
1788 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
1789 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
1790 the comment section */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1791 code = Scomment;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1792 comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from));
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1793 INC_POS (from);
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1794 }
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1795
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1796 UPDATE_SYNTAX_TABLE_FORWARD (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797 if (SYNTAX_PREFIX (c))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798 continue;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
1800 switch (SWITCH_ENUM_CAST (code))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 case Sescape:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804 if (from == stop) goto lose;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1805 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806 /* treat following character as a word constituent */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809 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
1810 /* This word counts as a sexp; return at end of it. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811 while (from < stop)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1813 UPDATE_SYNTAX_TABLE_FORWARD (from);
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
1814 switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1815 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1816 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817 case Sescape:
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1818 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 if (from == stop) goto lose;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 case Squote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 default:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1828 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 case Scomment:
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1833 case Scomment_fence:
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 if (!parse_sexp_ignore_comments) break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 {
7924
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1837 if (from == stop)
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1838 {
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1839 if (depth == 0)
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1840 goto done;
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1841 goto lose;
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
1842 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1843 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
1844 c = FETCH_CHAR (from);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1845 if (code == Scomment
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1846 ? (SYNTAX (c) == Sendcomment
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1847 && SYNTAX_COMMENT_STYLE (c) == comstyle)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1848 : (SYNTAX (c) == Scomment_fence))
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1849 /* we have encountered a comment end of the same style
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1850 as the comment sequence which began this comment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1851 section */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1853 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 if (from < stop && SYNTAX_COMEND_FIRST (c)
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1855 && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1856 && SYNTAX_COMMENT_STYLE (c) == comstyle
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1857 && code == Scomment)
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1858 /* we have encountered a comment end of the same style
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1859 as the comment sequence which began this comment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1860 section */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1861 { INC_POS (from); break; }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 case Smath:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 if (!sexpflag)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 if (from != stop && c == FETCH_CHAR (from))
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1869 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 if (mathexit)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 mathexit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873 goto close1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875 mathexit = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 case Sopen:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 if (!++depth) goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 case Sclose:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 close1:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 if (!--depth) goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884 if (depth < min_depth)
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1885 Fsignal (Qscan_error,
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1886 Fcons (build_string ("Containing expression ends prematurely"),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1887 Fcons (make_number (last_good),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1888 Fcons (make_number (from), Qnil))));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1891 case Sstring:
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1892 case Sstring_fence:
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1893 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1894 DEC_POS (temp_pos);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1895 stringterm = FETCH_CHAR (temp_pos);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1896 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1897 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1898 if (from >= stop) goto lose;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1899 UPDATE_SYNTAX_TABLE_FORWARD (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1900 if (code == Sstring
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1901 ? (FETCH_CHAR (from) == stringterm)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1902 : SYNTAX (FETCH_CHAR (from)) == Sstring_fence)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1903 break;
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
1904 switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1905 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1907 case Sescape:
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1908 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1909 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1910 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1911 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1912 INC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913 if (!depth && sexpflag) goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1914 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1916 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1917
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918 /* Reached end of buffer. Error if within object, return nil if between */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1919 if (depth) goto lose;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1920
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 /* End of object reached */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 done:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926 count--;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 while (count < 0)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1931 while (from > stop)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1933 DEC_POS (from);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1934 UPDATE_SYNTAX_TABLE_BACKWARD (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1935 if (quoted = char_quoted (from))
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1936 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1937 DEC_POS (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1938 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
1939 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 c = FETCH_CHAR (from);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 code = SYNTAX (c);
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1942 if (depth == min_depth)
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
1943 last_good = from;
4953
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1944 comstyle = 0;
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1945 if (code == Sendcomment)
7545290052bf (Fforward_comment): On backward scan, exit inner loop
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
1946 comstyle = SYNTAX_COMMENT_STYLE (c);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1947 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1948 DEC_POS (temp_pos);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 if (from > stop && SYNTAX_COMEND_SECOND (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1950 && (c1 = FETCH_CHAR (temp_pos), SYNTAX_COMEND_FIRST (c1))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1951 && !char_quoted (temp_pos)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952 && 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
1953 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1954 /* we must record the comment style encountered so that
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1955 later, we can match only the proper comment begin
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1956 sequence of the same style */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1957 code = Sendcomment;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1958 comstyle = SYNTAX_COMMENT_STYLE (c1);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1959 from = temp_pos;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1960 }
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
1961
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962 if (SYNTAX_PREFIX (c))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 continue;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
1965 switch (SWITCH_ENUM_CAST (quoted ? Sword : code))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 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
1970 /* 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
1971 after passing it. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 while (from > stop)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1974 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1975 DEC_POS (temp_pos);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1976 UPDATE_SYNTAX_TABLE_BACKWARD (temp_pos);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1977 quoted = char_quoted (temp_pos);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1978 if (quoted)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1979 {
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1980 from = temp_pos;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1981 DEC_POS (temp_pos);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1982 UPDATE_SYNTAX_TABLE_BACKWARD (temp_pos);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1983 }
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1984 c1 = FETCH_CHAR (temp_pos);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1985 temp_code = SYNTAX (c1);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1986 if (! (quoted || temp_code == Sword
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1987 || temp_code == Ssymbol
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1988 || temp_code == Squote))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 goto done2;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1990 from = temp_pos;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 goto done2;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994 case Smath:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 if (!sexpflag)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1997 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
1998 DEC_POS (temp_pos);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
1999 UPDATE_SYNTAX_TABLE_BACKWARD (temp_pos);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2000 if (from != stop && c == FETCH_CHAR (temp_pos))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2001 from = temp_pos;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 if (mathexit)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 mathexit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 goto open2;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 mathexit = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2008
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009 case Sclose:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010 if (!++depth) goto done2;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2011 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2012
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 case Sopen:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2014 open2:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 if (!--depth) goto done2;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 if (depth < min_depth)
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2017 Fsignal (Qscan_error,
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2018 Fcons (build_string ("Containing expression ends prematurely"),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2019 Fcons (make_number (last_good),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2020 Fcons (make_number (from), Qnil))));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 case Sendcomment:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 if (!parse_sexp_ignore_comments)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025 break;
3794
ea9d3f2cd5fa (scan_lists, Fforward_comment): #if 0 the code
Richard M. Stallman <rms@gnu.org>
parents: 3720
diff changeset
2026 #if 0
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2027 if (code != SYNTAX (c))
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2028 /* For a two-char comment ender, we can assume
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2029 it does end a comment. So scan back in a simple way. */
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2030 {
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2031 if (from != stop) DEC_POS (from);
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2032 while (1)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2033 {
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2034 if (SYNTAX (c = FETCH_CHAR (from)) == Scomment
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2035 && SYNTAX_COMMENT_STYLE (c) == comstyle)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2036 break;
7924
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2037 if (from == stop)
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2038 {
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2039 if (depth == 0)
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2040 goto done2;
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2041 goto lose;
63a2327f0783 (scan_lists): Get error if eob within comment with depth!=0.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
2042 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2043 DEC_POS (from);
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2044 if (SYNTAX_COMSTART_SECOND (c)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2045 && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from))
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2046 && SYNTAX_COMMENT_STYLE (c) == comstyle
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2047 && !char_quoted (from))
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2048 break;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2049 }
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2050 break;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2051 }
3794
ea9d3f2cd5fa (scan_lists, Fforward_comment): #if 0 the code
Richard M. Stallman <rms@gnu.org>
parents: 3720
diff changeset
2052 #endif /* 0 */
18079
5fbb5aef5649 (back_comment): Detect 2-char comment starts properly.
Richard M. Stallman <rms@gnu.org>
parents: 17786
diff changeset
2053 found = back_comment (from, stop, comstyle);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2054 if (found != -1) from = found;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2055 #if 0
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2056 /* Look back, counting the parity of string-quotes,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2057 and recording the comment-starters seen.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2058 When we reach a safe place, assume that's not in a string;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2059 then step the main scan to the earliest comment-starter seen
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2060 an even number of string quotes away from the safe place.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 OFROM[I] is position of the earliest comment-starter seen
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063 which is I+2X quotes from the comment-end.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 PARITY is current parity of quotes from the comment end. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 int parity = 0;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2067 char my_stringend = 0;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2068 int string_lossage = 0;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2069 int comment_end = from;
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2070 int comstart_pos = 0;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2071 int comstart_parity = 0;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2072 int scanstart = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2073
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2074 DEC_POS (scanstart);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2076 /* At beginning of range to scan, we're outside of strings;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2077 that determines quote parity to the comment-end. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2078 while (from != stop)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2079 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 /* Move back and examine a character. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2081 DEC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2083 c = FETCH_CHAR (from);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 code = SYNTAX (c);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2085
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 /* If this char is the second of a 2-char comment sequence,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2087 back up and give the pair the appropriate syntax. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2088 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2089 DEC_POS (temp_pos);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 if (from > stop && SYNTAX_COMEND_SECOND (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2091 && (c1 = FETCH_CHAR (temp_pos),
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2092 SYNTAX_COMEND_FIRST (c1)))
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2093 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2094 code = Sendcomment;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2095 from = temp_pos;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2096 c = c1;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2097 }
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2098
8045
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
2099 /* If this char starts a 2-char comment start sequence,
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
2100 treat it like a 1-char comment starter. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2101 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2102 INC_POS (temp_pos);
8045
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
2103 if (from < scanstart && SYNTAX_COMSTART_FIRST (c)
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2104 && (c1 = FETCH_CHAR (temp_pos),
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2105 SYNTAX_COMSTART_SECOND (c1))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2106 && comstyle == SYNTAX_COMMENT_STYLE (c1))
8045
18c2ad4ddc83 (scan_lists, Fforward_comment): When moving backward over
Richard M. Stallman <rms@gnu.org>
parents: 7975
diff changeset
2107 code = Scomment;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2108
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 /* Ignore escaped characters. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 if (char_quoted (from))
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 continue;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2113 /* Track parity of quotes. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 if (code == Sstring)
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2115 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2116 parity ^= 1;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2117 if (my_stringend == 0)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2118 my_stringend = c;
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2119 /* If we have two kinds of string delimiters.
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2120 There's no way to grok this scanning backwards. */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2121 else if (my_stringend != c)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2122 string_lossage = 1;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2123 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125 /* Record comment-starters according to that
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2126 quote-parity to the comment-end. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2127 if (code == Scomment)
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2128 {
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2129 comstart_parity = parity;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2130 comstart_pos = from;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2131 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2132
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2133 /* If we find another earlier comment-ender,
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3568
diff changeset
2134 any comment-starts earlier than that don't count
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2135 (because they go with the earlier comment-ender). */
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2136 if (code == Sendcomment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2137 && SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)) == comstyle)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2138 break;
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2139
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2140 /* Assume a defun-start point is outside of strings. */
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2141 if (code == Sopen
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2142 && (from == stop || FETCH_BYTE (from - 1) == '\n'))
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2143 break;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2144 }
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2145
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2146 if (comstart_pos == 0)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2147 from = comment_end;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2148 /* If the earliest comment starter
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2149 is followed by uniform paired string quotes or none,
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2150 we know it can't be inside a string
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2151 since if it were then the comment ender would be inside one.
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2152 So it does start a comment. Skip back to it. */
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2153 else if (comstart_parity == 0 && !string_lossage)
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2154 from = comstart_pos;
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2155 else
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2156 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2157 /* We had two kinds of string delimiters mixed up
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2158 together. Decode this going forwards.
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2159 Scan fwd from the previous comment ender
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2160 to the one in question; this records where we
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2161 last passed a comment starter. */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2162 struct lisp_parse_state state;
1167
a9aeeaa9da8f (scan_lists): When searching back for comment:
Richard M. Stallman <rms@gnu.org>
parents: 1085
diff changeset
2163 scan_sexps_forward (&state, find_defun_start (comment_end),
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
2164 comment_end - 1, -10000, 0, Qnil, 0);
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2165 if (state.incomment)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2166 from = state.comstr_start;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2167 else
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2168 /* We can't grok this as a comment; scan it normally. */
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2169 from = comment_end;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2170 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2171 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2172 #endif /* 0 */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2173 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2174
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2175 case Scomment_fence:
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2176 case Sstring_fence:
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2177 while (1)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2178 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2179 DEC_POS (from);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2180 if (from == stop) goto lose;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2181 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
2182 if (!char_quoted (from)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2183 && SYNTAX (FETCH_CHAR (from)) == code)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2184 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2185 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2186 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
2187 break;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2188
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 case Sstring:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2190 stringterm = FETCH_CHAR (from);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 if (from == stop) goto lose;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2194 temp_pos = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2195 DEC_POS (temp_pos);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2196 UPDATE_SYNTAX_TABLE_BACKWARD (temp_pos);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2197 if (!char_quoted (temp_pos)
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2198 && stringterm == FETCH_CHAR (temp_pos))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2200 from = temp_pos;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2202 DEC_POS (from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2203 if (!depth && sexpflag) goto done2;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 /* Reached start of buffer. Error if within object, return nil if between */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2209 if (depth) goto lose;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214 done2:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 count++;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2216 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2219 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
2220 XSETFASTINT (val, from);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2221 return val;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2222
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2223 lose:
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2224 Fsignal (Qscan_error,
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2225 Fcons (build_string ("Unbalanced parentheses"),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2226 Fcons (make_number (last_good),
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2227 Fcons (make_number (from), Qnil))));
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2228
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2229 /* NOTREACHED */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2230 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2231
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2232 DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2233 "Scan from character number FROM by COUNT lists.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2234 Returns the character number of the position thus found.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2235 \n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2236 If DEPTH is nonzero, paren depth begins counting from that value,\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 only places where the depth in parentheses becomes zero\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2238 are candidates for stopping; COUNT such places are counted.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2239 Thus, a positive value for DEPTH means go out levels.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2240 \n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2241 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2242 \n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2243 If the beginning or end of (the accessible part of) the buffer is reached\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2244 and the depth is wrong, an error is signaled.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2245 If the depth is right but the count is not used up, nil is returned.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2246 (from, count, depth)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247 Lisp_Object from, count, depth;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2249 CHECK_NUMBER (from, 0);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2250 CHECK_NUMBER (count, 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2251 CHECK_NUMBER (depth, 2);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2252
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2253 return scan_lists (XINT (from), XINT (count), XINT (depth), 0);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2254 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2255
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2256 DEFUN ("scan-sexps", Fscan_sexps, Sscan_sexps, 2, 2, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2257 "Scan from character number FROM by COUNT balanced expressions.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2258 If COUNT is negative, scan backwards.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2259 Returns the character number of the position thus found.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2260 \n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2261 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 \n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2263 If the beginning or end of (the accessible part of) the buffer is reached\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 in the middle of a parenthetical grouping, an error is signaled.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 If the beginning or end is reached between groupings\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266 but before count is used up, nil is returned.")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2267 (from, count)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268 Lisp_Object from, count;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 CHECK_NUMBER (from, 0);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2271 CHECK_NUMBER (count, 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2272
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2273 return scan_lists (XINT (from), XINT (count), 0, 1);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2274 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2275
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2276 DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2277 0, 0, 0,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2278 "Move point backward over any number of chars with prefix syntax.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2279 This includes chars with \"quote\" or \"prefix\" syntax (' or p).")
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2280 ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2281 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2282 int beg = BEGV;
16039
855c8d8ba0f0 Change all references from point to PT.
Karl Heuer <kwzh@gnu.org>
parents: 14661
diff changeset
2283 int pos = PT;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2284 int c;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2285 int temp_pos = pos;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2286
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2287 if (pos > beg)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2288 {
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2289 SETUP_SYNTAX_TABLE (pos, -1);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2290 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2291 DEC_POS (temp_pos);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2292
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2293 while (pos > beg && !char_quoted (temp_pos)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2294 /* Previous statement updates syntax table. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2295 && ((c = FETCH_CHAR (temp_pos), SYNTAX (c) == Squote)
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2296 || SYNTAX_PREFIX (c)))
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2297 {
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2298 pos = temp_pos;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2299 DEC_POS (temp_pos);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2300 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2301
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2302 SET_PT (pos);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2303
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2304 return Qnil;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2305 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2306
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2307 /* Parse forward from FROM to END,
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2308 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
2309 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
2310 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
2311 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
2312 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
2313 after the beginning of a string, or after the end of a string. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314
3720
408c7ee69be7 (scan_lists, Fforward_comment): Pass 0 as commentstop arg
Richard M. Stallman <rms@gnu.org>
parents: 3684
diff changeset
2315 static void
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2316 scan_sexps_forward (stateptr, from, end, targetdepth,
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2317 stopbefore, oldstate, commentstop)
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2318 struct lisp_parse_state *stateptr;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 register int from;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 int end, targetdepth, stopbefore;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 Lisp_Object oldstate;
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2322 int commentstop;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 struct lisp_parse_state state;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 register enum syntaxcode code;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 struct level { int last, prev; };
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 struct level levelstart[100];
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 register struct level *curlevel = levelstart;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 struct level *endlevel = levelstart + 100;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2331 int prev;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2332 register int depth; /* Paren depth of current scanning location.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 level - levelstart equals this except
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2334 when the depth becomes negative. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2335 int mindepth; /* Lowest DEPTH value seen. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2336 int start_quoted = 0; /* Nonzero means starting after a char quote */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2337 Lisp_Object tem;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2338 int prev_from; /* Keep one character before FROM. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2339 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
2340 int nofence;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2341
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2342 prev_from = from;
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2343 DEC_POS (prev_from);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2344
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2345 /* Use this macro instead of `from++'. */
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2346 #define INC_FROM do { prev_from = from; INC_POS (from); } while (0)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348 immediate_quit = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 QUIT;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2350
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2351 SETUP_SYNTAX_TABLE (from, 1);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2352
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
2353 if (NILP (oldstate))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2354 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2355 depth = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356 state.instring = -1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2357 state.incomment = 0;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2358 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
2359 state.comstr_start = -1; /* no comment/string seen. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2360 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 else
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 tem = Fcar (oldstate);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
2364 if (!NILP (tem))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 depth = XINT (tem);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 else
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 depth = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 oldstate = Fcdr (oldstate);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370 oldstate = Fcdr (oldstate);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371 oldstate = Fcdr (oldstate);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 tem = Fcar (oldstate);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2373 /* Check whether we are inside string_fence-style string: */
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2374 state.instring = ( !NILP (tem)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2375 ? ( INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2376 : -1);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 oldstate = Fcdr (oldstate);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 tem = Fcar (oldstate);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
2380 state.incomment = !NILP (tem);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382 oldstate = Fcdr (oldstate);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2383 tem = Fcar (oldstate);
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
2384 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
2385
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2386 /* if the eight 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
2387 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
2388 oldstate = Fcdr (oldstate);
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2389 oldstate = Fcdr (oldstate);
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2390 tem = Fcar (oldstate);
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2391 state.comstyle = NILP (tem) ? 0 : ( EQ (tem, Qsyntax_table)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2392 ? ST_COMMENT_STYLE : 1 );
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2393
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2394 oldstate = Fcdr (oldstate);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2395 tem = Fcar (oldstate);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2396 state.comstr_start = NILP (tem) ? -1 : XINT (tem) ;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2397 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2398 state.quoted = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2399 mindepth = depth;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2400
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2401 curlevel->prev = -1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2402 curlevel->last = -1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2403
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2404 /* Enter the loop at a place appropriate for initial state. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2405
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2406 if (state.incomment) goto startincomment;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2407 if (state.instring >= 0)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2408 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2409 nofence = state.instring != ST_STRING_STYLE;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2410 if (start_quoted) goto startquotedinstring;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411 goto startinstring;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2413 if (start_quoted) goto startquoted;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2414
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2415 while (from < end)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2416 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2417 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
2418 code = SYNTAX (FETCH_CHAR (from));
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2419 INC_FROM;
18491
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2420
3794
ea9d3f2cd5fa (scan_lists, Fforward_comment): #if 0 the code
Richard M. Stallman <rms@gnu.org>
parents: 3720
diff changeset
2421 if (code == Scomment)
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2422 state.comstr_start = prev_from;
18491
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2423 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
2424 {
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2425 /* 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
2426 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
2427 terminates the comment section. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2428 state.comstyle = ( code == Scomment_fence
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2429 ? ST_COMMENT_STYLE
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2430 : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)));
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2431 state.comstr_start = prev_from;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2432 if (code != Scomment_fence) INC_FROM;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2433 code = Scomment;
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2434 }
18491
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2435 else if (from < end)
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2436 if (SYNTAX_COMSTART_FIRST (FETCH_CHAR (prev_from)))
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2437 if (SYNTAX_COMSTART_SECOND (FETCH_CHAR (from)))
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2438 /* Duplicate code to avoid a very complex if-expression
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2439 which causes trouble for the SGI compiler. */
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2440 {
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2441 /* Record the comment style we have entered so that only
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2442 the comment-end sequence of the same style actually
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2443 terminates the comment section. */
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2444 state.comstyle = ( code == Scomment_fence
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2445 ? ST_COMMENT_STYLE
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2446 : SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)));
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2447 state.comstr_start = prev_from;
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2448 if (code != Scomment_fence) INC_FROM;
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2449 code = Scomment;
bf0d449581c8 (scan_sexps_forward): Split up a complex if-test.
Richard M. Stallman <rms@gnu.org>
parents: 18113
diff changeset
2450 }
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2451
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2452 if (SYNTAX_PREFIX (FETCH_CHAR (prev_from)))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2453 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
2454 switch (SWITCH_ENUM_CAST (code))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2455 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2456 case Sescape:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2457 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2458 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
2459 curlevel->last = prev_from;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2460 startquoted:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2461 if (from == end) goto endquoted;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2462 INC_FROM;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2463 goto symstarted;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2464 /* treat following character as a word constituent */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2465 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2466 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2467 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
2468 curlevel->last = prev_from;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2469 symstarted:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2470 while (from < end)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2471 {
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2472 UPDATE_SYNTAX_TABLE_FORWARD (from);
10457
2ab3bd0288a9 Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents: 9863
diff changeset
2473 switch (SWITCH_ENUM_CAST (SYNTAX (FETCH_CHAR (from))))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2474 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2475 case Scharquote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2476 case Sescape:
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2477 INC_FROM;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2478 if (from == end) goto endquoted;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2479 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2480 case Sword:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2481 case Ssymbol:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2482 case Squote:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2483 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2484 default:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2485 goto symdone;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2486 }
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2487 INC_FROM;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2488 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2489 symdone:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2490 curlevel->prev = curlevel->last;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2491 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2492
9475
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2493 startincomment:
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2494 if (commentstop == 1)
9475
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2495 goto done;
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2496 if (from != BEGV)
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2497 {
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2498 /* Enter the loop in the middle so that we find
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2499 a 2-char comment ender if we start in the middle of it. */
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2500 prev = FETCH_CHAR (prev_from);
9475
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2501 goto startincomment_1;
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2502 }
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2503 /* At beginning of buffer, enter the loop the ordinary way. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2504 state.incomment = 1;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2505 goto commentloop;
9475
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2506
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2507 case Scomment:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2508 state.incomment = 1;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2509 if (commentstop || boundary_stop) goto done;
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2510 commentloop:
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2511 while (1)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2512 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513 if (from == end) goto done;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2514 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
2515 prev = FETCH_CHAR (from);
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2516 if (SYNTAX (prev) == Sendcomment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2517 && SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2518 /* Only terminate the comment section if the endcomment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2519 of the same style as the start sequence has been
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2520 encountered. */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2521 break;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2522 if (state.comstyle == ST_COMMENT_STYLE
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2523 && SYNTAX (prev) == Scomment_fence)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2524 break;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2525 INC_FROM;
9475
c15caadae3c4 (scan_sexps_forward): At startincomment,
Richard M. Stallman <rms@gnu.org>
parents: 9411
diff changeset
2526 startincomment_1:
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2527 if (from < end && SYNTAX_COMEND_FIRST (prev)
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2528 && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2529 && SYNTAX_COMMENT_STYLE (prev) == state.comstyle)
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2530 /* Only terminate the comment section if the end-comment
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2531 sequence of the same style as the start sequence has
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2532 been encountered. */
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2533 { break; }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2534 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2535 INC_FROM;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2536 state.incomment = 0;
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2537 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
2538 if (boundary_stop) goto done;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2539 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2540
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2541 case Sopen:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2542 if (stopbefore) goto stop; /* this arg means stop at sexp start */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2543 depth++;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2544 /* 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
2545 curlevel->last = prev_from;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2546 if (++curlevel == endlevel)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2547 error ("Nesting too deep for parser");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2548 curlevel->prev = -1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2549 curlevel->last = -1;
12894
b2a75405de3c (scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 12870
diff changeset
2550 if (targetdepth == depth) goto done;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2551 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2552
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2553 case Sclose:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2554 depth--;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2555 if (depth < mindepth)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556 mindepth = depth;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2557 if (curlevel != levelstart)
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2558 curlevel--;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2559 curlevel->prev = curlevel->last;
12894
b2a75405de3c (scan_sexps_forward): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 12870
diff changeset
2560 if (targetdepth == depth) goto done;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2561 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2562
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2563 case Sstring:
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2564 case Sstring_fence:
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2565 state.comstr_start = from - 1;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2566 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
2567 curlevel->last = prev_from;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2568 state.instring = (code == Sstring
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2569 ? (FETCH_CHAR (prev_from))
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2570 : ST_STRING_STYLE);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2571 if (boundary_stop) goto done;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2572 startinstring:
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2573 {
20475
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2574 nofence = 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
2575
20475
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2576 while (1)
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2577 {
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2578 int c;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2579
20475
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2580 if (from >= end) goto done;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2581 c = FETCH_CHAR (from);
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2582 if (nofence && c == state.instring) break;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2583 UPDATE_SYNTAX_TABLE_FORWARD (from);
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2584 switch (SWITCH_ENUM_CAST (SYNTAX (c)))
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2585 {
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2586 case Sstring_fence:
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2587 if (!nofence) goto string_end;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2588 break;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2589 case Scharquote:
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2590 case Sescape:
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2591 INC_FROM;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2592 startquotedinstring:
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2593 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
2594 }
20475
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2595 INC_FROM;
efbebc38e077 Comment and whitespace changes.
Richard M. Stallman <rms@gnu.org>
parents: 20330
diff changeset
2596 }
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2597 }
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2598 string_end:
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599 state.instring = -1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2600 curlevel->prev = curlevel->last;
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2601 INC_FROM;
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2602 if (boundary_stop) goto done;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2604
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2605 case Smath:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 break;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2608 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2609 goto done;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2610
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2611 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
2612 from = prev_from; /* We have just fetched the char that starts it; */
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2613 goto done; /* but return the position before it. */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2614
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2615 endquoted:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2616 state.quoted = 1;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2617 done:
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2618 state.depth = depth;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2619 state.mindepth = mindepth;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2620 state.thislevelstart = curlevel->prev;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2621 state.prevlevelstart
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2622 = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2623 state.location = from;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2624 immediate_quit = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2625
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2626 *stateptr = state;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2627 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2628
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2629 /* This comment supplies the doc string for parse-partial-sexp,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2630 for make-docfile to see. We cannot put this in the real DEFUN
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2631 due to limits in the Unix cpp.
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2632
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2633 DEFUN ("parse-partial-sexp", Ffoo, Sfoo, 2, 6, 0,
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2634 "Parse Lisp syntax starting at FROM until TO; return status of parse at TO.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2635 Parsing stops at TO or when certain criteria are met;\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2636 point is set to where parsing stops.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2637 If fifth arg STATE is omitted or nil,\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2638 parsing assumes that FROM is the beginning of a function.\n\
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2639 Value is a list of nine elements describing final state of parsing:\n\
4458
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2640 0. depth in parens.\n\
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2641 1. character address of start of innermost containing list; nil if none.\n\
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2642 2. character address of start of last complete sexp terminated.\n\
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2643 3. non-nil if inside a string.\n\
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2644 (it is the character that will terminate the string,\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2645 or t if the string should be terminated by an explicit\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2646 `syntax-table' property.)\n\
4458
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2647 4. t if inside a comment.\n\
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2648 5. t if following a quote character.\n\
cef07afc1e9e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4393
diff changeset
2649 6. the minimum paren-depth encountered during this scan.\n\
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2650 7. t if in a comment of style `b'; `syntax-table' if given by an explicit\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2651 `syntax-table' property.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2652 8. character address of start of last comment or string; nil if none.\n\
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2653 If third arg TARGETDEPTH is non-nil, parsing stops if the depth\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 in parentheses becomes equal to TARGETDEPTH.\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655 Fourth arg STOPBEFORE non-nil means stop when come to\n\
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2656 any character that starts a sexp.\n\
4393
3e20f4e3dbaa Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4307
diff changeset
2657 Fifth arg STATE is an eight-list like what this function returns.\n\
726
5f08efa38dd0 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
2658 It is used to initialize the state of the parse. Its second and third
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2659 elements are ignored.
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2660 Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. If\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2661 it is `syntax-table', stop after the start of a comment or a string, or\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2662 after end of a comment or a string.")
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2663 (from, to, targetdepth, stopbefore, state, commentstop)
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2664 */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2665
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2666 DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0,
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2667 0 /* See immediately above */)
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2668 (from, to, targetdepth, stopbefore, oldstate, commentstop)
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2669 Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop;
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2670 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2671 struct lisp_parse_state state;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2672 int target;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2673
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 163
diff changeset
2674 if (!NILP (targetdepth))
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2675 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2676 CHECK_NUMBER (targetdepth, 3);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2677 target = XINT (targetdepth);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2678 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2679 else
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2680 target = -100000; /* We won't reach this depth */
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2681
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2682 validate_region (&from, &to);
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2683 scan_sexps_forward (&state, XINT (from), XINT (to),
3568
3ee951a22a80 (Fforward_comment): Set point to where scan stops,
Richard M. Stallman <rms@gnu.org>
parents: 3095
diff changeset
2684 target, !NILP (stopbefore), oldstate,
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2685 (NILP (commentstop)
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2686 ? 0 : (EQ (commentstop, Qsyntax_table) ? -1 : 1)));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2687
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2688 SET_PT (state.location);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2689
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2690 return Fcons (make_number (state.depth),
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2691 Fcons (state.prevlevelstart < 0 ? Qnil : make_number (state.prevlevelstart),
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2692 Fcons (state.thislevelstart < 0 ? Qnil : make_number (state.thislevelstart),
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2693 Fcons (state.instring >= 0
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2694 ? (state.instring == ST_STRING_STYLE
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2695 ? Qt : make_number (state.instring)) : Qnil,
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2696 Fcons (state.incomment ? Qt : Qnil,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2697 Fcons (state.quoted ? Qt : Qnil,
1085
91a456e52db1 (scan_lists): Improve smarts for backwards scan of comments.
Richard M. Stallman <rms@gnu.org>
parents: 726
diff changeset
2698 Fcons (make_number (state.mindepth),
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2699 Fcons (state.comstyle
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2700 ? (state.comstyle == ST_COMMENT_STYLE
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2701 ? Qsyntax_table : Qt) : Qnil,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2702 Fcons (state.comstr_start != -1 ? make_number (state.comstr_start) : Qnil,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2703 Qnil)))))))));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2704 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2705
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2706 init_syntax_once ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2707 {
17126
f8d7263cce09 (init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents: 17109
diff changeset
2708 register int i, c;
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
2709 Lisp_Object temp;
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
2710
13218
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2711 /* This has to be done here, before we call Fmake_char_table. */
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2712 Qsyntax_table = intern ("syntax-table");
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2713 staticpro (&Qsyntax_table);
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2714
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2715 /* Intern this now in case it isn't already done.
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2716 Setting this variable twice is harmless.
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2717 But don't staticpro it here--that is done in alloc.c. */
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2718 Qchar_table_extra_slots = intern ("char-table-extra-slots");
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2719
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2720 /* Create objects which can be shared among syntax tables. */
18738
bcc43754d3bc (init_syntax_once): Convert Fmake_vector argument to Lisp_Integer.
Richard M. Stallman <rms@gnu.org>
parents: 18613
diff changeset
2721 Vsyntax_code_object = Fmake_vector (make_number (13), Qnil);
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2722 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
2723 XVECTOR (Vsyntax_code_object)->contents[i]
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2724 = Fcons (make_number (i), Qnil);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2725
13218
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2726 /* 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
2727 create syntax tables. */
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2728 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
2729
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2730 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
2731
13218
d2fc560c7740 (Qsyntax_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 13144
diff changeset
2732 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2733
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2734 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword];
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2735 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
2736 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2737 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
2738 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2739 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
2740 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
2741
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
2742 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
2743 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '%', temp);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2744
13144
fd14ccddb85a (describe_syntax): Handle new syntax-table data format.
Richard M. Stallman <rms@gnu.org>
parents: 12894
diff changeset
2745 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
2746 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
2747 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
2748 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
2749 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
2750 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
2751 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
2752 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
2753 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
2754 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
2755 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
2756 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
2757 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
2758 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
2759 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
2760 Fcons (make_number ((int) Sescape), Qnil));
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2761
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2762 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol];
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2763 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
2764 {
f8d7263cce09 (init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents: 17109
diff changeset
2765 c = "_-+*/&|<>="[i];
f8d7263cce09 (init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents: 17109
diff changeset
2766 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
2767 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2768
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2769 temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct];
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2770 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
2771 {
f8d7263cce09 (init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents: 17109
diff changeset
2772 c = ".,;:?!#@~^'`"[i];
f8d7263cce09 (init_syntax_once): Add trick to avoid compiler warning
Kenichi Handa <handa@m17n.org>
parents: 17109
diff changeset
2773 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
2774 }
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2775 }
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2776
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2777 syms_of_syntax ()
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2778 {
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2779 Qsyntax_table_p = intern ("syntax-table-p");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2780 staticpro (&Qsyntax_table_p);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2781
17044
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2782 staticpro (&Vsyntax_code_object);
f07c36097f33 Include charset.h and category.h.
Karl Heuer <kwzh@gnu.org>
parents: 16992
diff changeset
2783
16992
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2784 Qscan_error = intern ("scan-error");
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2785 staticpro (&Qscan_error);
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2786 Fput (Qscan_error, Qerror_conditions,
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2787 Fcons (Qerror, Qnil));
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2788 Fput (Qscan_error, Qerror_message,
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2789 build_string ("Scan error"));
ff7346c31184 (scan_lists): Signal errors using scan-error.
Richard M. Stallman <rms@gnu.org>
parents: 16039
diff changeset
2790
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2791 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2792 "Non-nil means `forward-sexp', etc., should treat comments as whitespace.");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2793
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2794 DEFVAR_BOOL ("parse-sexp-lookup-properties", &parse_sexp_lookup_properties,
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2795 "Non-nil means `forward-sexp', etc., grant `syntax-table' property.\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2796 The value of this property should be either a syntax table, or a cons\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2797 of the form (SYNTAXCODE . MATCHCHAR), SYNTAXCODE being the numeric\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2798 syntax code, MATCHCHAR being nil or the character to match (which is\n\
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2799 relevant only for open/close type.");
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2800
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2801 words_include_escapes = 0;
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2802 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes,
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2803 "Non-nil means `forward-word', etc., should treat escape chars part of words.");
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2804
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2805 defsubr (&Ssyntax_table_p);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2806 defsubr (&Ssyntax_table);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2807 defsubr (&Sstandard_syntax_table);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2808 defsubr (&Scopy_syntax_table);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2809 defsubr (&Sset_syntax_table);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2810 defsubr (&Schar_syntax);
7968
a6372621abd9 (Fmatching_paren): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7924
diff changeset
2811 defsubr (&Smatching_paren);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2812 defsubr (&Smodify_syntax_entry);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2813 defsubr (&Sdescribe_syntax);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2814
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2815 defsubr (&Sforward_word);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2816
17464
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2817 defsubr (&Sskip_chars_forward);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2818 defsubr (&Sskip_chars_backward);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2819 defsubr (&Sskip_syntax_forward);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2820 defsubr (&Sskip_syntax_backward);
36483a1ada24 (SYNTAX_ENTRY_VIA_PROPERTY): Set to take `syntax-table'
Richard M. Stallman <rms@gnu.org>
parents: 17126
diff changeset
2821
1998
656f4297962e (describe_syntax_1): Delete excess arg to describe_vector.
Richard M. Stallman <rms@gnu.org>
parents: 1394
diff changeset
2822 defsubr (&Sforward_comment);
163
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2823 defsubr (&Sscan_lists);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2824 defsubr (&Sscan_sexps);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2825 defsubr (&Sbackward_prefix_chars);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2826 defsubr (&Sparse_partial_sexp);
0f3996cb4ae5 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2827 }