Index: trunk/parsers/libmwparser/src/mwparsercontext.c |
— | — | @@ -721,7 +721,7 @@ |
722 | 722 | } |
723 | 723 | closeLists(context, i); |
724 | 724 | } |
725 | | - if (s != NULL && s->len == type->len && i == s->len) { |
| 725 | + if (s != NULL && s->len >= type->len && i == type->len) { |
726 | 726 | ANTLR3_UCHAR c = type->charAt(type, type->len - 1); |
727 | 727 | CASE(c, '*') { LSTNR->endBulletListItem(LSTNR); LSTNR->beginBulletListItem(LSTNR, NULL); } else |
728 | 728 | CASE(c, '#') { LSTNR->endEnumerationItem(LSTNR); LSTNR->beginEnumerationItem(LSTNR, NULL); } else |
— | — | @@ -730,7 +730,7 @@ |
731 | 731 | } else { |
732 | 732 | assert(false); // Invalid character representing a list item. |
733 | 733 | } |
734 | | - if (type->charAt(type, type->len - 1) != s->charAt(s, s->len - 1)) { |
| 734 | + if (type->len < s->len || type->charAt(type, type->len - 1) != s->charAt(s, s->len - 1)) { |
735 | 735 | updateListState(context, type, s->len - 1); |
736 | 736 | } |
737 | 737 | } else { |
Index: trunk/parsers/libmwparser/tests/testsuite |
— | — | @@ -579,7 +579,7 @@ |
580 | 580 | # List of the tested programs. |
581 | 581 | at_tested='' |
582 | 582 | # List of the all the test groups. |
583 | | -at_groups_all=' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34' |
| 583 | +at_groups_all=' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35' |
584 | 584 | # As many question marks as there are digits in the last test group number. |
585 | 585 | # Used to normalize the test group numbers so that `ls' lists them in |
586 | 586 | # numerical order. |
— | — | @@ -613,12 +613,13 @@ |
614 | 614 | 26;testsuite.at:182;list1;; |
615 | 615 | 27;testsuite.at:189;list2;; |
616 | 616 | 28;testsuite.at:196;list3;; |
617 | | -29;testsuite.at:203;hr;; |
618 | | -30;testsuite.at:210;link1;; |
619 | | -31;testsuite.at:218;link2;; |
620 | | -32;testsuite.at:225;link3;; |
621 | | -33;testsuite.at:232;link4;; |
622 | | -34;testsuite.at:239;link5;; |
| 617 | +29;testsuite.at:203;list4;; |
| 618 | +30;testsuite.at:210;hr;; |
| 619 | +31;testsuite.at:217;link1;; |
| 620 | +32;testsuite.at:225;link2;; |
| 621 | +33;testsuite.at:232;link3;; |
| 622 | +34;testsuite.at:239;link4;; |
| 623 | +35;testsuite.at:246;link5;; |
623 | 624 | " |
624 | 625 | |
625 | 626 | # at_fn_validate_ranges NAME... |
— | — | @@ -630,7 +631,7 @@ |
631 | 632 | for at_grp |
632 | 633 | do |
633 | 634 | eval at_value=\$$at_grp |
634 | | - if test $at_value -lt 1 || test $at_value -gt 34; then |
| 635 | + if test $at_value -lt 1 || test $at_value -gt 35; then |
635 | 636 | $as_echo "invalid test group: $at_value" >&2 |
636 | 637 | exit 1 |
637 | 638 | fi |
— | — | @@ -2982,11 +2983,11 @@ |
2983 | 2984 | read at_status <"$at_status_file" |
2984 | 2985 | #AT_STOP_28 |
2985 | 2986 | #AT_START_29 |
2986 | | -# 29. testsuite.at:203: hr |
| 2987 | +# 29. testsuite.at:203: list4 |
2987 | 2988 | at_setup_line='testsuite.at:203' |
2988 | 2989 | at_fn_banner 1 |
2989 | | -at_desc="hr" |
2990 | | -at_desc_line=" 29: $at_desc " |
| 2990 | +at_desc="list4" |
| 2991 | +at_desc_line=" 29: $at_desc " |
2991 | 2992 | $at_quiet $as_echo_n "$at_desc_line" |
2992 | 2993 | at_xfail=no |
2993 | 2994 | echo "# -*- compilation -*-" >> "$at_group_log" |
— | — | @@ -2999,9 +3000,9 @@ |
3000 | 3001 | _ATEOF |
3001 | 3002 | |
3002 | 3003 | { set +x |
3003 | | -$as_echo "$at_srcdir/testsuite.at:206: testtext \${srcdir}/hr/hr1.in > tempoutput && diff \${srcdir}/hr/hr1.out tempoutput" |
| 3004 | +$as_echo "$at_srcdir/testsuite.at:206: testtext \${srcdir}/list/list4.in > tempoutput && diff \${srcdir}/list/list4.out tempoutput" |
3004 | 3005 | at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:206" |
3005 | | -( $at_check_trace; testtext ${srcdir}/hr/hr1.in > tempoutput && diff ${srcdir}/hr/hr1.out tempoutput |
| 3006 | +( $at_check_trace; testtext ${srcdir}/list/list4.in > tempoutput && diff ${srcdir}/list/list4.out tempoutput |
3006 | 3007 | ) >>"$at_stdout" 2>>"$at_stderr" |
3007 | 3008 | at_status=$? at_failed=false |
3008 | 3009 | $at_check_filter |
— | — | @@ -3018,11 +3019,11 @@ |
3019 | 3020 | read at_status <"$at_status_file" |
3020 | 3021 | #AT_STOP_29 |
3021 | 3022 | #AT_START_30 |
3022 | | -# 30. testsuite.at:210: link1 |
| 3023 | +# 30. testsuite.at:210: hr |
3023 | 3024 | at_setup_line='testsuite.at:210' |
3024 | 3025 | at_fn_banner 1 |
3025 | | -at_desc="link1" |
3026 | | -at_desc_line=" 30: $at_desc " |
| 3026 | +at_desc="hr" |
| 3027 | +at_desc_line=" 30: $at_desc " |
3027 | 3028 | $at_quiet $as_echo_n "$at_desc_line" |
3028 | 3029 | at_xfail=no |
3029 | 3030 | echo "# -*- compilation -*-" >> "$at_group_log" |
— | — | @@ -3035,9 +3036,9 @@ |
3036 | 3037 | _ATEOF |
3037 | 3038 | |
3038 | 3039 | { set +x |
3039 | | -$as_echo "$at_srcdir/testsuite.at:213: testtext \${srcdir}/link/link1.in > tempoutput && diff \${srcdir}/link/link1.out tempoutput" |
| 3040 | +$as_echo "$at_srcdir/testsuite.at:213: testtext \${srcdir}/hr/hr1.in > tempoutput && diff \${srcdir}/hr/hr1.out tempoutput" |
3040 | 3041 | at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:213" |
3041 | | -( $at_check_trace; testtext ${srcdir}/link/link1.in > tempoutput && diff ${srcdir}/link/link1.out tempoutput |
| 3042 | +( $at_check_trace; testtext ${srcdir}/hr/hr1.in > tempoutput && diff ${srcdir}/hr/hr1.out tempoutput |
3042 | 3043 | ) >>"$at_stdout" 2>>"$at_stderr" |
3043 | 3044 | at_status=$? at_failed=false |
3044 | 3045 | $at_check_filter |
— | — | @@ -3054,16 +3055,16 @@ |
3055 | 3056 | read at_status <"$at_status_file" |
3056 | 3057 | #AT_STOP_30 |
3057 | 3058 | #AT_START_31 |
3058 | | -# 31. testsuite.at:218: link2 |
3059 | | -at_setup_line='testsuite.at:218' |
| 3059 | +# 31. testsuite.at:217: link1 |
| 3060 | +at_setup_line='testsuite.at:217' |
3060 | 3061 | at_fn_banner 1 |
3061 | | -at_desc="link2" |
| 3062 | +at_desc="link1" |
3062 | 3063 | at_desc_line=" 31: $at_desc " |
3063 | 3064 | $at_quiet $as_echo_n "$at_desc_line" |
3064 | 3065 | at_xfail=no |
3065 | 3066 | echo "# -*- compilation -*-" >> "$at_group_log" |
3066 | 3067 | ( |
3067 | | - $as_echo "31. testsuite.at:218: testing ..." |
| 3068 | + $as_echo "31. testsuite.at:217: testing ..." |
3068 | 3069 | $at_traceon |
3069 | 3070 | |
3070 | 3071 | |
— | — | @@ -3071,15 +3072,15 @@ |
3072 | 3073 | _ATEOF |
3073 | 3074 | |
3074 | 3075 | { set +x |
3075 | | -$as_echo "$at_srcdir/testsuite.at:221: testtext \${srcdir}/link/link2.in > tempoutput && diff \${srcdir}/link/link2.out tempoutput" |
3076 | | -at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:221" |
3077 | | -( $at_check_trace; testtext ${srcdir}/link/link2.in > tempoutput && diff ${srcdir}/link/link2.out tempoutput |
| 3076 | +$as_echo "$at_srcdir/testsuite.at:220: testtext \${srcdir}/link/link1.in > tempoutput && diff \${srcdir}/link/link1.out tempoutput" |
| 3077 | +at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:220" |
| 3078 | +( $at_check_trace; testtext ${srcdir}/link/link1.in > tempoutput && diff ${srcdir}/link/link1.out tempoutput |
3078 | 3079 | ) >>"$at_stdout" 2>>"$at_stderr" |
3079 | 3080 | at_status=$? at_failed=false |
3080 | 3081 | $at_check_filter |
3081 | 3082 | at_fn_diff_devnull "$at_stderr" || at_failed=: |
3082 | 3083 | at_fn_diff_devnull "$at_stdout" || at_failed=: |
3083 | | -at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:221" |
| 3084 | +at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:220" |
3084 | 3085 | $at_failed && at_fn_log_failure |
3085 | 3086 | $at_traceon; } |
3086 | 3087 | |
— | — | @@ -3090,10 +3091,10 @@ |
3091 | 3092 | read at_status <"$at_status_file" |
3092 | 3093 | #AT_STOP_31 |
3093 | 3094 | #AT_START_32 |
3094 | | -# 32. testsuite.at:225: link3 |
| 3095 | +# 32. testsuite.at:225: link2 |
3095 | 3096 | at_setup_line='testsuite.at:225' |
3096 | 3097 | at_fn_banner 1 |
3097 | | -at_desc="link3" |
| 3098 | +at_desc="link2" |
3098 | 3099 | at_desc_line=" 32: $at_desc " |
3099 | 3100 | $at_quiet $as_echo_n "$at_desc_line" |
3100 | 3101 | at_xfail=no |
— | — | @@ -3107,9 +3108,9 @@ |
3108 | 3109 | _ATEOF |
3109 | 3110 | |
3110 | 3111 | { set +x |
3111 | | -$as_echo "$at_srcdir/testsuite.at:228: testtext \${srcdir}/link/link3.in > tempoutput && diff \${srcdir}/link/link3.out tempoutput" |
| 3112 | +$as_echo "$at_srcdir/testsuite.at:228: testtext \${srcdir}/link/link2.in > tempoutput && diff \${srcdir}/link/link2.out tempoutput" |
3112 | 3113 | at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:228" |
3113 | | -( $at_check_trace; testtext ${srcdir}/link/link3.in > tempoutput && diff ${srcdir}/link/link3.out tempoutput |
| 3114 | +( $at_check_trace; testtext ${srcdir}/link/link2.in > tempoutput && diff ${srcdir}/link/link2.out tempoutput |
3114 | 3115 | ) >>"$at_stdout" 2>>"$at_stderr" |
3115 | 3116 | at_status=$? at_failed=false |
3116 | 3117 | $at_check_filter |
— | — | @@ -3126,10 +3127,10 @@ |
3127 | 3128 | read at_status <"$at_status_file" |
3128 | 3129 | #AT_STOP_32 |
3129 | 3130 | #AT_START_33 |
3130 | | -# 33. testsuite.at:232: link4 |
| 3131 | +# 33. testsuite.at:232: link3 |
3131 | 3132 | at_setup_line='testsuite.at:232' |
3132 | 3133 | at_fn_banner 1 |
3133 | | -at_desc="link4" |
| 3134 | +at_desc="link3" |
3134 | 3135 | at_desc_line=" 33: $at_desc " |
3135 | 3136 | $at_quiet $as_echo_n "$at_desc_line" |
3136 | 3137 | at_xfail=no |
— | — | @@ -3143,9 +3144,9 @@ |
3144 | 3145 | _ATEOF |
3145 | 3146 | |
3146 | 3147 | { set +x |
3147 | | -$as_echo "$at_srcdir/testsuite.at:235: testtext \${srcdir}/link/link4.in > tempoutput && diff \${srcdir}/link/link4.out tempoutput" |
| 3148 | +$as_echo "$at_srcdir/testsuite.at:235: testtext \${srcdir}/link/link3.in > tempoutput && diff \${srcdir}/link/link3.out tempoutput" |
3148 | 3149 | at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:235" |
3149 | | -( $at_check_trace; testtext ${srcdir}/link/link4.in > tempoutput && diff ${srcdir}/link/link4.out tempoutput |
| 3150 | +( $at_check_trace; testtext ${srcdir}/link/link3.in > tempoutput && diff ${srcdir}/link/link3.out tempoutput |
3150 | 3151 | ) >>"$at_stdout" 2>>"$at_stderr" |
3151 | 3152 | at_status=$? at_failed=false |
3152 | 3153 | $at_check_filter |
— | — | @@ -3162,10 +3163,10 @@ |
3163 | 3164 | read at_status <"$at_status_file" |
3164 | 3165 | #AT_STOP_33 |
3165 | 3166 | #AT_START_34 |
3166 | | -# 34. testsuite.at:239: link5 |
| 3167 | +# 34. testsuite.at:239: link4 |
3167 | 3168 | at_setup_line='testsuite.at:239' |
3168 | 3169 | at_fn_banner 1 |
3169 | | -at_desc="link5" |
| 3170 | +at_desc="link4" |
3170 | 3171 | at_desc_line=" 34: $at_desc " |
3171 | 3172 | $at_quiet $as_echo_n "$at_desc_line" |
3172 | 3173 | at_xfail=no |
— | — | @@ -3179,9 +3180,9 @@ |
3180 | 3181 | _ATEOF |
3181 | 3182 | |
3182 | 3183 | { set +x |
3183 | | -$as_echo "$at_srcdir/testsuite.at:242: testtext \${srcdir}/link/link5.in > tempoutput && diff \${srcdir}/link/link5.out tempoutput" |
| 3184 | +$as_echo "$at_srcdir/testsuite.at:242: testtext \${srcdir}/link/link4.in > tempoutput && diff \${srcdir}/link/link4.out tempoutput" |
3184 | 3185 | at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:242" |
3185 | | -( $at_check_trace; testtext ${srcdir}/link/link5.in > tempoutput && diff ${srcdir}/link/link5.out tempoutput |
| 3186 | +( $at_check_trace; testtext ${srcdir}/link/link4.in > tempoutput && diff ${srcdir}/link/link4.out tempoutput |
3186 | 3187 | ) >>"$at_stdout" 2>>"$at_stderr" |
3187 | 3188 | at_status=$? at_failed=false |
3188 | 3189 | $at_check_filter |
— | — | @@ -3197,3 +3198,39 @@ |
3198 | 3199 | ) 5>&1 2>&1 | eval $at_tee_pipe |
3199 | 3200 | read at_status <"$at_status_file" |
3200 | 3201 | #AT_STOP_34 |
| 3202 | +#AT_START_35 |
| 3203 | +# 35. testsuite.at:246: link5 |
| 3204 | +at_setup_line='testsuite.at:246' |
| 3205 | +at_fn_banner 1 |
| 3206 | +at_desc="link5" |
| 3207 | +at_desc_line=" 35: $at_desc " |
| 3208 | +$at_quiet $as_echo_n "$at_desc_line" |
| 3209 | +at_xfail=no |
| 3210 | +echo "# -*- compilation -*-" >> "$at_group_log" |
| 3211 | +( |
| 3212 | + $as_echo "35. testsuite.at:246: testing ..." |
| 3213 | + $at_traceon |
| 3214 | + |
| 3215 | + |
| 3216 | +cat >tempoutput <<'_ATEOF' |
| 3217 | +_ATEOF |
| 3218 | + |
| 3219 | +{ set +x |
| 3220 | +$as_echo "$at_srcdir/testsuite.at:249: testtext \${srcdir}/link/link5.in > tempoutput && diff \${srcdir}/link/link5.out tempoutput" |
| 3221 | +at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:249" |
| 3222 | +( $at_check_trace; testtext ${srcdir}/link/link5.in > tempoutput && diff ${srcdir}/link/link5.out tempoutput |
| 3223 | +) >>"$at_stdout" 2>>"$at_stderr" |
| 3224 | +at_status=$? at_failed=false |
| 3225 | +$at_check_filter |
| 3226 | +at_fn_diff_devnull "$at_stderr" || at_failed=: |
| 3227 | +at_fn_diff_devnull "$at_stdout" || at_failed=: |
| 3228 | +at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:249" |
| 3229 | +$at_failed && at_fn_log_failure |
| 3230 | +$at_traceon; } |
| 3231 | + |
| 3232 | + |
| 3233 | + set +x |
| 3234 | + $at_times_p && times >"$at_times_file" |
| 3235 | +) 5>&1 2>&1 | eval $at_tee_pipe |
| 3236 | +read at_status <"$at_status_file" |
| 3237 | +#AT_STOP_35 |
Index: trunk/parsers/libmwparser/tests/testsuite.at |
— | — | @@ -200,6 +200,13 @@ |
201 | 201 | |
202 | 202 | AT_CLEANUP |
203 | 203 | |
| 204 | +AT_SETUP([list4]) |
| 205 | + |
| 206 | +AT_DATA([tempoutput], []) |
| 207 | +AT_CHECK([testtext ${srcdir}/list/list4.in > tempoutput && diff ${srcdir}/list/list4.out tempoutput]) |
| 208 | + |
| 209 | +AT_CLEANUP |
| 210 | + |
204 | 211 | AT_SETUP([hr]) |
205 | 212 | |
206 | 213 | AT_DATA([tempoutput], []) |
Index: trunk/parsers/libmwparser/tests/list/list1.out |
— | — | @@ -12,6 +12,8 @@ |
13 | 13 | WORD[item] |
14 | 14 | END BULLET LIST ITEM |
15 | 15 | END BULLET LIST |
| 16 | + END BULLET LIST ITEM |
| 17 | + BEGIN BULLET LIST ITEM |
16 | 18 | WORD[bar] |
17 | 19 | BEGIN ENUMERATION LIST |
18 | 20 | BEGIN ENUMERATION LIST ITEM |
Index: trunk/parsers/libmwparser/tests/list/list4.in |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +* list |
| 3 | +*# subitem |
| 4 | +*# subitem |
| 5 | +* list continuation |
Index: trunk/parsers/libmwparser/tests/list/list4.out |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +BEGIN ARTICLE |
| 3 | + BEGIN BULLET LIST |
| 4 | + BEGIN BULLET LIST ITEM |
| 5 | + WORD[list] |
| 6 | + BEGIN ENUMERATION LIST |
| 7 | + BEGIN ENUMERATION LIST ITEM |
| 8 | + WORD[subitem] |
| 9 | + END ENUMERATION LIST ITEM |
| 10 | + BEGIN ENUMERATION LIST ITEM |
| 11 | + WORD[subitem] |
| 12 | + END ENUMERATION LIST ITEM |
| 13 | + END ENUMERATION LIST |
| 14 | + END BULLET LIST ITEM |
| 15 | + BEGIN BULLET LIST ITEM |
| 16 | + WORD[list] |
| 17 | + SPACE[ ] |
| 18 | + WORD[continuation] |
| 19 | + END BULLET LIST ITEM |
| 20 | + END BULLET LIST |
| 21 | +END ARTICLE |