/[suikacvs]/markup/html/whatpm/Whatpm/HTML.pm.src
Suika

Diff of /markup/html/whatpm/Whatpm/HTML.pm.src

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by wakaba, Sun Jun 24 14:24:21 2007 UTC revision 1.28 by wakaba, Mon Jun 25 00:14:40 2007 UTC
# Line 418  sub _get_next_token ($) { Line 418  sub _get_next_token ($) {
418          redo A;          redo A;
419        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
420          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
421              $self->{current_token}->{first_start_tag}
422                  = not defined $self->{last_emitted_start_tag_name};
423            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
424          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
425            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 443  sub _get_next_token ($) { Line 445  sub _get_next_token ($) {
445        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
446          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
447          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
448              $self->{current_token}->{first_start_tag}
449                  = not defined $self->{last_emitted_start_tag_name};
450            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
451          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
452            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 489  sub _get_next_token ($) { Line 493  sub _get_next_token ($) {
493          redo A;          redo A;
494        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
495          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
496              $self->{current_token}->{first_start_tag}
497                  = not defined $self->{last_emitted_start_tag_name};
498            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
499          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
500            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 527  sub _get_next_token ($) { Line 533  sub _get_next_token ($) {
533        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
534          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
535          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
536              $self->{current_token}->{first_start_tag}
537                  = not defined $self->{last_emitted_start_tag_name};
538            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
539          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
540            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 578  sub _get_next_token ($) { Line 586  sub _get_next_token ($) {
586        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
587          $before_leave->();          $before_leave->();
588          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
589              $self->{current_token}->{first_start_tag}
590                  = not defined $self->{last_emitted_start_tag_name};
591            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
592          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
593            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 617  sub _get_next_token ($) { Line 627  sub _get_next_token ($) {
627          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
628          $before_leave->();          $before_leave->();
629          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
630              $self->{current_token}->{first_start_tag}
631                  = not defined $self->{last_emitted_start_tag_name};
632            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
633          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
634            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 653  sub _get_next_token ($) { Line 665  sub _get_next_token ($) {
665          redo A;          redo A;
666        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
667          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
668              $self->{current_token}->{first_start_tag}
669                  = not defined $self->{last_emitted_start_tag_name};
670            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
671          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
672            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 691  sub _get_next_token ($) { Line 705  sub _get_next_token ($) {
705        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
706          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
707          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
708              $self->{current_token}->{first_start_tag}
709                  = not defined $self->{last_emitted_start_tag_name};
710            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
711          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
712            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 736  sub _get_next_token ($) { Line 752  sub _get_next_token ($) {
752          redo A;          redo A;
753        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
754          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
755              $self->{current_token}->{first_start_tag}
756                  = not defined $self->{last_emitted_start_tag_name};
757            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
758          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
759            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 754  sub _get_next_token ($) { Line 772  sub _get_next_token ($) {
772        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
773          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
774          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
775              $self->{current_token}->{first_start_tag}
776                  = not defined $self->{last_emitted_start_tag_name};
777            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
778          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
779            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 788  sub _get_next_token ($) { Line 808  sub _get_next_token ($) {
808        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
809          !!!parse-error (type => 'unclosed attribute value');          !!!parse-error (type => 'unclosed attribute value');
810          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
811              $self->{current_token}->{first_start_tag}
812                  = not defined $self->{last_emitted_start_tag_name};
813            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
814          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
815            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 822  sub _get_next_token ($) { Line 844  sub _get_next_token ($) {
844        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
845          !!!parse-error (type => 'unclosed attribute value');          !!!parse-error (type => 'unclosed attribute value');
846          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
847              $self->{current_token}->{first_start_tag}
848                  = not defined $self->{last_emitted_start_tag_name};
849            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
850          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
851            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 859  sub _get_next_token ($) { Line 883  sub _get_next_token ($) {
883          redo A;          redo A;
884        } elsif ($self->{next_input_character} == 0x003E) { # >        } elsif ($self->{next_input_character} == 0x003E) { # >
885          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
886              $self->{current_token}->{first_start_tag}
887                  = not defined $self->{last_emitted_start_tag_name};
888            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
889          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
890            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 877  sub _get_next_token ($) { Line 903  sub _get_next_token ($) {
903        } elsif ($self->{next_input_character} == -1) {        } elsif ($self->{next_input_character} == -1) {
904          !!!parse-error (type => 'unclosed tag');          !!!parse-error (type => 'unclosed tag');
905          if ($self->{current_token}->{type} eq 'start tag') {          if ($self->{current_token}->{type} eq 'start tag') {
906              $self->{current_token}->{first_start_tag}
907                  = not defined $self->{last_emitted_start_tag_name};
908            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};            $self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name};
909          } elsif ($self->{current_token}->{type} eq 'end tag') {          } elsif ($self->{current_token}->{type} eq 'end tag') {
910            $self->{content_model_flag} = 'PCDATA'; # MUST            $self->{content_model_flag} = 'PCDATA'; # MUST
# Line 2569  sub _tree_construction_main ($) { Line 2597  sub _tree_construction_main ($) {
2597              if ($i != -1) {              if ($i != -1) {
2598                !!!parse-error (type => 'end tag missing:'.                !!!parse-error (type => 'end tag missing:'.
2599                                $self->{open_elements}->[-1]->[1]);                                $self->{open_elements}->[-1]->[1]);
               ## TODO: test  
2600              }              }
2601              splice @{$self->{open_elements}}, $i;              splice @{$self->{open_elements}}, $i;
2602              last LI;              last LI;
# Line 2617  sub _tree_construction_main ($) { Line 2644  sub _tree_construction_main ($) {
2644              if ($i != -1) {              if ($i != -1) {
2645                !!!parse-error (type => 'end tag missing:'.                !!!parse-error (type => 'end tag missing:'.
2646                                $self->{open_elements}->[-1]->[1]);                                $self->{open_elements}->[-1]->[1]);
               ## TODO: test  
2647              }              }
2648              splice @{$self->{open_elements}}, $i;              splice @{$self->{open_elements}}, $i;
2649              last LI;              last LI;
# Line 3241  sub _tree_construction_main ($) { Line 3267  sub _tree_construction_main ($) {
3267          redo B;          redo B;
3268        } elsif ($token->{type} eq 'start tag' and        } elsif ($token->{type} eq 'start tag' and
3269                 $token->{tag_name} eq 'html') {                 $token->{tag_name} eq 'html') {
3270          ## TODO: unless it is the first start tag token, parse-error  ## ISSUE: "aa<html>" is not a parse error.
3271    ## ISSUE: "<html>" in fragment is not a parse error.
3272            unless ($token->{first_start_tag}) {
3273              !!!parse-error (type => 'not first start tag');
3274            }
3275          my $top_el = $self->{open_elements}->[0]->[0];          my $top_el = $self->{open_elements}->[0]->[0];
3276          for my $attr_name (keys %{$token->{attributes}}) {          for my $attr_name (keys %{$token->{attributes}}) {
3277            unless ($top_el->has_attribute_ns (undef, $attr_name)) {            unless ($top_el->has_attribute_ns (undef, $attr_name)) {

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24