| 1 |
wakaba |
1.1 |
#!/usr/bin/perl |
| 2 |
|
|
use strict; |
| 3 |
|
|
|
| 4 |
|
|
my $consume_entity_file_name = 'HTML-consume-entity.src'; |
| 5 |
|
|
|
| 6 |
|
|
while (<>) { |
| 7 |
|
|
s/!!!emit\b/return /; |
| 8 |
|
|
s{!!!consume-entity\}}{ |
| 9 |
|
|
open my $consume_entity_file, '<', $consume_entity_file_name |
| 10 |
|
|
or die "$0: $consume_entity_file_name: $!"; |
| 11 |
|
|
my $r = ''; |
| 12 |
|
|
while (defined (my $l = <$consume_entity_file>)) { |
| 13 |
|
|
$r .= $l unless $l =~ /<javascript:/; |
| 14 |
|
|
} |
| 15 |
|
|
$r; |
| 16 |
|
|
}e; |
| 17 |
|
|
s{!!!next-input-character;}{q{ |
| 18 |
|
|
if (@{$self->{char}}) { |
| 19 |
|
|
$self->{next_input_character} = shift @{$self->{char}}; |
| 20 |
|
|
} else { |
| 21 |
|
|
$self->{set_next_input_character}->($self); |
| 22 |
|
|
} |
| 23 |
|
|
}}ge; |
| 24 |
|
|
s{!!!back-next-input-character\b}{q{unshift @{$self->{char}}, }}ge; |
| 25 |
|
|
s{!!!parse-error;}{q{$self->{parse_error}->();}}ge; |
| 26 |
|
|
s{!!!parse-error\b}{q{$self->{parse_error}->}}ge; |
| 27 |
|
|
print; |
| 28 |
|
|
} |