/[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.41 by wakaba, Sat Jul 21 06:04:07 2007 UTC revision 1.44 by wakaba, Sat Jul 21 07:34:32 2007 UTC
# Line 3046  sub _tree_construction_main ($) { Line 3046  sub _tree_construction_main ($) {
3046                  noframes => 1,                  noframes => 1,
3047                  noscript => 0, ## TODO: 1 if scripting is enabled                  noscript => 0, ## TODO: 1 if scripting is enabled
3048                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
3049            ## NOTE: There are two "as if in body" code clones.
3050          $parse_rcdata->(CDATA_CONTENT_MODEL, $insert);          $parse_rcdata->(CDATA_CONTENT_MODEL, $insert);
3051          return;          return;
3052        } elsif ($token->{tag_name} eq 'select') {        } elsif ($token->{tag_name} eq 'select') {
# Line 3646  sub _tree_construction_main ($) { Line 3647  sub _tree_construction_main ($) {
3647            redo B;            redo B;
3648    
3649            ## ISSUE: An issue in the spec.            ## ISSUE: An issue in the spec.
3650          } elsif ($self->{insertion_mode} eq 'in body') {          } elsif ($self->{insertion_mode} eq 'in body' or
3651                     $self->{insertion_mode} eq 'in cell' or
3652                     $self->{insertion_mode} eq 'in caption') {
3653            if ($token->{type} eq 'character') {            if ($token->{type} eq 'character') {
3654              ## NOTE: There is a code clone of "character in body".              ## NOTE: There is a code clone of "character in body".
3655              $reconstruct_active_formatting_elements->($insert_to_current);              $reconstruct_active_formatting_elements->($insert_to_current);
# Line 3655  sub _tree_construction_main ($) { Line 3658  sub _tree_construction_main ($) {
3658    
3659              !!!next-token;              !!!next-token;
3660              redo B;              redo B;
3661              } elsif ($token->{type} eq 'start tag') {
3662                if ({
3663                     caption => 1, col => 1, colgroup => 1, tbody => 1,
3664                     td => 1, tfoot => 1, th => 1, thead => 1, tr => 1,
3665                    }->{$token->{tag_name}}) {
3666                  if ($self->{insertion_mode} eq 'in cell') {
3667                    ## have an element in table scope
3668                    my $tn;
3669                    INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3670                      my $node = $self->{open_elements}->[$_];
3671                      if ($node->[1] eq 'td' or $node->[1] eq 'th') {
3672                        $tn = $node->[1];
3673                        last INSCOPE;
3674                      } elsif ({
3675                                table => 1, html => 1,
3676                               }->{$node->[1]}) {
3677                        last INSCOPE;
3678                      }
3679                    } # INSCOPE
3680                      unless (defined $tn) {
3681                        !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3682                        ## Ignore the token
3683                        !!!next-token;
3684                        redo B;
3685                      }
3686                    
3687                    ## Close the cell
3688                    !!!back-token; # <?>
3689                    $token = {type => 'end tag', tag_name => $tn};
3690                    redo B;
3691                  } elsif ($self->{insertion_mode} eq 'in caption') {
3692                    !!!parse-error (type => 'not closed:caption');
3693                    
3694                    ## As if </caption>
3695                    ## have a table element in table scope
3696                    my $i;
3697                    INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3698                      my $node = $self->{open_elements}->[$_];
3699                      if ($node->[1] eq 'caption') {
3700                        $i = $_;
3701                        last INSCOPE;
3702                      } elsif ({
3703                                table => 1, html => 1,
3704                               }->{$node->[1]}) {
3705                        last INSCOPE;
3706                      }
3707                    } # INSCOPE
3708                      unless (defined $i) {
3709                        !!!parse-error (type => 'unmatched end tag:caption');
3710                        ## Ignore the token
3711                        !!!next-token;
3712                        redo B;
3713                      }
3714                    
3715                    ## generate implied end tags
3716                    if ({
3717                         dd => 1, dt => 1, li => 1, p => 1,
3718                         td => 1, th => 1, tr => 1,
3719                         tbody => 1, tfoot=> 1, thead => 1,
3720                        }->{$self->{open_elements}->[-1]->[1]}) {
3721                      !!!back-token; # <?>
3722                      $token = {type => 'end tag', tag_name => 'caption'};
3723                      !!!back-token;
3724                      $token = {type => 'end tag',
3725                                tag_name => $self->{open_elements}->[-1]->[1]}; # MUST
3726                      redo B;
3727                    }
3728    
3729                    if ($self->{open_elements}->[-1]->[1] ne 'caption') {
3730                      !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);
3731                    }
3732                    
3733                    splice @{$self->{open_elements}}, $i;
3734                    
3735                    $clear_up_to_marker->();
3736                    
3737                    $self->{insertion_mode} = 'in table';
3738                    
3739                    ## reprocess
3740                    redo B;
3741                  } else {
3742                    #
3743                  }
3744                } else {
3745                  #
3746                }
3747              } elsif ($token->{type} eq 'end tag') {
3748                if ($token->{tag_name} eq 'td' or $token->{tag_name} eq 'th') {
3749                  if ($self->{insertion_mode} eq 'in cell') {
3750                    ## have an element in table scope
3751                    my $i;
3752                    INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3753                      my $node = $self->{open_elements}->[$_];
3754                      if ($node->[1] eq $token->{tag_name}) {
3755                        $i = $_;
3756                        last INSCOPE;
3757                      } elsif ({
3758                                table => 1, html => 1,
3759                               }->{$node->[1]}) {
3760                        last INSCOPE;
3761                      }
3762                    } # INSCOPE
3763                      unless (defined $i) {
3764                        !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3765                        ## Ignore the token
3766                        !!!next-token;
3767                        redo B;
3768                      }
3769                    
3770                    ## generate implied end tags
3771                    if ({
3772                         dd => 1, dt => 1, li => 1, p => 1,
3773                         td => ($token->{tag_name} eq 'th'),
3774                         th => ($token->{tag_name} eq 'td'),
3775                         tr => 1,
3776                         tbody => 1, tfoot=> 1, thead => 1,
3777                        }->{$self->{open_elements}->[-1]->[1]}) {
3778                      !!!back-token;
3779                      $token = {type => 'end tag',
3780                                tag_name => $self->{open_elements}->[-1]->[1]}; # MUST
3781                      redo B;
3782                    }
3783                    
3784                    if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) {
3785                      !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);
3786                    }
3787                    
3788                    splice @{$self->{open_elements}}, $i;
3789                    
3790                    $clear_up_to_marker->();
3791                    
3792                    $self->{insertion_mode} = 'in row';
3793                    
3794                    !!!next-token;
3795                    redo B;
3796                  } elsif ($self->{insertion_mode} eq 'in caption') {
3797                    !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3798                    ## Ignore the token
3799                    !!!next-token;
3800                    redo B;
3801                  } else {
3802                    #
3803                  }
3804                } elsif ($token->{tag_name} eq 'caption') {
3805                  if ($self->{insertion_mode} eq 'in caption') {
3806                    ## have a table element in table scope
3807                    my $i;
3808                    INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3809                      my $node = $self->{open_elements}->[$_];
3810                      if ($node->[1] eq $token->{tag_name}) {
3811                        $i = $_;
3812                        last INSCOPE;
3813                      } elsif ({
3814                                table => 1, html => 1,
3815                               }->{$node->[1]}) {
3816                        last INSCOPE;
3817                      }
3818                    } # INSCOPE
3819                      unless (defined $i) {
3820                        !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3821                        ## Ignore the token
3822                        !!!next-token;
3823                        redo B;
3824                      }
3825                    
3826                    ## generate implied end tags
3827                    if ({
3828                         dd => 1, dt => 1, li => 1, p => 1,
3829                         td => 1, th => 1, tr => 1,
3830                         tbody => 1, tfoot=> 1, thead => 1,
3831                        }->{$self->{open_elements}->[-1]->[1]}) {
3832                      !!!back-token;
3833                      $token = {type => 'end tag',
3834                                tag_name => $self->{open_elements}->[-1]->[1]}; # MUST
3835                      redo B;
3836                    }
3837                    
3838                    if ($self->{open_elements}->[-1]->[1] ne 'caption') {
3839                      !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);
3840                    }
3841                    
3842                    splice @{$self->{open_elements}}, $i;
3843                    
3844                    $clear_up_to_marker->();
3845                    
3846                    $self->{insertion_mode} = 'in table';
3847                    
3848                    !!!next-token;
3849                    redo B;
3850                  } elsif ($self->{insertion_mode} eq 'in cell') {
3851                    !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3852                    ## Ignore the token
3853                    !!!next-token;
3854                    redo B;
3855                  } else {
3856                    #
3857                  }
3858                } elsif ({
3859                          table => 1, tbody => 1, tfoot => 1,
3860                          thead => 1, tr => 1,
3861                         }->{$token->{tag_name}} and
3862                         $self->{insertion_mode} eq 'in cell') {
3863                  ## have an element in table scope
3864                  my $i;
3865                  my $tn;
3866                  INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3867                    my $node = $self->{open_elements}->[$_];
3868                    if ($node->[1] eq $token->{tag_name}) {
3869                      $i = $_;
3870                      last INSCOPE;
3871                    } elsif ($node->[1] eq 'td' or $node->[1] eq 'th') {
3872                      $tn = $node->[1];
3873                      ## NOTE: There is exactly one |td| or |th| element
3874                      ## in scope in the stack of open elements by definition.
3875                    } elsif ({
3876                              table => 1, html => 1,
3877                             }->{$node->[1]}) {
3878                      last INSCOPE;
3879                    }
3880                  } # INSCOPE
3881                  unless (defined $i) {
3882                    !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3883                    ## Ignore the token
3884                    !!!next-token;
3885                    redo B;
3886                  }
3887    
3888                  ## Close the cell
3889                  !!!back-token; # </?>
3890                  $token = {type => 'end tag', tag_name => $tn};
3891                  redo B;
3892                } elsif ($token->{tag_name} eq 'table' and
3893                         $self->{insertion_mode} eq 'in caption') {
3894                  !!!parse-error (type => 'not closed:caption');
3895    
3896                  ## As if </caption>
3897                  ## have a table element in table scope
3898                  my $i;
3899                  INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {
3900                    my $node = $self->{open_elements}->[$_];
3901                    if ($node->[1] eq 'caption') {
3902                      $i = $_;
3903                      last INSCOPE;
3904                    } elsif ({
3905                              table => 1, html => 1,
3906                             }->{$node->[1]}) {
3907                      last INSCOPE;
3908                    }
3909                  } # INSCOPE
3910                  unless (defined $i) {
3911                    !!!parse-error (type => 'unmatched end tag:caption');
3912                    ## Ignore the token
3913                    !!!next-token;
3914                    redo B;
3915                  }
3916                  
3917                  ## generate implied end tags
3918                  if ({
3919                       dd => 1, dt => 1, li => 1, p => 1,
3920                       td => 1, th => 1, tr => 1,
3921                       tbody => 1, tfoot=> 1, thead => 1,
3922                      }->{$self->{open_elements}->[-1]->[1]}) {
3923                    !!!back-token; # </table>
3924                    $token = {type => 'end tag', tag_name => 'caption'};
3925                    !!!back-token;
3926                    $token = {type => 'end tag',
3927                              tag_name => $self->{open_elements}->[-1]->[1]}; # MUST
3928                    redo B;
3929                  }
3930    
3931                  if ($self->{open_elements}->[-1]->[1] ne 'caption') {
3932                    !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);
3933                  }
3934    
3935                  splice @{$self->{open_elements}}, $i;
3936    
3937                  $clear_up_to_marker->();
3938    
3939                  $self->{insertion_mode} = 'in table';
3940    
3941                  ## reprocess
3942                  redo B;
3943                } elsif ({
3944                          body => 1, col => 1, colgroup => 1, html => 1,
3945                         }->{$token->{tag_name}}) {
3946                  if ($self->{insertion_mode} eq 'in cell' or
3947                      $self->{insertion_mode} eq 'in caption') {
3948                    !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3949                    ## Ignore the token
3950                    !!!next-token;
3951                    redo B;
3952                  } else {
3953                    #
3954                  }
3955                } elsif ({
3956                          tbody => 1, tfoot => 1,
3957                          thead => 1, tr => 1,
3958                         }->{$token->{tag_name}} and
3959                         $self->{insertion_mode} eq 'in caption') {
3960                  !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});
3961                  ## Ignore the token
3962                  !!!next-token;
3963                  redo B;
3964                } else {
3965                  #
3966                }
3967            } else {            } else {
3968              $in_body->($insert_to_current);              #
             redo B;  
3969            }            }
3970              
3971              $in_body->($insert_to_current);
3972              redo B;
3973          } elsif ($self->{insertion_mode} eq 'in table') {          } elsif ($self->{insertion_mode} eq 'in table') {
3974            if ($token->{type} eq 'character') {            if ($token->{type} eq 'character') {
3975              ## NOTE: There are "character in table" code clones.              ## NOTE: There are "character in table" code clones.
# Line 3875  sub _tree_construction_main ($) { Line 4186  sub _tree_construction_main ($) {
4186            !!!parse-error (type => 'in table:'.$token->{tag_name});            !!!parse-error (type => 'in table:'.$token->{tag_name});
4187            $in_body->($insert_to_foster);            $in_body->($insert_to_foster);
4188            redo B;            redo B;
         } elsif ($self->{insertion_mode} eq 'in caption') {  
           if ($token->{type} eq 'character') {  
             ## NOTE: This is a code clone of "character in body".  
             $reconstruct_active_formatting_elements->($insert_to_current);  
               
             $self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data});  
   
             !!!next-token;  
             redo B;  
           } elsif ($token->{type} eq 'start tag') {  
             if ({  
                  caption => 1, col => 1, colgroup => 1, tbody => 1,  
                  td => 1, tfoot => 1, th => 1, thead => 1, tr => 1,  
                 }->{$token->{tag_name}}) {  
               !!!parse-error (type => 'not closed:caption');  
   
               ## As if </caption>  
               ## have a table element in table scope  
               my $i;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq 'caption') {  
                   $i = $_;  
                   last INSCOPE;  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $i) {  
                 !!!parse-error (type => 'unmatched end tag:caption');  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
                 
               ## generate implied end tags  
               if ({  
                    dd => 1, dt => 1, li => 1, p => 1,  
                    td => 1, th => 1, tr => 1,  
                    tbody => 1, tfoot=> 1, thead => 1,  
                   }->{$self->{open_elements}->[-1]->[1]}) {  
                 !!!back-token; # <?>  
                 $token = {type => 'end tag', tag_name => 'caption'};  
                 !!!back-token;  
                 $token = {type => 'end tag',  
                           tag_name => $self->{open_elements}->[-1]->[1]}; # MUST  
                 redo B;  
               }  
   
               if ($self->{open_elements}->[-1]->[1] ne 'caption') {  
                 !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
               }  
   
               splice @{$self->{open_elements}}, $i;  
   
               $clear_up_to_marker->();  
   
               $self->{insertion_mode} = 'in table';  
   
               ## reprocess  
               redo B;  
             } else {  
               #  
             }  
           } elsif ($token->{type} eq 'end tag') {  
             if ($token->{tag_name} eq 'caption') {  
               ## have a table element in table scope  
               my $i;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq $token->{tag_name}) {  
                   $i = $_;  
                   last INSCOPE;  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $i) {  
                 !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
                 
               ## generate implied end tags  
               if ({  
                    dd => 1, dt => 1, li => 1, p => 1,  
                    td => 1, th => 1, tr => 1,  
                    tbody => 1, tfoot=> 1, thead => 1,  
                   }->{$self->{open_elements}->[-1]->[1]}) {  
                 !!!back-token;  
                 $token = {type => 'end tag',  
                           tag_name => $self->{open_elements}->[-1]->[1]}; # MUST  
                 redo B;  
               }  
   
               if ($self->{open_elements}->[-1]->[1] ne 'caption') {  
                 !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
               }  
   
               splice @{$self->{open_elements}}, $i;  
   
               $clear_up_to_marker->();  
   
               $self->{insertion_mode} = 'in table';  
   
               !!!next-token;  
               redo B;  
             } elsif ($token->{tag_name} eq 'table') {  
               !!!parse-error (type => 'not closed:caption');  
   
               ## As if </caption>  
               ## have a table element in table scope  
               my $i;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq 'caption') {  
                   $i = $_;  
                   last INSCOPE;  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $i) {  
                 !!!parse-error (type => 'unmatched end tag:caption');  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
                 
               ## generate implied end tags  
               if ({  
                    dd => 1, dt => 1, li => 1, p => 1,  
                    td => 1, th => 1, tr => 1,  
                    tbody => 1, tfoot=> 1, thead => 1,  
                   }->{$self->{open_elements}->[-1]->[1]}) {  
                 !!!back-token; # </table>  
                 $token = {type => 'end tag', tag_name => 'caption'};  
                 !!!back-token;  
                 $token = {type => 'end tag',  
                           tag_name => $self->{open_elements}->[-1]->[1]}; # MUST  
                 redo B;  
               }  
   
               if ($self->{open_elements}->[-1]->[1] ne 'caption') {  
                 !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
               }  
   
               splice @{$self->{open_elements}}, $i;  
   
               $clear_up_to_marker->();  
   
               $self->{insertion_mode} = 'in table';  
   
               ## reprocess  
               redo B;  
             } elsif ({  
                       body => 1, col => 1, colgroup => 1,  
                       html => 1, tbody => 1, td => 1, tfoot => 1,  
                       th => 1, thead => 1, tr => 1,  
                      }->{$token->{tag_name}}) {  
               !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
               ## Ignore the token  
               !!!next-token;  
               redo B;  
             } else {  
               #  
             }  
           } else {  
             #  
           }  
                 
           $in_body->($insert_to_current);  
           redo B;  
4189          } elsif ($self->{insertion_mode} eq 'in column group') {          } elsif ($self->{insertion_mode} eq 'in column group') {
4190            if ($token->{type} eq 'character') {            if ($token->{type} eq 'character') {
4191              if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) {              if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) {
# Line 4700  sub _tree_construction_main ($) { Line 4831  sub _tree_construction_main ($) {
4831            !!!parse-error (type => 'in table:'.$token->{tag_name});            !!!parse-error (type => 'in table:'.$token->{tag_name});
4832            $in_body->($insert_to_foster);            $in_body->($insert_to_foster);
4833            redo B;            redo B;
         } elsif ($self->{insertion_mode} eq 'in cell') {  
           if ($token->{type} eq 'character') {  
             ## NOTE: This is a code clone of "character in body".  
             $reconstruct_active_formatting_elements->($insert_to_current);  
               
             $self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data});  
   
             !!!next-token;  
             redo B;  
           } elsif ($token->{type} eq 'start tag') {  
             if ({  
                  caption => 1, col => 1, colgroup => 1,  
                  tbody => 1, td => 1, tfoot => 1, th => 1,  
                  thead => 1, tr => 1,  
                 }->{$token->{tag_name}}) {  
               ## have an element in table scope  
               my $tn;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq 'td' or $node->[1] eq 'th') {  
                   $tn = $node->[1];  
                   last INSCOPE;  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $tn) {  
                 !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
   
               ## Close the cell  
               !!!back-token; # <?>  
               $token = {type => 'end tag', tag_name => $tn};  
               redo B;  
             } else {  
               #  
             }  
           } elsif ($token->{type} eq 'end tag') {  
             if ($token->{tag_name} eq 'td' or $token->{tag_name} eq 'th') {  
               ## have an element in table scope  
               my $i;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq $token->{tag_name}) {  
                   $i = $_;  
                   last INSCOPE;  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $i) {  
                 !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
                 
               ## generate implied end tags  
               if ({  
                    dd => 1, dt => 1, li => 1, p => 1,  
                    td => ($token->{tag_name} eq 'th'),  
                    th => ($token->{tag_name} eq 'td'),  
                    tr => 1,  
                    tbody => 1, tfoot=> 1, thead => 1,  
                   }->{$self->{open_elements}->[-1]->[1]}) {  
                 !!!back-token;  
                 $token = {type => 'end tag',  
                           tag_name => $self->{open_elements}->[-1]->[1]}; # MUST  
                 redo B;  
               }  
   
               if ($self->{open_elements}->[-1]->[1] ne $token->{tag_name}) {  
                 !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
               }  
   
               splice @{$self->{open_elements}}, $i;  
   
               $clear_up_to_marker->();  
   
               $self->{insertion_mode} = 'in row';  
   
               !!!next-token;  
               redo B;  
             } elsif ({  
                       body => 1, caption => 1, col => 1,  
                       colgroup => 1, html => 1,  
                      }->{$token->{tag_name}}) {  
               !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
               ## Ignore the token  
               !!!next-token;  
               redo B;  
             } elsif ({  
                       table => 1, tbody => 1, tfoot => 1,  
                       thead => 1, tr => 1,  
                      }->{$token->{tag_name}}) {  
               ## have an element in table scope  
               my $i;  
               my $tn;  
               INSCOPE: for (reverse 0..$#{$self->{open_elements}}) {  
                 my $node = $self->{open_elements}->[$_];  
                 if ($node->[1] eq $token->{tag_name}) {  
                   $i = $_;  
                   last INSCOPE;  
                 } elsif ($node->[1] eq 'td' or $node->[1] eq 'th') {  
                   $tn = $node->[1];  
                   ## NOTE: There is exactly one |td| or |th| element  
                   ## in scope in the stack of open elements by definition.  
                 } elsif ({  
                           table => 1, html => 1,  
                          }->{$node->[1]}) {  
                   last INSCOPE;  
                 }  
               } # INSCOPE  
               unless (defined $i) {  
                 !!!parse-error (type => 'unmatched end tag:'.$token->{tag_name});  
                 ## Ignore the token  
                 !!!next-token;  
                 redo B;  
               }  
   
               ## Close the cell  
               !!!back-token; # </?>  
               $token = {type => 'end tag', tag_name => $tn};  
               redo B;  
             } else {  
               #  
             }  
           } else {  
             #  
           }  
             
           $in_body->($insert_to_current);  
           redo B;  
4834          } elsif ($self->{insertion_mode} eq 'in select') {          } elsif ($self->{insertion_mode} eq 'in select') {
4835            if ($token->{type} eq 'character') {            if ($token->{type} eq 'character') {
4836              $self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data});              $self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data});
# Line 5083  sub _tree_construction_main ($) { Line 5074  sub _tree_construction_main ($) {
5074            !!!next-token;            !!!next-token;
5075            redo B;            redo B;
5076          } elsif ($token->{tag_name} eq 'noframes') {          } elsif ($token->{tag_name} eq 'noframes') {
5077            $in_body->($insert_to_current);            ## NOTE: As if in body.
5078              $parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current);
5079            redo B;            redo B;
5080          } else {          } else {
5081            !!!parse-error (type => 'in frameset:'.$token->{tag_name});            !!!parse-error (type => 'in frameset:'.$token->{tag_name});
# Line 5143  sub _tree_construction_main ($) { Line 5135  sub _tree_construction_main ($) {
5135          die qq[$0: Character "$token->{data}"];          die qq[$0: Character "$token->{data}"];
5136        } elsif ($token->{type} eq 'start tag') {        } elsif ($token->{type} eq 'start tag') {
5137          if ($token->{tag_name} eq 'noframes') {          if ($token->{tag_name} eq 'noframes') {
5138            $in_body->($insert_to_current);            ## NOTE: As if in body.
5139              $parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current);
5140            redo B;            redo B;
5141          } else {          } else {
5142            !!!parse-error (type => 'after frameset:'.$token->{tag_name});            !!!parse-error (type => 'after frameset:'.$token->{tag_name});

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.44

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24