]>
Commit | Line | Data |
---|---|---|
078ce556 SS |
1 | diff --git a/SAX/PurePerl.pm b/SAX/PurePerl.pm |
2 | --- a/SAX/PurePerl.pm 2006-04-24 01:20:09.000000000 +0200 | |
3 | +++ b/SAX/PurePerl.pm 2012-08-09 12:47:48.736728516 +0200 | |
4 | @@ -595,22 +595,23 @@ sub Comment { | |
5 | ||
6 | my $data = $reader->data(4); | |
7 | if ($data =~ /^<!--/) { | |
8 | - $reader->move_along(4); | |
9 | + $reader->move_along(4); # skip comment start | |
10 | + $data = $reader->data; | |
11 | + while ($data !~ m!-->!) { | |
12 | + my $n = $reader->read_more; | |
13 | + $self->parser_error("End of data seen while looking for close comment marker", $reader) | |
14 | + unless $n; | |
15 | + $data = $reader->data; | |
16 | + } | |
17 | + | |
18 | my $comment_str = ''; | |
19 | - while (1) { | |
20 | - my $data = $reader->data; | |
21 | - $self->parser_error("End of data seen while looking for close comment marker", $reader) | |
22 | - unless length($data); | |
23 | - if ($data =~ /^(.*?)-->/s) { | |
24 | - $comment_str .= $1; | |
25 | - $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/; | |
26 | - $reader->move_along(length($1) + 3); | |
27 | - last; | |
28 | - } | |
29 | - else { | |
30 | - $comment_str .= $data; | |
31 | - $reader->move_along(length($data)); | |
32 | - } | |
33 | + if ($data =~ /^(.*?)-->/s) { | |
34 | + $comment_str = $1; | |
35 | + $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/; | |
36 | + $reader->move_along(length($1) + 3); | |
37 | + } | |
38 | + else { | |
39 | + return 0; | |
40 | } | |
41 | ||
42 | $self->comment({ Data => $comment_str }); |