comparison src/syntax.c @ 4912:e99033b7e05c

use more specific `scan-error' in scan-lists to be GNU compatible -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-01 Ben Wing <ben@xemacs.org> * syntax.c: * syntax.c (scan_lists): * syntax.c (syms_of_syntax): Declare `scan-error' as a type of `syntax-error'. In `scan-lists' et al., don't signal a syntax error but instead a `scan-error', and pass a couple of integer arguments, for GNU compatibility. Fixes problems with typing double-quote in texinfo.el.
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 23:07:33 -0600
parents aa5ed11f473b
children 16112448d484
comparison
equal deleted inserted replaced
4907:9e7f5a77cc84 4912:e99033b7e05c
66 66
67 Lisp_Object Vtemp_table_for_use_updating_syntax_tables; 67 Lisp_Object Vtemp_table_for_use_updating_syntax_tables;
68 68
69 /* A value that is guaranteed not be in a syntax table. */ 69 /* A value that is guaranteed not be in a syntax table. */
70 Lisp_Object Vbogus_syntax_table_value; 70 Lisp_Object Vbogus_syntax_table_value;
71
72 Lisp_Object Qscan_error;
71 73
72 static void syntax_cache_table_was_changed (struct buffer *buf); 74 static void syntax_cache_table_was_changed (struct buffer *buf);
73 75
74 /* This is the internal form of the parse state used in parse-partial-sexp. */ 76 /* This is the internal form of the parse state used in parse-partial-sexp. */
75 77
1351 int mathexit = 0; 1353 int mathexit = 0;
1352 enum syntaxcode code; 1354 enum syntaxcode code;
1353 int syncode; 1355 int syncode;
1354 int min_depth = depth; /* Err out if depth gets less than this. */ 1356 int min_depth = depth; /* Err out if depth gets less than this. */
1355 struct syntax_cache *scache; 1357 struct syntax_cache *scache;
1358 Charbpos last_good = from;
1356 1359
1357 if (depth > 0) min_depth = 0; 1360 if (depth > 0) min_depth = 0;
1358 1361
1359 scache = setup_buffer_syntax_cache (buf, from, count); 1362 scache = setup_buffer_syntax_cache (buf, from, count);
1360 while (count > 0) 1363 while (count > 0)
1368 1371
1369 UPDATE_SYNTAX_CACHE_FORWARD (scache, from); 1372 UPDATE_SYNTAX_CACHE_FORWARD (scache, from);
1370 c = BUF_FETCH_CHAR (buf, from); 1373 c = BUF_FETCH_CHAR (buf, from);
1371 syncode = SYNTAX_CODE_FROM_CACHE (scache, c); 1374 syncode = SYNTAX_CODE_FROM_CACHE (scache, c);
1372 code = SYNTAX_FROM_CODE (syncode); 1375 code = SYNTAX_FROM_CODE (syncode);
1376 if (depth == min_depth)
1377 last_good = from;
1373 from++; 1378 from++;
1374 1379
1375 /* a 1-char comment start sequence */ 1380 /* a 1-char comment start sequence */
1376 if (code == Scomment && parse_sexp_ignore_comments) 1381 if (code == Scomment && parse_sexp_ignore_comments)
1377 { 1382 {
1481 if (!--depth) goto done; 1486 if (!--depth) goto done;
1482 if (depth < min_depth) 1487 if (depth < min_depth)
1483 { 1488 {
1484 if (noerror) 1489 if (noerror)
1485 return Qnil; 1490 return Qnil;
1486 syntax_error ("Containing expression ends prematurely", 1491 signal_error_2 (Qscan_error,
1487 Qunbound); 1492 "Containing expression ends prematurely",
1493 make_int (last_good), make_int (from));
1488 } 1494 }
1489 break; 1495 break;
1490 1496
1491 case Sstring_fence: 1497 case Sstring_fence:
1492 case Sstring: 1498 case Sstring:
1654 if (!--depth) goto done2; 1660 if (!--depth) goto done2;
1655 if (depth < min_depth) 1661 if (depth < min_depth)
1656 { 1662 {
1657 if (noerror) 1663 if (noerror)
1658 return Qnil; 1664 return Qnil;
1659 syntax_error ("Containing expression ends prematurely", 1665 signal_error_2 (Qscan_error,
1660 Qunbound); 1666 "Containing expression ends prematurely",
1667 make_int (last_good), make_int (from));
1661 } 1668 }
1662 break; 1669 break;
1663 1670
1664 case Scomment_fence: 1671 case Scomment_fence:
1665 comstyle = ST_COMMENT_STYLE; 1672 comstyle = ST_COMMENT_STYLE;
1725 1732
1726 return (make_int (from)); 1733 return (make_int (from));
1727 1734
1728 lose: 1735 lose:
1729 if (!noerror) 1736 if (!noerror)
1730 syntax_error ("Unbalanced parentheses", Qunbound); 1737 signal_error_2 (Qscan_error, "Unbalanced parentheses",
1738 make_int (last_good), make_int (from));
1731 return Qnil; 1739 return Qnil;
1732 } 1740 }
1733 1741
1734 int 1742 int
1735 char_quoted (struct buffer *buf, Charbpos pos) 1743 char_quoted (struct buffer *buf, Charbpos pos)
2416 DEFSUBR (Fforward_comment); 2424 DEFSUBR (Fforward_comment);
2417 DEFSUBR (Fscan_lists); 2425 DEFSUBR (Fscan_lists);
2418 DEFSUBR (Fscan_sexps); 2426 DEFSUBR (Fscan_sexps);
2419 DEFSUBR (Fbackward_prefix_chars); 2427 DEFSUBR (Fbackward_prefix_chars);
2420 DEFSUBR (Fparse_partial_sexp); 2428 DEFSUBR (Fparse_partial_sexp);
2429
2430 DEFERROR_STANDARD (Qscan_error, Qsyntax_error);
2421 } 2431 }
2422 2432
2423 void 2433 void
2424 vars_of_syntax (void) 2434 vars_of_syntax (void)
2425 { 2435 {