aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorStefan Monnier2000-06-20 22:49:34 +0000
committerStefan Monnier2000-06-20 22:49:34 +0000
commitd355bd8ae6a26c50277d2fb24aba38a0b657dcbb (patch)
tree51434413c89c4309ea34de5fea6e92e7ba869d44 /src/syntax.c
parente6365855ebf0afae2ced986eb705aa515b62fa2a (diff)
downloademacs-d355bd8ae6a26c50277d2fb24aba38a0b657dcbb.tar.gz
emacs-d355bd8ae6a26c50277d2fb24aba38a0b657dcbb.zip
(scan_sexps_forward):
Check the comstyle of single-char comment-starters. Clarify control-flow around the Scomment case.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/syntax.c b/src/syntax.c
index eedec27d549..656d567b1a5 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2567,6 +2567,7 @@ do { prev_from = from; \
2567 2567
2568 if (code == Scomment) 2568 if (code == Scomment)
2569 { 2569 {
2570 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax);
2570 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? 2571 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ?
2571 1 : -1); 2572 1 : -1);
2572 state.comstr_start = prev_from; 2573 state.comstr_start = prev_from;
@@ -2642,22 +2643,13 @@ do { prev_from = from; \
2642 curlevel->prev = curlevel->last; 2643 curlevel->prev = curlevel->last;
2643 break; 2644 break;
2644 2645
2645 startincomment:
2646 if (commentstop == 1)
2647 goto done;
2648 goto commentloop;
2649
2650 case Scomment: 2646 case Scomment:
2651 if (! state.incomment)
2652 abort ();
2653 if (commentstop || boundary_stop) goto done; 2647 if (commentstop || boundary_stop) goto done;
2654 commentloop: 2648 startincomment:
2655 /* The (from == BEGV) test is to enter the loop in the middle so 2649 /* The (from == BEGV) test was to enter the loop in the middle so
2656 that we find a 2-char comment ender even if we start in the 2650 that we find a 2-char comment ender even if we start in the
2657 middle of it. We don't want to do that if we're just at the 2651 middle of it. We don't want to do that if we're just at the
2658 beginning of the comment (think of (*) ... (*)). 2652 beginning of the comment (think of (*) ... (*)). */
2659 Actually, the current code still doesn't handle such cases right
2660 when the comment style allows nesting. */
2661 found = forw_comment (from, from_byte, end, 2653 found = forw_comment (from, from_byte, end,
2662 state.incomment, state.comstyle, 2654 state.incomment, state.comstyle,
2663 (from == BEGV || from < state.comstr_start + 3) 2655 (from == BEGV || from < state.comstr_start + 3)
@@ -2668,7 +2660,7 @@ do { prev_from = from; \
2668 Luckily, the `done' doesn't use them and the INC_FROM 2660 Luckily, the `done' doesn't use them and the INC_FROM
2669 sets them to a sane value without looking at them. */ 2661 sets them to a sane value without looking at them. */
2670 if (!found) goto done; 2662 if (!found) goto done;
2671 INC_FROM; 2663 INC_FROM;
2672 state.incomment = 0; 2664 state.incomment = 0;
2673 state.comstyle = 0; /* reset the comment style */ 2665 state.comstyle = 0; /* reset the comment style */
2674 if (boundary_stop) goto done; 2666 if (boundary_stop) goto done;