Mercurial > emacs
comparison src/syntax.c @ 3794:ea9d3f2cd5fa
(scan_lists, Fforward_comment): #if 0 the code
to treat two-character comment enders with a special shortcut.
(scan_sexps_forward): Set state.comstart to before the
comment starter, not after.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Thu, 17 Jun 1993 04:09:15 +0000 |
| parents | 408c7ee69be7 |
| children | 373bff27d0d6 |
comparison
equal
deleted
inserted
replaced
| 3793:374fc1ccdc3f | 3794:ea9d3f2cd5fa |
|---|---|
| 682 from--; | 682 from--; |
| 683 } | 683 } |
| 684 | 684 |
| 685 if (code == Sendcomment && !quoted) | 685 if (code == Sendcomment && !quoted) |
| 686 { | 686 { |
| 687 #if 0 | |
| 687 if (code != SYNTAX (c)) | 688 if (code != SYNTAX (c)) |
| 688 /* For a two-char comment ender, we can assume | 689 /* For a two-char comment ender, we can assume |
| 689 it does end a comment. So scan back in a simple way. */ | 690 it does end a comment. So scan back in a simple way. */ |
| 690 { | 691 { |
| 691 if (from != stop) from--; | 692 if (from != stop) from--; |
| 707 && !char_quoted (from)) | 708 && !char_quoted (from)) |
| 708 break; | 709 break; |
| 709 } | 710 } |
| 710 break; | 711 break; |
| 711 } | 712 } |
| 713 #endif /* 0 */ | |
| 712 | 714 |
| 713 /* Look back, counting the parity of string-quotes, | 715 /* Look back, counting the parity of string-quotes, |
| 714 and recording the comment-starters seen. | 716 and recording the comment-starters seen. |
| 715 When we reach a safe place, assume that's not in a string; | 717 When we reach a safe place, assume that's not in a string; |
| 716 then step the main scan to the earliest comment-starter seen | 718 then step the main scan to the earliest comment-starter seen |
| 1074 break; | 1076 break; |
| 1075 | 1077 |
| 1076 case Sendcomment: | 1078 case Sendcomment: |
| 1077 if (!parse_sexp_ignore_comments) | 1079 if (!parse_sexp_ignore_comments) |
| 1078 break; | 1080 break; |
| 1081 #if 0 | |
| 1079 if (code != SYNTAX (c)) | 1082 if (code != SYNTAX (c)) |
| 1080 /* For a two-char comment ender, we can assume | 1083 /* For a two-char comment ender, we can assume |
| 1081 it does end a comment. So scan back in a simple way. */ | 1084 it does end a comment. So scan back in a simple way. */ |
| 1082 { | 1085 { |
| 1083 if (from != stop) from--; | 1086 if (from != stop) from--; |
| 1094 && !char_quoted (from)) | 1097 && !char_quoted (from)) |
| 1095 break; | 1098 break; |
| 1096 } | 1099 } |
| 1097 break; | 1100 break; |
| 1098 } | 1101 } |
| 1102 #endif /* 0 */ | |
| 1099 | 1103 |
| 1100 /* Look back, counting the parity of string-quotes, | 1104 /* Look back, counting the parity of string-quotes, |
| 1101 and recording the comment-starters seen. | 1105 and recording the comment-starters seen. |
| 1102 When we reach a safe place, assume that's not in a string; | 1106 When we reach a safe place, assume that's not in a string; |
| 1103 then step the main scan to the earliest comment-starter seen | 1107 then step the main scan to the earliest comment-starter seen |
| 1408 | 1412 |
| 1409 while (from < end) | 1413 while (from < end) |
| 1410 { | 1414 { |
| 1411 code = SYNTAX (FETCH_CHAR (from)); | 1415 code = SYNTAX (FETCH_CHAR (from)); |
| 1412 from++; | 1416 from++; |
| 1413 if (from < end && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) | 1417 if (code == Scomment) |
| 1414 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from))) | 1418 state.comstart = from-1; |
| 1419 | |
| 1420 else if (from < end && SYNTAX_COMSTART_FIRST (FETCH_CHAR (from - 1)) | |
| 1421 && SYNTAX_COMSTART_SECOND (FETCH_CHAR (from))) | |
| 1415 { | 1422 { |
| 1416 /* Record the comment style we have entered so that only | 1423 /* Record the comment style we have entered so that only |
| 1417 the comment-end sequence of the same style actually | 1424 the comment-end sequence of the same style actually |
| 1418 terminates the comment section. */ | 1425 terminates the comment section. */ |
| 1419 code = Scomment; | 1426 code = Scomment; |
| 1420 state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)); | 1427 state.comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from)); |
| 1428 state.comstart = from-1; | |
| 1421 from++; | 1429 from++; |
| 1422 } | 1430 } |
| 1423 | 1431 |
| 1424 if (SYNTAX_PREFIX (FETCH_CHAR (from - 1))) | 1432 if (SYNTAX_PREFIX (FETCH_CHAR (from - 1))) |
| 1425 continue; | 1433 continue; |
| 1469 curlevel->prev = curlevel->last; | 1477 curlevel->prev = curlevel->last; |
| 1470 break; | 1478 break; |
| 1471 | 1479 |
| 1472 case Scomment: | 1480 case Scomment: |
| 1473 state.incomment = 1; | 1481 state.incomment = 1; |
| 1474 state.comstart = from; | |
| 1475 startincomment: | 1482 startincomment: |
| 1476 if (commentstop) | 1483 if (commentstop) |
| 1477 goto done; | 1484 goto done; |
| 1478 while (1) | 1485 while (1) |
| 1479 { | 1486 { |
