643 |
|
|
644 |
my $i = 0; |
my $i = 0; |
645 |
$self->{line_prev} = $self->{line} = 1; |
$self->{line_prev} = $self->{line} = 1; |
646 |
$self->{column_prev} = $self->{column} = 0; |
$self->{column_prev} = -1; |
647 |
|
$self->{column} = 0; |
648 |
$self->{set_next_char} = sub { |
$self->{set_next_char} = sub { |
649 |
my $self = shift; |
my $self = shift; |
650 |
|
|
|
pop @{$self->{prev_char}}; |
|
|
unshift @{$self->{prev_char}}, $self->{next_char}; |
|
|
|
|
651 |
my $char = ''; |
my $char = ''; |
652 |
if (defined $self->{next_next_char}) { |
if (defined $self->{next_next_char}) { |
653 |
$char = $self->{next_next_char}; |
$char = $self->{next_next_char}; |
654 |
delete $self->{next_next_char}; |
delete $self->{next_next_char}; |
655 |
$self->{next_char} = ord $char; |
$self->{next_char} = ord $char; |
656 |
} else { |
} else { |
657 |
|
$self->{char_buffer} = ''; |
658 |
|
$self->{char_buffer_pos} = 0; |
659 |
|
|
660 |
|
my $count = $input->manakai_read_until |
661 |
|
($self->{char_buffer}, |
662 |
|
qr/(?!\x{FDD0}-\x{FDDF}\x{FFFE}\x{FFFF}\x{1FFFE}\x{1FFFF}\x{2FFFE}\x{2FFFF}\x{3FFFE}\x{3FFFF}\x{4FFFE}\x{4FFFF}\x{5FFFE}\x{5FFFF}\x{6FFFE}\x{6FFFF}\x{7FFFE}\x{7FFFF}\x{8FFFE}\x{8FFFF}\x{9FFFE}\x{9FFFF}\x{AFFFE}\x{AFFFF}\x{BFFFE}\x{BFFFF}\x{CFFFE}\x{CFFFF}\x{DFFFE}\x{DFFFF}\x{EFFFE}\x{EFFFF}\x{FFFFE}\x{FFFFF}])[\x20-\x7E\xA0-\x{D7FF}\x{E000}-\x{10FFFD}]/, |
663 |
|
$self->{char_buffer_pos}); |
664 |
|
if ($count) { |
665 |
|
$self->{line_prev} = $self->{line}; |
666 |
|
$self->{column_prev} = $self->{column}; |
667 |
|
$self->{column}++; |
668 |
|
$self->{next_char} |
669 |
|
= ord substr ($self->{char_buffer}, $self->{char_buffer_pos}++, 1); |
670 |
|
return; |
671 |
|
} |
672 |
|
|
673 |
if ($input->read ($char, 1)) { |
if ($input->read ($char, 1)) { |
674 |
$self->{next_char} = ord $char; |
$self->{next_char} = ord $char; |
675 |
} else { |
} else { |
749 |
} |
} |
750 |
return $count; |
return $count; |
751 |
}; # $self->{read_until} |
}; # $self->{read_until} |
752 |
|
$self->{read_until}=sub{0}; |
753 |
|
|
754 |
my $onerror = $_[2] || sub { |
my $onerror = $_[2] || sub { |
755 |
my (%opt) = @_; |
my (%opt) = @_; |
921 |
undef $self->{last_emitted_start_tag_name}; |
undef $self->{last_emitted_start_tag_name}; |
922 |
#$self->{prev_state}; # initialized when used |
#$self->{prev_state}; # initialized when used |
923 |
delete $self->{self_closing}; |
delete $self->{self_closing}; |
924 |
|
$self->{char_buffer} = ''; |
925 |
|
$self->{char_buffer_pos} = 0; |
926 |
# $self->{next_char} |
# $self->{next_char} |
927 |
!!!next-input-character; |
!!!next-input-character; |
928 |
$self->{token} = []; |
$self->{token} = []; |