# HG changeset patch # User Karl Heuer # Date 885100548 0 # Node ID fa7d4c0ee36c080e7cc8f9d5bce565b4ad3b2a13 # Parent e8a304f0d46199d5644faea98e59ba10336d4f51 (skip_chars): Fix test for end of string, looking for `-'. (back_comment): Don't allow quoting a comment-end. (scan_lists): Likewise. diff -r e8a304f0d461 -r fa7d4c0ee36c src/syntax.c --- a/src/syntax.c Sun Jan 18 04:57:01 1998 +0000 +++ b/src/syntax.c Sun Jan 18 05:15:48 1998 +0000 @@ -447,8 +447,8 @@ && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (temp_byte))))) code = Scomment; - /* Ignore escaped characters. */ - if (char_quoted (from, from_byte)) + /* Ignore escaped characters, except comment-enders. */ + if (code != Sendcomment && char_quoted (from, from_byte)) continue; /* Track parity of quotes. */ @@ -1281,7 +1281,7 @@ else c = XSTRING (string)->data[i++]; } - if (i == XSTRING (string)->size && XSTRING (string)->data[i] == '-') + if (i < XSTRING (string)->size && XSTRING (string)->data[i] == '-') { unsigned int c2; @@ -1921,11 +1921,6 @@ { DEC_BOTH (from, from_byte); UPDATE_SYNTAX_TABLE_BACKWARD (from); - if (quoted = char_quoted (from, from_byte)) - { - DEC_BOTH (from, from_byte); - UPDATE_SYNTAX_TABLE_BACKWARD (from); - } c = FETCH_CHAR (from_byte); code = SYNTAX (c); if (depth == min_depth) @@ -1937,7 +1932,6 @@ DEC_POS (temp_pos); if (from > stop && SYNTAX_COMEND_SECOND (c) && (c1 = FETCH_CHAR (temp_pos), SYNTAX_COMEND_FIRST (c1)) - && !char_quoted (from - 1, temp_pos) && parse_sexp_ignore_comments) { /* we must record the comment style encountered so that @@ -1948,13 +1942,19 @@ DEC_BOTH (from, from_byte); } - if (SYNTAX_PREFIX (c)) + /* Quoting turns anything except a comment-ender + into a word character. */ + if (code != Sendcomment && char_quoted (from, from_byte)) + code = Sword; + else if (SYNTAX_PREFIX (c)) continue; - switch (SWITCH_ENUM_CAST (quoted ? Sword : code)) + switch (SWITCH_ENUM_CAST (code)) { case Sword: case Ssymbol: + case Sescape: + case Scharquote: if (depth || !sexpflag) break; /* This word counts as a sexp; count object finished after passing it. */ @@ -1963,6 +1963,11 @@ temp_pos = from_byte; DEC_POS (temp_pos); UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); + c1 = FETCH_CHAR (temp_pos); + temp_code = SYNTAX (c1); + /* Don't allow comment-end to be quoted. */ + if (temp_code == Sendcomment) + goto done2; quoted = char_quoted (from - 1, temp_pos); if (quoted) {