X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d918f936d5bfc7e126cc3b1bbf6ce80836c8d6f1..08b3caa982199bd7939d9d6877203ada5d0083b5:/src/syntax.c
diff --git a/src/syntax.c b/src/syntax.c
index f40900834a..541411b4d2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1,14 +1,14 @@
/* GNU Emacs routines to deal with syntax tables; also word and list parsing.
Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007
+ 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
@@ -16,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 . */
#include
@@ -300,6 +298,18 @@ char_quoted (charpos, bytepos)
register int quoted = 0;
int orig = charpos;
+#ifdef HAVE_NS
+ /* For some reason keeps getting called w/both 1, then segfaulting
+ due to the definitions of DEC_BOTH and DEC_POS in character.h,
+ which lead to decrementing below initial address and then examining
+ character there. Need to investigate further.. */
+ if (charpos < 2 || bytepos < 2)
+ {
+ //fprintf(stderr,"Returning because charpos = %d, bytepos = %d\n",charpos, bytepos);
+ return 0;
+ }
+#endif
+
DEC_BOTH (charpos, bytepos);
while (charpos >= beg)
@@ -1324,7 +1334,7 @@ scan_words (from, count)
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
@@ -1713,7 +1723,11 @@ skip_chars (forwardp, string, lim, handle_iso_classes)
int c2 = char_ranges[i + 1];
for (; c1 <= c2; c1++)
- fastmap[CHAR_TO_BYTE8 (c1)] = 1;
+ {
+ int b = CHAR_TO_BYTE_SAFE (c1);
+ if (b >= 0)
+ fastmap[b] = 1;
+ }
}
}
}
@@ -2501,7 +2515,8 @@ scan_lists (from, count, depth, sexpflag)
{
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:
@@ -2520,7 +2535,8 @@ scan_lists (from, count, depth, sexpflag)
case Scharquote:
case Sescape:
INC_BOTH (from, from_byte);
- if (from == stop) goto lose;
+ if (from == stop)
+ goto lose;
break;
case Sword:
case Ssymbol:
@@ -2586,7 +2602,8 @@ scan_lists (from, count, depth, sexpflag)
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
@@ -2615,7 +2632,8 @@ scan_lists (from, count, depth, sexpflag)
}
/* 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;
@@ -2750,7 +2768,8 @@ scan_lists (from, count, depth, sexpflag)
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)
@@ -2765,7 +2784,8 @@ scan_lists (from, count, depth, sexpflag)
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)
@@ -2783,7 +2803,8 @@ scan_lists (from, count, depth, sexpflag)
}
/* 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;