/[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.103 by wakaba, Sun Mar 9 07:57:29 2008 UTC revision 1.106 by wakaba, Sun Mar 9 10:31:19 2008 UTC
# Line 3293  sub _tree_construction_main ($) { Line 3293  sub _tree_construction_main ($) {
3293        ## Stay in the phase        ## Stay in the phase
3294        !!!next-token;        !!!next-token;
3295        redo B;        redo B;
     } elsif ($token->{type} == END_OF_FILE_TOKEN) {  
       if ($self->{insertion_mode} & AFTER_HTML_IMS) {  
         !!!cp ('t74');  
         #  
       } else {  
         ## Generate implied end tags  
         while ({  
                 dd => 1, dt => 1, li => 1, p => 1,  
                }->{$self->{open_elements}->[-1]->[1]}) {  
           !!!cp ('t75');  
           pop @{$self->{open_elements}};  
         }  
           
         if (@{$self->{open_elements}} > 2 or  
             (@{$self->{open_elements}} == 2 and $self->{open_elements}->[1]->[1] ne 'body')) {  
           !!!cp ('t76');  
           !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
         } elsif (defined $self->{inner_html_node} and  
                  @{$self->{open_elements}} > 1 and  
                  $self->{open_elements}->[1]->[1] ne 'body') {  
 ## ISSUE: This case is never reached.  
           !!!cp ('t77');  
           !!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]);  
         } else {  
           !!!cp ('t78');  
         }  
   
         ## ISSUE: There is an issue in the spec.  
       }  
   
       ## Stop parsing  
       last B;  
