169 |
sub AFTER_HTML_IMS () { 0b100 } |
sub AFTER_HTML_IMS () { 0b100 } |
170 |
sub HEAD_IMS () { 0b1000 } |
sub HEAD_IMS () { 0b1000 } |
171 |
sub BODY_IMS () { 0b10000 } |
sub BODY_IMS () { 0b10000 } |
172 |
sub BODY_TABLE_IMS () { 0b100000 | BODY_IMS } |
sub BODY_TABLE_IMS () { 0b100000 } |
173 |
sub TABLE_IMS () { 0b1000000 } |
sub TABLE_IMS () { 0b1000000 } |
174 |
sub ROW_IMS () { 0b10000000 | TABLE_IMS } |
sub ROW_IMS () { 0b10000000 } |
175 |
sub BODY_AFTER_IMS () { 0b100000000 } |
sub BODY_AFTER_IMS () { 0b100000000 } |
176 |
sub FRAME_IMS () { 0b1000000000 } |
sub FRAME_IMS () { 0b1000000000 } |
177 |
|
|
182 |
sub AFTER_HEAD_IM () { HEAD_IMS | 0b10 } |
sub AFTER_HEAD_IM () { HEAD_IMS | 0b10 } |
183 |
sub BEFORE_HEAD_IM () { HEAD_IMS | 0b11 } |
sub BEFORE_HEAD_IM () { HEAD_IMS | 0b11 } |
184 |
sub IN_BODY_IM () { BODY_IMS } |
sub IN_BODY_IM () { BODY_IMS } |
185 |
sub IN_CELL_IM () { BODY_TABLE_IMS | 0b01 } |
sub IN_CELL_IM () { BODY_IMS | BODY_TABLE_IMS | 0b01 } |
186 |
sub IN_CAPTION_IM () { BODY_TABLE_IMS | 0b10 } |
sub IN_CAPTION_IM () { BODY_IMS | BODY_TABLE_IMS | 0b10 } |
187 |
sub IN_ROW_IM () { ROW_IMS | 0b01 } |
sub IN_ROW_IM () { TABLE_IMS | ROW_IMS | 0b01 } |
188 |
sub IN_TABLE_BODY_IM () { ROW_IMS | 0b10 } |
sub IN_TABLE_BODY_IM () { TABLE_IMS | ROW_IMS | 0b10 } |
189 |
sub IN_TABLE_IM () { TABLE_IMS } |
sub IN_TABLE_IM () { TABLE_IMS } |
190 |
sub AFTER_BODY_IM () { BODY_AFTER_IMS } |
sub AFTER_BODY_IM () { BODY_AFTER_IMS } |
191 |
sub IN_FRAMESET_IM () { FRAME_IMS | 0b01 } |
sub IN_FRAMESET_IM () { FRAME_IMS | 0b01 } |
2539 |
!!!next-token; |
!!!next-token; |
2540 |
redo B; |
redo B; |
2541 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
2542 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM or |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
|
$self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
|
2543 |
# |
# |
2544 |
} else { |
} else { |
2545 |
## Generate implied end tags |
## Generate implied end tags |
2595 |
redo B; |
redo B; |
2596 |
} elsif ($token->{type} == COMMENT_TOKEN) { |
} elsif ($token->{type} == COMMENT_TOKEN) { |
2597 |
my $comment = $self->{document}->create_comment ($token->{data}); |
my $comment = $self->{document}->create_comment ($token->{data}); |
2598 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM or |
if ($self->{insertion_mode} & AFTER_HTML_IMS) { |
|
$self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
|
2599 |
$self->{document}->append_child ($comment); |
$self->{document}->append_child ($comment); |
2600 |
} elsif ($self->{insertion_mode} == AFTER_BODY_IM) { |
} elsif ($self->{insertion_mode} == AFTER_BODY_IM) { |
2601 |
$self->{open_elements}->[0]->[0]->append_child ($comment); |
$self->{open_elements}->[0]->[0]->append_child ($comment); |
2604 |
} |
} |
2605 |
!!!next-token; |
!!!next-token; |
2606 |
redo B; |
redo B; |
2607 |
} elsif ($self->{insertion_mode} == IN_HEAD_IM or |
} elsif ($self->{insertion_mode} & HEAD_IMS) { |
|
$self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM or |
|
|
$self->{insertion_mode} == AFTER_HEAD_IM or |
|
|
$self->{insertion_mode} == BEFORE_HEAD_IM) { |
|
2608 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
2609 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
2610 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
2981 |
} |
} |
2982 |
|
|
2983 |
## ISSUE: An issue in the spec. |
## ISSUE: An issue in the spec. |
2984 |
} elsif ($self->{insertion_mode} == IN_BODY_IM or |
} elsif ($self->{insertion_mode} & BODY_IMS) { |
|
$self->{insertion_mode} == IN_CELL_IM or |
|
|
$self->{insertion_mode} == IN_CAPTION_IM) { |
|
2985 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
2986 |
## NOTE: There is a code clone of "character in body". |
## NOTE: There is a code clone of "character in body". |
2987 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
3275 |
} elsif ({ |
} elsif ({ |
3276 |
body => 1, col => 1, colgroup => 1, html => 1, |
body => 1, col => 1, colgroup => 1, html => 1, |
3277 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
3278 |
if ($self->{insertion_mode} == IN_CELL_IM or |
if ($self->{insertion_mode} & BODY_TABLE_IMS) { |
|
$self->{insertion_mode} == IN_CAPTION_IM) { |
|
3279 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
3280 |
## Ignore the token |
## Ignore the token |
3281 |
!!!next-token; |
!!!next-token; |
3301 |
|
|
3302 |
$insert = $insert_to_current; |
$insert = $insert_to_current; |
3303 |
# |
# |
3304 |
} elsif ($self->{insertion_mode} == IN_ROW_IM or |
} elsif ($self->{insertion_mode} & TABLE_IMS) { |
|
$self->{insertion_mode} == IN_TABLE_BODY_IM or |
|
|
$self->{insertion_mode} == IN_TABLE_IM) { |
|
3305 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
3306 |
## NOTE: There are "character in table" code clones. |
## NOTE: There are "character in table" code clones. |
3307 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
3756 |
} elsif ({ |
} elsif ({ |
3757 |
tbody => 1, tfoot => 1, thead => 1, |
tbody => 1, tfoot => 1, thead => 1, |
3758 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
3759 |
($self->{insertion_mode} == IN_ROW_IM or |
$self->{insertion_mode} & ROW_IMS) { |
|
$self->{insertion_mode} == IN_TABLE_BODY_IM)) { |
|
3760 |
if ($self->{insertion_mode} == IN_ROW_IM) { |
if ($self->{insertion_mode} == IN_ROW_IM) { |
3761 |
## have an element in table scope |
## have an element in table scope |
3762 |
my $i; |
my $i; |
4096 |
## Ignore the token |
## Ignore the token |
4097 |
!!!next-token; |
!!!next-token; |
4098 |
redo B; |
redo B; |
4099 |
} elsif ($self->{insertion_mode} == AFTER_BODY_IM or |
} elsif ($self->{insertion_mode} & BODY_AFTER_IMS) { |
|
$self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
|
4100 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
4101 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4102 |
my $data = $1; |
my $data = $1; |
4166 |
} else { |
} else { |
4167 |
die "$0: $token->{type}: Unknown token type"; |
die "$0: $token->{type}: Unknown token type"; |
4168 |
} |
} |
4169 |
} elsif ($self->{insertion_mode} == IN_FRAMESET_IM or |
} elsif ($self->{insertion_mode} & FRAME_IMS) { |
|
$self->{insertion_mode} == AFTER_FRAMESET_IM or |
|
|
$self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
|
4170 |
if ($token->{type} == CHARACTER_TOKEN) { |
if ($token->{type} == CHARACTER_TOKEN) { |
4171 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
4172 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |