/[suikacvs]/markup/html/whatpm/Whatpm/mkhtmlparser.pl
Suika

Contents of /markup/html/whatpm/Whatpm/mkhtmlparser.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed May 2 13:44:35 2007 UTC (17 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +6 -6 lines
File MIME type: text/plain
++ ChangeLog	2 May 2007 13:37:34 -0000
2007-05-02  Wakaba  <wakaba@suika.fam.cx>

	* readme.en.html: TODO section is added.

++ whatpm/t/ChangeLog	2 May 2007 13:44:02 -0000
2007-05-02  Wakaba  <wakaba@suika.fam.cx>

	* .cvsignore: Result files are added.

	* HTML-tree.t: Support for document fragment tests.

	* Makefile: Generate test result files.

	* tokenizer-test-1.test: A new test to ensure that
	characters after end tag are preserved in RCDATA or CDATA
	case.

++ whatpm/Whatpm/ChangeLog	2 May 2007 13:42:17 -0000
2007-05-02  Wakaba  <wakaba@suika.fam.cx>

	* NanoDOM.pm (DOMImplementation): New class.
	(append_child): Weaken the |parent_node| reference.
	(create_element_ns, Element new): Set the |owner_document|
	reference.
	(implementation): New attribute.
	(owner_document, local_name, namespace_uri): New attributes.

	* HTML.pm.src (parse_string): Line and column numbers
	are now provided to error handler.
	(!!!parse-error): Short descriptions are added.
	(_construct_tree): Split into three methods; support
	for innerHTML mode.
	(set_inner_html): New method.

1 #!/usr/bin/perl
2 use strict;
3
4 while (<>) {
5 s/!!!emit\b/return /;
6 s{!!!next-input-character;}{q{
7 if (@{$self->{char}}) {
8 $self->{next_input_character} = shift @{$self->{char}};
9 } else {
10 $self->{set_next_input_character}->($self);
11 }
12 }}ge;
13 s{!!!back-next-input-character\b}{q{unshift @{$self->{char}}, }}ge;
14 s{!!!parse-error;}{q{$self->{parse_error}->();}}ge;
15 s{!!!parse-error\b}{q{$self->{parse_error}->}}ge;
16 s{!!!insert-element-t\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{
17 {
18 my \$el;
19 !!!create-element (\$el, $1, $2);
20 \$insert->(\$el);
21 push \@{\$self->{open_elements}}, [\$el, $1];
22 }
23 }}ge;
24 s{!!!insert-element-t\s*\(([^(),]+)\)\s*;}{qq{
25 {
26 my \$el;
27 !!!create-element (\$el, $1);
28 \$insert->(\$el);
29 push \@{\$self->{open_elements}}, [\$el, $1];
30 }
31 }}ge;
32 s{!!!insert-element\s*\(([^(),]+),([^(),]+)\)\s*;}{qq{
33 {
34 my \$el;
35 !!!create-element (\$el, $1, $2);
36 \$self->{open_elements}->[-1]->[0]->append_child (\$el);
37 push \@{\$self->{open_elements}}, [\$el, $1];
38 }
39 }}ge;
40 s{!!!insert-element\s*\(([^(),]+)\)\s*;}{qq{
41 {
42 my \$el;
43 !!!create-element (\$el, $1);
44 \$self->{open_elements}->[-1]->[0]->append_child (\$el);
45 push \@{\$self->{open_elements}}, [\$el, $1];
46 }
47 }}ge;
48 s{!!!create-element\s*\(([^(),]+),([^(),]+)(?:,([^(),]+))?\)\s*;}{
49 my $r = qq{
50 $1 = \$self->{document}->create_element_ns
51 (q<http://www.w3.org/1999/xhtml>, [undef, $2]);
52 };
53 if (defined $3) {
54 $r .= qq{
55 for my \$attr_name (keys %{$3}) {
56 $1->set_attribute_ns (undef, [undef, \$attr_name],
57 $3 ->{\$attr_name}->{value});
58 }
59 };
60 }
61 $r;
62 }ge; # MUST
63 s{!!!next-token;}{q{$token = $self->_get_next_token;}}ge;
64 s{!!!back-token;}{q{unshift @{$self->{token}}, $token;}}ge;
65 s{!!!back-token\s*\(}{q{unshift @{$self->{token}}, (}}ge;
66 print;
67 }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24