/* GNU Emacs routines to deal with syntax tables; also word and list parsing.
- Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2002,
- 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001,
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
This file is part of GNU Emacs.
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
doc: /* Convert a syntax specification STRING into syntax cell form.
STRING should be a string as it is allowed as argument of
`modify-syntax-entry'. Value is the equivalent cons cell
-(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
+\(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
text property. */)
(string)
Lisp_Object string;
script = CHAR_TABLE_REF (Vchar_script_table, ch1);
while (1)
{
- int temp_byte;
-
if (from == beg)
break;
- temp_byte = dec_bytepos (from_byte);
+ DEC_BOTH (from, from_byte);
UPDATE_SYNTAX_TABLE_BACKWARD (from);
- ch0 = FETCH_CHAR_AS_MULTIBYTE (temp_byte);
+ ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
code = SYNTAX (ch0);
if ((code != Sword
&& (! words_include_escapes
|| (code != Sescape && code != Scharquote)))
|| ! EQ (CHAR_TABLE_REF (Vchar_script_table, ch0), script))
- break;
- DEC_BOTH (from, from_byte);
+ {
+ INC_BOTH (from, from_byte);
+ break;
+ }
ch1 = ch0;
}
}
return from;
}
-DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "p",
+DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "^p",
doc: /* Move point forward ARG words (backward if ARG is negative).
Normally returns t.
If an edge of the buffer or a field boundary is reached, point is left there
const unsigned char *class_beg = str + i_byte + 1;
const unsigned char *class_end = class_beg;
const unsigned char *class_limit = str + size_byte - 2;
- /* Leave room for the null. */
+ /* Leave room for the null. */
unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
re_wctype_t cc;
p = GPT_ADDR;
stop = endp;
}
+ UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
prev_p = p;
while (--p >= stop && ! CHAR_HEAD_P (*p));
c = STRING_CHAR (p, MAX_MULTIBYTE_LENGTH);
if (! fastmap[(int) SYNTAX (c)])
break;
pos--, pos_byte -= prev_p - p;
- UPDATE_SYNTAX_TABLE_BACKWARD (pos);
}
}
else
p = GPT_ADDR;
stop = endp;
}
+ UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
if (! fastmap[(int) SYNTAX (p[-1])])
break;
p--, pos--, pos_byte--;
- UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
}
}
}
{
case Sescape:
case Scharquote:
- if (from == stop) goto lose;
+ if (from == stop)
+ goto lose;
INC_BOTH (from, from_byte);
/* treat following character as a word constituent */
case Sword:
case Scharquote:
case Sescape:
INC_BOTH (from, from_byte);
- if (from == stop) goto lose;
+ if (from == stop)
+ goto lose;
break;
case Sword:
case Ssymbol:
stringterm = FETCH_CHAR_AS_MULTIBYTE (temp_pos);
while (1)
{
- if (from >= stop) goto lose;
+ if (from >= stop)
+ goto lose;
UPDATE_SYNTAX_TABLE_FORWARD (from);
c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
if (code == Sstring
}
/* Reached end of buffer. Error if within object, return nil if between */
- if (depth) goto lose;
+ if (depth)
+ goto lose;
immediate_quit = 0;
return Qnil;
case Sstring_fence:
while (1)
{
- if (from == stop) goto lose;
+ if (from == stop)
+ goto lose;
DEC_BOTH (from, from_byte);
UPDATE_SYNTAX_TABLE_BACKWARD (from);
if (!char_quoted (from, from_byte)
stringterm = FETCH_CHAR_AS_MULTIBYTE (from_byte);
while (1)
{
- if (from == stop) goto lose;
+ if (from == stop)
+ goto lose;
DEC_BOTH (from, from_byte);
UPDATE_SYNTAX_TABLE_BACKWARD (from);
if (!char_quoted (from, from_byte)
}
/* Reached start of buffer. Error if within object, return nil if between */
- if (depth) goto lose;
+ if (depth)
+ goto lose;
immediate_quit = 0;
return Qnil;
any character that starts a sexp.
Fifth arg OLDSTATE is a list like what this function returns.
It is used to initialize the state of the parse. Elements number 1, 2, 6
- and 8 are ignored; you can leave off element 8 (the last) entirely.
+ and 8 are ignored.
Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
If it is symbol `syntax-table', stop after the start of a comment or a
string, or after end of a comment or a string. */)