/[suikacvs]/markup/html/whatpm/t/HTML-tokenizer.t
Suika

Diff of /markup/html/whatpm/t/HTML-tokenizer.t

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

revision 1.34 by wakaba, Sun Apr 13 06:44:27 2008 UTC revision 1.38 by wakaba, Sat Aug 30 13:43:50 2008 UTC
# Line 26  BEGIN { Line 26  BEGIN {
26  }  }
27    
28  use Test;  use Test;
29  BEGIN { plan tests => 477 }  BEGIN { plan tests => 1073 }
30    
31  use Data::Dumper;  use Data::Dumper;
32  $Data::Dumper::Useqq = 1;  $Data::Dumper::Useqq = 1;
33    $Data::Dumper::Sortkeys = 1;
34  sub Data::Dumper::qquote {  sub Data::Dumper::qquote {
35    my $s = shift;    my $s = shift;
36    $s =~ s/([^\x20\x21-\x26\x28-\x5B\x5D-\x7E])/sprintf '\x{%02X}', ord $1/ge;    $s =~ s/([^\x20\x21-\x26\x28-\x5B\x5D-\x7E])/sprintf '\x{%02X}', ord $1/ge;
# Line 124  for my $file_name (grep {$_} split /\s+/ Line 125  for my $file_name (grep {$_} split /\s+/
125          } elsif ($self->{next_char} == 0x0000) { # NULL          } elsif ($self->{next_char} == 0x0000) { # NULL
126            $self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST            $self->{next_char} = 0xFFFD; # REPLACEMENT CHARACTER # MUST
127            push @token, 'ParseError';            push @token, 'ParseError';
128            } elsif ($self->{next_char} <= 0x0008 or
129                     (0x000E <= $self->{next_char} and
130                      $self->{next_char} <= 0x001F) or
131                     (0x007F <= $self->{next_char} and
132                      $self->{next_char} <= 0x009F) or
133                     (0xD800 <= $self->{next_char} and
134                      $self->{next_char} <= 0xDFFF) or
135                     (0xFDD0 <= $self->{next_char} and
136                      $self->{next_char} <= 0xFDDF) or
137                     {
138                       0xFFFE => 1, 0xFFFF => 1, 0x1FFFE => 1, 0x1FFFF => 1,
139                       0x2FFFE => 1, 0x2FFFF => 1, 0x3FFFE => 1, 0x3FFFF => 1,
140                       0x4FFFE => 1, 0x4FFFF => 1, 0x5FFFE => 1, 0x5FFFF => 1,
141                       0x6FFFE => 1, 0x6FFFF => 1, 0x7FFFE => 1, 0x7FFFF => 1,
142                       0x8FFFE => 1, 0x8FFFF => 1, 0x9FFFE => 1, 0x9FFFF => 1,
143                       0xAFFFE => 1, 0xAFFFF => 1, 0xBFFFE => 1, 0xBFFFF => 1,
144                       0xCFFFE => 1, 0xCFFFF => 1, 0xDFFFE => 1, 0xDFFFF => 1,
145                       0xEFFFE => 1, 0xEFFFF => 1, 0xFFFFE => 1, 0xFFFFF => 1,
146                       0x10FFFE => 1, 0x10FFFF => 1,
147                      }->{$self->{next_char}}) {
148              push @token, 'ParseError';
149          }          }
150        };        };
151        $p->{prev_char} = [-1, -1, -1];        $p->{prev_char} = [-1, -1, -1];
# Line 159  for my $file_name (grep {$_} split /\s+/ Line 181  for my $file_name (grep {$_} split /\s+/
181          $test_token->[1] = $token->{data} if defined $token->{data};          $test_token->[1] = $token->{data} if defined $token->{data};
182          if ($token->{type} == Whatpm::HTML::START_TAG_TOKEN ()) {          if ($token->{type} == Whatpm::HTML::START_TAG_TOKEN ()) {
183            $test_token->[2] = {map {$_->{name} => $_->{value}} values %{$token->{attributes}}};            $test_token->[2] = {map {$_->{name} => $_->{value}} values %{$token->{attributes}}};
184            if ({            $test_token->[3] = 1 if $p->{self_closing};
185                 ## NOTE: Permitted slash            delete $p->{self_closing};
                br => 1, link => 1,  
               }->{$token->{tag_name}}) {  
             delete $p->{self_closing};  
           }  
186          } elsif ($token->{type} == Whatpm::HTML::DOCTYPE_TOKEN ()) {          } elsif ($token->{type} == Whatpm::HTML::DOCTYPE_TOKEN ()) {
187            $test_token->[1] = $token->{name};            $test_token->[1] = $token->{name};
188            $test_token->[2] = $token->{public_identifier};            $test_token->[2] = $token->{public_identifier};

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.38

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24