XML-XSH2
view release on metacpan or search on metacpan
lib/XML/XSH2/Parser.pm view on Meta::CPAN
if (!defined($return) && defined($score))
{
XML::XSH2::Parser::_Runtime::_trace(q{>>Accepted scored production<<}, "",
q{nodename},
$tracelevel)
if defined $::RD_TRACE;
$return = $score_return;
}
splice @{$thisparser->{errors}}, $err_at;
$return = $item[$#item] unless defined $return;
if (defined $::RD_TRACE)
{
XML::XSH2::Parser::_Runtime::_trace(q{>>Matched rule<< (return value: [} .
$return . q{])}, "",
q{nodename},
$tracelevel);
XML::XSH2::Parser::_Runtime::_trace(q{(consumed: [} .
XML::XSH2::Parser::_Runtime::_tracemax(substr($_[1],0,-length($text))) . q{])},
XML::XSH2::Parser::_Runtime::_tracefirst($text),
, q{nodename},
$tracelevel)
}
$_[1] = $text;
return $return;
}
# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
sub XML::XSH2::Parser::_Runtime::XML::XSH2::Parser::nodetype
{
my $thisparser = $_[0];
use vars q{$tracelevel};
local $tracelevel = ($tracelevel||0)+1;
$ERRORS = 0;
my $thisrule = $thisparser->{"rules"}{"nodetype"};
XML::XSH2::Parser::_Runtime::_trace(q{Trying rule: [nodetype]},
XML::XSH2::Parser::_Runtime::_tracefirst($_[1]),
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
my $err_at = @{$thisparser->{errors}};
my $score;
my $score_return;
my $_tok;
my $return = undef;
my $_matched=0;
my $commit=0;
my @item = ();
my %item = ();
my $repeating = $_[2];
my $_noactions = $_[3];
my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
my $_itempos = $_[5];
my %arg = ($#arg & 01) ? @arg : (@arg, undef);
my $text;
my $lastsep;
my $current_match;
my $expectation = new XML::XSH2::Parser::_Runtime::Expectation(q{/element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference/});
$expectation->at($_[1]);
my $thisoffset;
tie $thisoffset, q{XML::XSH2::Parser::_Runtime::OffsetCounter}, \$text, $thisparser;
my $thiscolumn;
tie $thiscolumn, q{XML::XSH2::Parser::_Runtime::ColCounter}, \$text, $thisparser;
my $thisline;
tie $thisline, q{XML::XSH2::Parser::_Runtime::LineCounter}, \$text, $thisparser;
while (!$_matched && !$commit)
{
XML::XSH2::Parser::_Runtime::_trace(q{Trying production: [/element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference/]},
XML::XSH2::Parser::_Runtime::_tracefirst($_[1]),
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
my $thisprod = $thisrule->{"prods"}[0];
$text = $_[1];
my $_savetext;
@item = (q{nodetype});
%item = (__RULE__ => q{nodetype});
my $repcount = 0;
XML::XSH2::Parser::_Runtime::_trace(q{Trying terminal: [/element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference/]}, XML::XSH2::Parser::_Runtime::_tracefirst($text),
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
undef $lastsep;
$expectation->is(q{})->at($text);
unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference)/)
{
$text = $lastsep . $text if defined $lastsep;
$expectation->failed();
XML::XSH2::Parser::_Runtime::_trace(q{<<Didn't match terminal>>},
XML::XSH2::Parser::_Runtime::_tracefirst($text))
if defined $::RD_TRACE;
last;
}
$current_match = substr($text, $-[0], $+[0] - $-[0]);
substr($text,0,length($current_match),q{});
XML::XSH2::Parser::_Runtime::_trace(q{>>Matched terminal<< (return value: [}
. $current_match . q{])},
XML::XSH2::Parser::_Runtime::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $item{__PATTERN1__}=$current_match;
XML::XSH2::Parser::_Runtime::_trace(q{>>Matched production: [/element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference/]<<},
XML::XSH2::Parser::_Runtime::_tracefirst($text),
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
$_matched = 1;
last;
}
unless ( $_matched || defined($score) )
{
$_[1] = $text; # NOT SURE THIS IS NEEDED
XML::XSH2::Parser::_Runtime::_trace(q{<<Didn't match rule>>},
XML::XSH2::Parser::_Runtime::_tracefirst($_[1]),
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
return undef;
}
if (!defined($return) && defined($score))
{
XML::XSH2::Parser::_Runtime::_trace(q{>>Accepted scored production<<}, "",
q{nodetype},
$tracelevel)
if defined $::RD_TRACE;
$return = $score_return;
}
splice @{$thisparser->{errors}}, $err_at;
$return = $item[$#item] unless defined $return;
if (defined $::RD_TRACE)
{
XML::XSH2::Parser::_Runtime::_trace(q{>>Matched rule<< (return value: [} .
$return . q{])}, "",
q{nodetype},
$tracelevel);
XML::XSH2::Parser::_Runtime::_trace(q{(consumed: [} .
XML::XSH2::Parser::_Runtime::_tracemax(substr($_[1],0,-length($text))) . q{])},
XML::XSH2::Parser::_Runtime::_tracefirst($text),
, q{nodetype},
$tracelevel)
}
$_[1] = $text;
return $return;
}
# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
sub XML::XSH2::Parser::_Runtime::XML::XSH2::Parser::option
{
my $thisparser = $_[0];
use vars q{$tracelevel};
local $tracelevel = ($tracelevel||0)+1;
$ERRORS = 0;
my $thisrule = $thisparser->{"rules"}{"option"};
XML::XSH2::Parser::_Runtime::_trace(q{Trying rule: [option]},
lib/XML/XSH2/Parser.pm view on Meta::CPAN
'matchrule' => 0,
'subrule' => 'xpinter'
}, 'XML::XSH2::Parser::_Runtime::Subrule' )
],
'line' => 300,
'number' => 3,
'patcount' => 0,
'strcount' => 0,
'uncommit' => undef
}, 'XML::XSH2::Parser::_Runtime::Production' )
],
'vars' => ''
}, 'XML::XSH2::Parser::_Runtime::Rule' ),
'nodename' => bless( {
'calls' => [
'exp'
],
'changed' => 0,
'impcount' => 0,
'line' => 176,
'name' => 'nodename',
'opcount' => 0,
'prods' => [
bless( {
'actcount' => 0,
'dircount' => 0,
'error' => undef,
'items' => [
bless( {
'argcode' => undef,
'implicit' => undef,
'line' => 177,
'lookahead' => 0,
'matchrule' => 0,
'subrule' => 'exp'
}, 'XML::XSH2::Parser::_Runtime::Subrule' )
],
'line' => undef,
'number' => 0,
'patcount' => 0,
'strcount' => 0,
'uncommit' => undef
}, 'XML::XSH2::Parser::_Runtime::Production' )
],
'vars' => ''
}, 'XML::XSH2::Parser::_Runtime::Rule' ),
'nodetype' => bless( {
'calls' => [],
'changed' => 0,
'impcount' => 0,
'line' => 402,
'name' => 'nodetype',
'opcount' => 0,
'prods' => [
bless( {
'actcount' => 0,
'dircount' => 0,
'error' => undef,
'items' => [
bless( {
'description' => '/element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference/',
'hashname' => '__PATTERN1__',
'ldelim' => '/',
'line' => 403,
'lookahead' => 0,
'mod' => '',
'pattern' => 'element|attribute|attributes|text|cdata|pi|comment|chunk|entity_reference',
'rdelim' => '/'
}, 'XML::XSH2::Parser::_Runtime::Token' )
],
'line' => undef,
'number' => 0,
'patcount' => 1,
'strcount' => 0,
'uncommit' => undef
}, 'XML::XSH2::Parser::_Runtime::Production' )
],
'vars' => ''
}, 'XML::XSH2::Parser::_Runtime::Rule' ),
'option' => bless( {
'calls' => [],
'changed' => 0,
'impcount' => 0,
'line' => 141,
'name' => 'option',
'opcount' => 0,
'prods' => [
bless( {
'actcount' => 0,
'dircount' => 0,
'error' => undef,
'items' => [
bless( {
'description' => '/:[[:alnum:]]|--[-_[:alnum:]]+/',
'hashname' => '__PATTERN1__',
'ldelim' => '/',
'line' => 142,
'lookahead' => 0,
'mod' => '',
'pattern' => ':[[:alnum:]]|--[-_[:alnum:]]+',
'rdelim' => '/'
}, 'XML::XSH2::Parser::_Runtime::Token' )
],
'line' => undef,
'number' => 0,
'patcount' => 1,
'strcount' => 0,
'uncommit' => undef
}, 'XML::XSH2::Parser::_Runtime::Production' )
],
'vars' => ''
}, 'XML::XSH2::Parser::_Runtime::Rule' ),
'param' => bless( {
'calls' => [
'exp'
],
'changed' => 0,
'impcount' => 0,
'line' => 397,
'name' => 'param',
'opcount' => 0,
'prods' => [
bless( {
'actcount' => 1,
'dircount' => 0,
'error' => undef,
'items' => [
( run in 1.278 second using v1.01-cache-2.11-cpan-39bf76dae61 )