]> code.delx.au - gnu-emacs/blobdiff - src/syntax.c
(indent-for-tab-command): Indent the region if
[gnu-emacs] / src / syntax.c
index 052191d5fef8f670f5306178551fddaef5bdb053..4afaeda82dbb3058bc1a55228a1f69c0695d6bf5 100644 (file)
@@ -1,12 +1,13 @@
 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
 /* 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
+                 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 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
 
 This file is part of GNU Emacs.
 
 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -915,7 +916,7 @@ DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0,
        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
        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;
 text property.  */)
      (string)
      Lisp_Object string;
@@ -1275,19 +1276,19 @@ scan_words (from, count)
          position of it.  */
       while (1)
        {
          position of it.  */
       while (1)
        {
-         int temp_byte;
-
          if (from == beg)
            break;
          if (from == beg)
            break;
-         temp_byte = dec_bytepos (from_byte);
+         DEC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_BACKWARD (from);
          UPDATE_SYNTAX_TABLE_BACKWARD (from);
-         ch0 = FETCH_CHAR (temp_byte);
+         ch0 = FETCH_CHAR (from_byte);
          code = SYNTAX (ch0);
          if (!(words_include_escapes
                && (code == Sescape || code == Scharquote)))
            if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
          code = SYNTAX (ch0);
          if (!(words_include_escapes
                && (code == Sescape || code == Scharquote)))
            if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
-             break;
-         DEC_BOTH (from, from_byte);
+             {
+               INC_BOTH (from, from_byte);
+               break;
+             }
          ch1 = ch0;
        }
       count++;
          ch1 = ch0;
        }
       count++;
@@ -1470,7 +1471,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
              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;
              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;
 
              unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
              re_wctype_t cc;
 
@@ -1668,10 +1669,10 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
                      p = GPT_ADDR;
                      stop = endp;
                    }
                      p = GPT_ADDR;
                      stop = endp;
                    }
+                 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
                  if (! fastmap[(int) SYNTAX (p[-1])])
                    break;
                  p--, pos--;
                  if (! fastmap[(int) SYNTAX (p[-1])])
                    break;
                  p--, pos--;
-                 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
                }
          }
       }
                }
          }
       }
@@ -3046,7 +3047,7 @@ Fourth arg STOPBEFORE non-nil means stop when come to
  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
  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.  */)
 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.  */)