3296      } elsif ($token->{type} == START_TAG_TOKEN and      } elsif ($token->{type} == START_TAG_TOKEN and
3297               $token->{tag_name} eq 'html') {               $token->{tag_name} eq 'html') {
3298        if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {        if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) {
# Line 3843  sub _tree_construction_main ($) { Line 3811  sub _tree_construction_main ($) {
3811              $self->{insertion_mode} = IN_BODY_IM;              $self->{insertion_mode} = IN_BODY_IM;
3812              ## reprocess              ## reprocess
3813              redo B;              redo B;
3814            } else {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
3815              die "$0: $token->{type}: Unknown token type";          if ($self->{insertion_mode} == BEFORE_HEAD_IM) {
3816            }            !!!cp ('t149.1');
3817    
3818              ## NOTE: As if <head>
3819              !!!create-element ($self->{head_element}, 'head');
3820              $self->{open_elements}->[-1]->[0]->append_child
3821                  ($self->{head_element});
3822              #push @{$self->{open_elements}}, [$self->{head_element}, 'head'];
3823              #$self->{insertion_mode} = IN_HEAD_IM;
3824              ## NOTE: Reprocess.
3825    
3826              ## NOTE: As if </head>
3827              #pop @{$self->{open_elements}};
3828              #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3829              ## NOTE: Reprocess.
3830              
3831              #
3832            } elsif ($self->{insertion_mode} == IN_HEAD_IM) {
3833              !!!cp ('t149.2');
3834    
3835              ## NOTE: As if </head>
3836              pop @{$self->{open_elements}};
3837              #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3838              ## NOTE: Reprocess.
3839    
3840              #
3841            } elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) {
3842              !!!cp ('t149.3');
3843    
3844              !!!parse-error (type => 'in noscript:#eof');
3845    
3846              ## As if </noscript>
3847              pop @{$self->{open_elements}};
3848              #$self->{insertion_mode} = IN_HEAD_IM;
3849              ## NOTE: Reprocess.
3850    
3851              ## NOTE: As if </head>
3852              pop @{$self->{open_elements}};
3853              #$self->{insertion_mode} = IN_AFTER_HEAD_IM;
3854              ## NOTE: Reprocess.
3855    
3856              #
3857            } else {
3858              !!!cp ('t149.4');
3859              #
3860            }
3861    
3862            ## NOTE: As if <body>
3863            !!!insert-element ('body');
3864            $self->{insertion_mode} = IN_BODY_IM;
3865            ## NOTE: Reprocess.
3866            redo B;
3867          } else {
3868            die "$0: $token->{type}: Unknown token type";
3869          }
3870    
3871            ## ISSUE: An issue in the spec.            ## ISSUE: An issue in the spec.
3872      } elsif ($self->{insertion_mode} & BODY_IMS) {      } elsif ($self->{insertion_mode} & BODY_IMS) {
# Line 4187  sub _tree_construction_main ($) { Line 4208  sub _tree_construction_main ($) {
4208                !!!cp ('t193');                !!!cp ('t193');
4209                #                #
4210              }              }
4211          } elsif ($token->{type} == END_OF_FILE_TOKEN) {
4212            for my $entry (@{$self->{open_elements}}) {
4213              if (not {
4214                dd => 1, dt => 1, li => 1, p => 1, tbody => 1, td => 1, tfoot => 1,
4215                th => 1, thead => 1, tr => 1, body => 1, html => 1,
4216              }->{$entry->[1]}) {
4217                !!!cp ('t75');
4218                !!!parse-error (type => 'in body:#eof');
4219                last;
4220              }
4221            }
4222    
4223            ## Stop parsing.
4224            last B;
4225        } else {        } else {
4226          die "$0: $token->{type}: Unknown token type";          die "$0: $token->{type}: Unknown token type";
4227        }        }
# Line 4500  sub _tree_construction_main ($) { Line 4535  sub _tree_construction_main ($) {
4535                  redo B;                  redo B;
4536                }                }
4537                                
4538    ## TODO: Followings are removed from the latest spec.
4539                ## generate implied end tags                ## generate implied end tags
4540                while ({                while ({
4541                        dd => 1, dt => 1, li => 1, p => 1,                        dd => 1, dt => 1, li => 1, p => 1,
# Line 4863  sub _tree_construction_main ($) { Line 4899  sub _tree_construction_main ($) {
4899            $insert = $insert_to_foster;            $insert = $insert_to_foster;
4900            #            #
4901          }          }
4902          } elsif ($token->{type} == END_OF_FILE_TOKEN) {
4903            unless ($self->{open_elements}->[-1]->[1] eq 'html' and
4904                    @{$self->{open_elements}} == 1) { # redundant, maybe
4905              !!!parse-error (type => 'in body:#eof');
4906              !!!cp ('t259.1');
4907              #
4908            } else {
4909              !!!cp ('t259.2');
4910              #
4911            }
4912    
4913            ## Stop parsing
4914            last B;
4915        } else {        } else {
4916          die "$0: $token->{type}: Unknown token type";          die "$0: $token->{type}: Unknown token type";
4917        }        }
# Line 4915  sub _tree_construction_main ($) { Line 4964  sub _tree_construction_main ($) {
4964                !!!cp ('t267');                !!!cp ('t267');
4965                #                #
4966              }              }
4967            } else {        } elsif ($token->{type} == END_OF_FILE_TOKEN) {
4968              die "$0: $token->{type}: Unknown token type";          if ($self->{open_elements}->[-1]->[1] eq 'html' or
4969            }              @{$self->{open_elements}} == 1) { # redundant, maybe
4970              !!!cp ('t270.2');
4971              ## Stop parsing.
4972              last B;
4973            } else {
4974              ## NOTE: As if </colgroup>.
4975              !!!cp ('t270.1');
4976              pop @{$self->{open_elements}}; # colgroup
4977              $self->{insertion_mode} = IN_TABLE_IM;
4978              ## Reprocess.
4979              redo B;
4980            }
4981          } else {
4982            die "$0: $token->{type}: Unknown token type";
4983          }
4984    
4985            ## As if </colgroup>            ## As if </colgroup>
4986            if ($self->{open_elements}->[-1]->[1] eq 'html') {            if ($self->{open_elements}->[-1]->[1] eq 'html') {
4987              !!!cp ('t269');              !!!cp ('t269');
4988    ## TODO: Wrong error type?
4989              !!!parse-error (type => 'unmatched end tag:colgroup');              !!!parse-error (type => 'unmatched end tag:colgroup');
4990              ## Ignore the token              ## Ignore the token
4991              !!!next-token;              !!!next-token;
# Line 5157  sub _tree_construction_main ($) { Line 5221  sub _tree_construction_main ($) {
5221            !!!next-token;            !!!next-token;
5222            redo B;            redo B;
5223          }          }
5224          } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5225            unless ($self->{open_elements}->[-1]->[1] eq 'html' and
5226                    @{$self->{open_elements}} == 1) { # redundant, maybe
5227              !!!cp ('t299.1');
5228              !!!parse-error (type => 'in body:#eof');
5229            } else {
5230              !!!cp ('t299.2');
5231            }
5232    
5233            ## Stop parsing.
5234            last B;
5235        } else {        } else {
5236          die "$0: $token->{type}: Unknown token type";          die "$0: $token->{type}: Unknown token type";
5237        }        }
# Line 5240  sub _tree_construction_main ($) { Line 5315  sub _tree_construction_main ($) {
5315            ## reprocess            ## reprocess
5316            redo B;            redo B;
5317          }          }
5318          } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5319            !!!cp ('t309.2');
5320            ## Stop parsing
5321            last B;
5322        } else {        } else {
5323          die "$0: $token->{type}: Unknown token type";          die "$0: $token->{type}: Unknown token type";
5324        }        }
# Line 5375  sub _tree_construction_main ($) { Line 5454  sub _tree_construction_main ($) {
5454            !!!next-token;            !!!next-token;
5455            redo B;            redo B;
5456          }          }
5457          } elsif ($token->{type} == END_OF_FILE_TOKEN) {
5458            unless ($self->{open_elements}->[-1]->[1] eq 'html' and
5459                    @{$self->{open_elements}} == 1) { # redundant, maybe
5460              !!!cp ('t331.1');
5461              !!!parse-error (type => 'in body:#eof');
5462            } else {
5463              !!!cp ('t331.2');
5464            }
5465            
5466            ## Stop parsing
5467            last B;
5468        } else {        } else {
5469          die "$0: $token->{type}: Unknown token type";          die "$0: $token->{type}: Unknown token type";
5470        }        }

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.106

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24