714 |
$self->{prev_char} = [-1, -1, -1]; |
$self->{prev_char} = [-1, -1, -1]; |
715 |
$self->{next_char} = -1; |
$self->{next_char} = -1; |
716 |
|
|
717 |
$self->{getc_until} = sub { return undef }; |
$self->{read_until} = sub { |
718 |
# if ($input->can ('manakai_getc_until')) { |
#my ($scalar, $specials_range, $offset) = @_; |
719 |
$self->{getc_until} = sub { |
my $specials_range = $_[1]; |
720 |
my $special_range = shift; |
return 0 if defined $self->{next_next_char}; |
721 |
return undef if defined $self->{next_next_char}; |
my $count = $input->manakai_read_until |
722 |
my $s = $input->manakai_getc_until |
($_[0], |
723 |
(qr/(?![$special_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}]/); |
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}]/, |
724 |
if ($s) { |
$_[2]); |
725 |
$self->{column} += length $$s; |
if ($count) { |
726 |
$self->{column_prev} += length $$s; |
$self->{column} += $count; |
727 |
$self->{prev_char} = [-1, -1, -1]; |
$self->{column_prev} += $count; |
728 |
$self->{next_char} = -1; |
$self->{prev_char} = [-1, -1, -1]; |
729 |
} |
$self->{next_char} = -1; |
730 |
return $s; |
} |
731 |
}; # $self->{getc_until} |
return $count; |
732 |
# } else { |
}; # $self->{read_until} |
|
# $self->{getc_until} = sub { |
|
|
# my $special_range = shift; |
|
|
# return undef if defined $self->{next_next_char}; |
|
|
# my $c = $input->getc; |
|
|
# if ($c =~ /^(?![$special_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}]/) { |
|
|
# $self->{column}++; |
|
|
# $self->{column_prev}++; |
|
|
# $self->{prev_char} = [-1, -1, -1]; |
|
|
# $self->{next_char} = -1; |
|
|
# return \$c; |
|
|
# } elsif (defined $c) { |
|
|
# #$input->ungetc (ord $c); |
|
|
# $self->{next_next_char} = $c; |
|
|
# return undef; |
|
|
# } else { |
|
|
# return undef; |
|
|
# } |
|
|
# }; # $self->{getc_until} |
|
|
# } |
|
733 |
|
|
734 |
my $onerror = $_[2] || sub { |
my $onerror = $_[2] || sub { |
735 |
my (%opt) = @_; |
my (%opt) = @_; |
1027 |
data => chr $self->{next_char}, |
data => chr $self->{next_char}, |
1028 |
line => $self->{line}, column => $self->{column}, |
line => $self->{line}, column => $self->{column}, |
1029 |
}; |
}; |
1030 |
|
$self->{read_until}->($token->{data}, q[-!<>&], length $token->{data}); |
|
my $s = $self->{getc_until}->(q[-!<>&]); |
|
|
if ($s) { |
|
|
$token->{data} .= $$s; |
|
|
} |
|
1031 |
|
|
1032 |
## Stay in the data state |
## Stay in the data state |
1033 |
!!!next-input-character; |
!!!next-input-character; |
7795 |
$p->{prev_char} = [-1, -1, -1]; |
$p->{prev_char} = [-1, -1, -1]; |
7796 |
$p->{next_char} = -1; |
$p->{next_char} = -1; |
7797 |
|
|
7798 |
$p->{getc_until} = sub { |
$p->{read_until} = sub { |
7799 |
## TODO: ... |
## TODO: ... |
7800 |
return undef; |
return 0; |
7801 |
}; # $p->{getc_until}; |
}; # $p->{read_until}; |
7802 |
|
|
7803 |
my $ponerror = $onerror || sub { |
my $ponerror = $onerror || sub { |
7804 |
my (%opt) = @_; |
my (%opt) = @_; |