659 |
|
|
660 |
my $count = $input->manakai_read_until |
my $count = $input->manakai_read_until |
661 |
($self->{char_buffer}, |
($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}]/, |
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}); |
$self->{char_buffer_pos}); |
664 |
if ($count) { |
if ($count) { |
665 |
$self->{line_prev} = $self->{line}; |
$self->{line_prev} = $self->{line}; |
730 |
} |
} |
731 |
} |
} |
732 |
}; |
}; |
|
$self->{prev_char} = [-1, -1, -1]; |
|
|
$self->{next_char} = -1; |
|
733 |
|
|
734 |
$self->{read_until} = sub { |
$self->{read_until} = sub { |
735 |
#my ($scalar, $specials_range, $offset) = @_; |
#my ($scalar, $specials_range, $offset) = @_; |
|
my $specials_range = $_[1]; |
|
736 |
return 0 if defined $self->{next_next_char}; |
return 0 if defined $self->{next_next_char}; |
737 |
my $count = $input->manakai_read_until |
|
738 |
($_[0], |
my $pattern = qr/(?![$_[1]\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}]/; |
739 |
qr/(?![$specials_range\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}]/, |
my $offset = $_[2] || 0; |
740 |
$_[2]); |
|
741 |
if ($count) { |
if ($self->{char_buffer_pos} < length $self->{char_buffer}) { |
742 |
$self->{column} += $count; |
pos ($self->{char_buffer}) = $self->{char_buffer_pos}; |
743 |
$self->{column_prev} += $count; |
if ($self->{char_buffer} =~ /\G(?>$pattern)+/) { |
744 |
$self->{prev_char} = [-1, -1, -1]; |
substr ($_[0], $offset) |
745 |
$self->{next_char} = -1; |
= substr ($self->{char_buffer}, $-[0], $+[0] - $-[0]); |
746 |
|
my $count = $+[0] - $-[0]; |
747 |
|
if ($count) { |
748 |
|
$self->{column} += $count; |
749 |
|
$self->{char_buffer_pos} += $count; |
750 |
|
$self->{line_prev} = $self->{line}; |
751 |
|
$self->{column_prev} = $self->{column} - 1; |
752 |
|
$self->{prev_char} = [-1, -1, -1]; |
753 |
|
$self->{next_char} = -1; |
754 |
|
} |
755 |
|
return $count; |
756 |
|
} else { |
757 |
|
return 0; |
758 |
|
} |
759 |
|
} else { |
760 |
|
my $count = $input->manakai_read_until ($_[0], $pattern, $_[2]); |
761 |
|
if ($count) { |
762 |
|
$self->{column} += $count; |
763 |
|
$self->{line_prev} = $self->{line}; |
764 |
|
$self->{column_prev} = $self->{column} - 1; |
765 |
|
$self->{prev_char} = [-1, -1, -1]; |
766 |
|
$self->{next_char} = -1; |
767 |
|
} |
768 |
|
return $count; |
769 |
} |
} |
|
return $count; |
|
770 |
}; # $self->{read_until} |
}; # $self->{read_until} |
|
$self->{read_until}=sub{0}; |
|
771 |
|
|
772 |
my $onerror = $_[2] || sub { |
my $onerror = $_[2] || sub { |
773 |
my (%opt) = @_; |
my (%opt) = @_; |
941 |
delete $self->{self_closing}; |
delete $self->{self_closing}; |
942 |
$self->{char_buffer} = ''; |
$self->{char_buffer} = ''; |
943 |
$self->{char_buffer_pos} = 0; |
$self->{char_buffer_pos} = 0; |
944 |
# $self->{next_char} |
$self->{prev_char} = [-1, -1, -1]; |
945 |
|
$self->{next_char} = -1; |
946 |
!!!next-input-character; |
!!!next-input-character; |
947 |
$self->{token} = []; |
$self->{token} = []; |
948 |
# $self->{escape} |
# $self->{escape} |
7824 |
$p->{set_next_char} = sub { |
$p->{set_next_char} = sub { |
7825 |
my $self = shift; |
my $self = shift; |
7826 |
|
|
|
pop @{$self->{prev_char}}; |
|
|
unshift @{$self->{prev_char}}, $self->{next_char}; |
|
|
|
|
7827 |
my $char = ''; |
my $char = ''; |
7828 |
if (defined $self->{next_next_char}) { |
if (defined $self->{next_next_char}) { |
7829 |
$char = $self->{next_next_char}; |
$char = $self->{next_next_char}; |
7830 |
delete $self->{next_next_char}; |
delete $self->{next_next_char}; |
7831 |
$self->{next_char} = ord $char; |
$self->{next_char} = ord $char; |
7832 |
} else { |
} else { |
7833 |
|
$self->{char_buffer} = ''; |
7834 |
|
$self->{char_buffer_pos} = 0; |
7835 |
|
|
7836 |
|
my $count = $input->manakai_read_until |
7837 |
|
($self->{char_buffer}, |
7838 |
|
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}]/, |
7839 |
|
$self->{char_buffer_pos}); |
7840 |
|
if ($count) { |
7841 |
|
$self->{line_prev} = $self->{line}; |
7842 |
|
$self->{column_prev} = $self->{column}; |
7843 |
|
$self->{column}++; |
7844 |
|
$self->{next_char} |
7845 |
|
= ord substr ($self->{char_buffer}, |
7846 |
|
$self->{char_buffer_pos}++, 1); |
7847 |
|
return; |
7848 |
|
} |
7849 |
|
|
7850 |
if ($input->read ($char, 1)) { |
if ($input->read ($char, 1)) { |
7851 |
$self->{next_char} = ord $char; |
$self->{next_char} = ord $char; |
7852 |
} else { |
} else { |
7909 |
} |
} |
7910 |
} |
} |
7911 |
}; |
}; |
|
$p->{prev_char} = [-1, -1, -1]; |
|
|
$p->{next_char} = -1; |
|
7912 |
|
|
7913 |
$p->{read_until} = sub { |
$p->{read_until} = sub { |
7914 |
#my ($scalar, $specials_range, $offset) = @_; |
#my ($scalar, $specials_range, $offset) = @_; |
|
my $specials_range = $_[1]; |
|
7915 |
return 0 if defined $p->{next_next_char}; |
return 0 if defined $p->{next_next_char}; |
7916 |
my $count = $input->manakai_read_until |
|
7917 |
($_[0], |
my $pattern = qr/(?![$_[1]\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}]/; |
7918 |
qr/(?![$specials_range\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}]/, |
my $offset = $_[2] || 0; |
7919 |
$_[2]); |
|
7920 |
if ($count) { |
if ($p->{char_buffer_pos} < length $p->{char_buffer}) { |
7921 |
$p->{column} += $count; |
pos ($p->{char_buffer}) = $p->{char_buffer_pos}; |
7922 |
$p->{column_prev} += $count; |
if ($p->{char_buffer} =~ /\G(?>$pattern)+/) { |
7923 |
$p->{prev_char} = [-1, -1, -1]; |
substr ($_[0], $offset) |
7924 |
$p->{next_char} = -1; |
= substr ($p->{char_buffer}, $-[0], $+[0] - $-[0]); |
7925 |
|
my $count = $+[0] - $-[0]; |
7926 |
|
if ($count) { |
7927 |
|
$p->{column} += $count; |
7928 |
|
$p->{char_buffer_pos} += $count; |
7929 |
|
$p->{line_prev} = $p->{line}; |
7930 |
|
$p->{column_prev} = $p->{column} - 1; |
7931 |
|
$p->{prev_char} = [-1, -1, -1]; |
7932 |
|
$p->{next_char} = -1; |
7933 |
|
} |
7934 |
|
return $count; |
7935 |
|
} else { |
7936 |
|
return 0; |
7937 |
|
} |
7938 |
|
} else { |
7939 |
|
my $count = $input->manakai_read_until ($_[0], $pattern, $_[2]); |
7940 |
|
if ($count) { |
7941 |
|
$p->{column} += $count; |
7942 |
|
$p->{column_prev} += $count; |
7943 |
|
$p->{prev_char} = [-1, -1, -1]; |
7944 |
|
$p->{next_char} = -1; |
7945 |
|
} |
7946 |
|
return $count; |
7947 |
} |
} |
|
return $count; |
|
7948 |
}; # $p->{read_until} |
}; # $p->{read_until} |
7949 |
|
|
7950 |
my $ponerror = $onerror || sub { |
my $ponerror = $onerror || sub { |