aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1998-01-18 05:15:48 +0000
committerKarl Heuer1998-01-18 05:15:48 +0000
commit9828a4773403c14a42b6f267107062c49d46fa44 (patch)
tree1892f33ec88b00b2135345f8422e38d8e2cabcdf /src
parentec28575a5c57d1dfb74549da0d77e6e8edf61c86 (diff)
downloademacs-9828a4773403c14a42b6f267107062c49d46fa44.tar.gz
emacs-9828a4773403c14a42b6f267107062c49d46fa44.zip
(skip_chars): Fix test for end of string, looking for `-'.
(back_comment): Don't allow quoting a comment-end. (scan_lists): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/syntax.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/syntax.c b/src/syntax.c
index e80ecc4a279..e79b98cbe2f 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -447,8 +447,8 @@ back_comment (from, from_byte, stop, comstyle, charpos_ptr, bytepos_ptr)
447 && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (temp_byte))))) 447 && comstyle == SYNTAX_COMMENT_STYLE (FETCH_CHAR (temp_byte)))))
448 code = Scomment; 448 code = Scomment;
449 449
450 /* Ignore escaped characters. */ 450 /* Ignore escaped characters, except comment-enders. */
451 if (char_quoted (from, from_byte)) 451 if (code != Sendcomment && char_quoted (from, from_byte))
452 continue; 452 continue;
453 453
454 /* Track parity of quotes. */ 454 /* Track parity of quotes. */
@@ -1281,7 +1281,7 @@ skip_chars (forwardp, syntaxp, string, lim)
1281 else 1281 else
1282 c = XSTRING (string)->data[i++]; 1282 c = XSTRING (string)->data[i++];
1283 } 1283 }
1284 if (i == XSTRING (string)->size && XSTRING (string)->data[i] == '-') 1284 if (i < XSTRING (string)->size && XSTRING (string)->data[i] == '-')
1285 { 1285 {
1286 unsigned int c2; 1286 unsigned int c2;
1287 1287
@@ -1921,11 +1921,6 @@ scan_lists (from, count, depth, sexpflag)
1921 { 1921 {
1922 DEC_BOTH (from, from_byte); 1922 DEC_BOTH (from, from_byte);
1923 UPDATE_SYNTAX_TABLE_BACKWARD (from); 1923 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1924 if (quoted = char_quoted (from, from_byte))
1925 {
1926 DEC_BOTH (from, from_byte);
1927 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1928 }
1929 c = FETCH_CHAR (from_byte); 1924 c = FETCH_CHAR (from_byte);
1930 code = SYNTAX (c); 1925 code = SYNTAX (c);
1931 if (depth == min_depth) 1926 if (depth == min_depth)
@@ -1937,7 +1932,6 @@ scan_lists (from, count, depth, sexpflag)
1937 DEC_POS (temp_pos); 1932 DEC_POS (temp_pos);
1938 if (from > stop && SYNTAX_COMEND_SECOND (c) 1933 if (from > stop && SYNTAX_COMEND_SECOND (c)
1939 && (c1 = FETCH_CHAR (temp_pos), SYNTAX_COMEND_FIRST (c1)) 1934 && (c1 = FETCH_CHAR (temp_pos), SYNTAX_COMEND_FIRST (c1))
1940 && !char_quoted (from - 1, temp_pos)
1941 && parse_sexp_ignore_comments) 1935 && parse_sexp_ignore_comments)
1942 { 1936 {
1943 /* we must record the comment style encountered so that 1937 /* we must record the comment style encountered so that
@@ -1948,13 +1942,19 @@ scan_lists (from, count, depth, sexpflag)
1948 DEC_BOTH (from, from_byte); 1942 DEC_BOTH (from, from_byte);
1949 } 1943 }
1950 1944
1951 if (SYNTAX_PREFIX (c)) 1945 /* Quoting turns anything except a comment-ender
1946 into a word character. */
1947 if (code != Sendcomment && char_quoted (from, from_byte))
1948 code = Sword;
1949 else if (SYNTAX_PREFIX (c))
1952 continue; 1950 continue;
1953 1951
1954 switch (SWITCH_ENUM_CAST (quoted ? Sword : code)) 1952 switch (SWITCH_ENUM_CAST (code))
1955 { 1953 {
1956 case Sword: 1954 case Sword:
1957 case Ssymbol: 1955 case Ssymbol:
1956 case Sescape:
1957 case Scharquote:
1958 if (depth || !sexpflag) break; 1958 if (depth || !sexpflag) break;
1959 /* This word counts as a sexp; count object finished 1959 /* This word counts as a sexp; count object finished
1960 after passing it. */ 1960 after passing it. */
@@ -1963,6 +1963,11 @@ scan_lists (from, count, depth, sexpflag)
1963 temp_pos = from_byte; 1963 temp_pos = from_byte;
1964 DEC_POS (temp_pos); 1964 DEC_POS (temp_pos);
1965 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); 1965 UPDATE_SYNTAX_TABLE_BACKWARD (from - 1);
1966 c1 = FETCH_CHAR (temp_pos);
1967 temp_code = SYNTAX (c1);
1968 /* Don't allow comment-end to be quoted. */
1969 if (temp_code == Sendcomment)
1970 goto done2;
1966 quoted = char_quoted (from - 1, temp_pos); 1971 quoted = char_quoted (from - 1, temp_pos);
1967 if (quoted) 1972 if (quoted)
1968 { 1973 {