seems to be failing line count.
You're right. Because the regex can match a block of html and a block of asp in one go, in between $line already needs to be updated. So I removed the extra set of parens and the counter line again and added two new \n-counters: one for $1 and one for $2.
my @parsed;
my $line = 1;
while ($asp =~ /\G((?: [^<]+ | <(?!%) )*) (?: <%(.*?)%> | ((?=<%)) )?/
+gsx) {
$1 and push @parsed, [ $line, html => $1 ];
$line += $1 =~ tr/\n//;
$2 and push @parsed, [ $line, asp => $1 ];
$line += $2 =~ tr/\n//;
defined $3 and die "Unclosed ASP code block starting on line $line
+ near '",
$asp =~ /\G(<%\s*\n?.*)/g, "'.\n";
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|