comparison src/syntax.c @ 57756:a8bc01ac68d0

(scan_sexps_forward): Prefer 2-char comment-starter over a 1-char one.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 27 Oct 2004 20:15:05 +0000
parents 2c932ff651d2
children 98e94b29b59b e24e2e78deda
comparison
equal deleted inserted replaced
57755:6e18b0aebeb3 57756:a8bc01ac68d0
2797 while (from < end) 2797 while (from < end)
2798 { 2798 {
2799 INC_FROM; 2799 INC_FROM;
2800 code = prev_from_syntax & 0xff; 2800 code = prev_from_syntax & 0xff;
2801 2801
2802 if (code == Scomment) 2802 if (from < end
2803 { 2803 && SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
2804 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax); 2804 && (c1 = FETCH_CHAR (from_byte),
2805 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ? 2805 SYNTAX_COMSTART_SECOND (c1)))
2806 1 : -1); 2806 /* Duplicate code to avoid a complex if-expression
2807 which causes trouble for the SGI compiler. */
2808 {
2809 /* Record the comment style we have entered so that only
2810 the comment-end sequence of the same style actually
2811 terminates the comment section. */
2812 state.comstyle = SYNTAX_COMMENT_STYLE (c1);
2813 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
2814 comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
2815 state.incomment = comnested ? 1 : -1;
2807 state.comstr_start = prev_from; 2816 state.comstr_start = prev_from;
2817 INC_FROM;
2818 code = Scomment;
2808 } 2819 }
2809 else if (code == Scomment_fence) 2820 else if (code == Scomment_fence)
2810 { 2821 {
2811 /* Record the comment style we have entered so that only 2822 /* Record the comment style we have entered so that only
2812 the comment-end sequence of the same style actually 2823 the comment-end sequence of the same style actually
2814 state.comstyle = ST_COMMENT_STYLE; 2825 state.comstyle = ST_COMMENT_STYLE;
2815 state.incomment = -1; 2826 state.incomment = -1;
2816 state.comstr_start = prev_from; 2827 state.comstr_start = prev_from;
2817 code = Scomment; 2828 code = Scomment;
2818 } 2829 }
2819 else if (from < end) 2830 else if (code == Scomment)
2820 if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)) 2831 {
2821 if (c1 = FETCH_CHAR (from_byte), 2832 state.comstyle = SYNTAX_FLAGS_COMMENT_STYLE (prev_from_syntax);
2822 SYNTAX_COMSTART_SECOND (c1)) 2833 state.incomment = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) ?
2823 /* Duplicate code to avoid a complex if-expression 2834 1 : -1);
2824 which causes trouble for the SGI compiler. */ 2835 state.comstr_start = prev_from;
2825 { 2836 }
2826 /* Record the comment style we have entered so that only
2827 the comment-end sequence of the same style actually
2828 terminates the comment section. */
2829 state.comstyle = SYNTAX_COMMENT_STYLE (c1);
2830 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax);
2831 comnested = comnested || SYNTAX_COMMENT_NESTED (c1);
2832 state.incomment = comnested ? 1 : -1;
2833 state.comstr_start = prev_from;
2834 INC_FROM;
2835 code = Scomment;
2836 }
2837 2837
2838 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax)) 2838 if (SYNTAX_FLAGS_PREFIX (prev_from_syntax))
2839 continue; 2839 continue;
2840 switch (SWITCH_ENUM_CAST (code)) 2840 switch (SWITCH_ENUM_CAST (code))
2841 { 2841 {