📄 parser.pm
字号:
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$item{q{concat}} = $_tok;
push @item, $_tok;
}
$repcount++;
my $savetext = $text;
my $backtrack;
# MATCH (OP RIGHTARG)(s)
while ($repcount < 100000000)
{
$backtrack = 0;
Parse::RecDescent::_trace(q{Trying terminal: [/\\|/]}, Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$lastsep = "";
$expectation->is(q{/\\|/})->at($text);
unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\|)//)
{
$expectation->failed();
Parse::RecDescent::_trace(q{<<Didn't match terminal>>},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
. $& . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $item{__PATTERN1__}=$&;
pop @item;
if (defined $1) {push @item, $item{'concat(s)'}=$1; $backtrack=1;}
Parse::RecDescent::_trace(q{Trying subrule: [concat]},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
if (1) { no strict qw{refs};
$expectation->is(q{concat})->at($text);
unless (defined ($_tok = Parse::RecDescent::re::Parser::concat($thisparser,$text,$repeating,$_noactions,sub { \@arg })))
{
Parse::RecDescent::_trace(q{<<Didn't match subrule: [concat]>>},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$expectation->failed();
last;
}
Parse::RecDescent::_trace(q{>>Matched subrule: [concat]<< (return value: [}
. $_tok . q{]},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$item{q{concat}} = $_tok;
push @item, $_tok;
}
$savetext = $text;
$repcount++;
}
$text = $savetext;
pop @item if $backtrack;
unless (@item) { undef $_tok; last }
$_tok = [ @item ];
last;
}
unless ($repcount>=1)
{
Parse::RecDescent::_trace(q{<<Didn't match operator: [<leftop: concat /\\|/ concat>]>>},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$expectation->failed();
last;
}
Parse::RecDescent::_trace(q{>>Matched operator: [<leftop: concat /\\|/ concat>]<< (return value: [}
. qq{@{$_tok||[]}} . q{]},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
push @item, $item{'concat(s)'}=$_tok||[];
Parse::RecDescent::_trace(q{Trying action},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$_tok = ($_noactions) ? 0 : do {bless \%item, $item[0]};
unless (defined $_tok)
{
Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])})
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
. $_tok . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $_tok;
Parse::RecDescent::_trace(q{>>Matched production: [<leftop: concat /\\|/ concat>]<<},
Parse::RecDescent::_tracefirst($text),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$_matched = 1;
last;
}
unless ( $_matched || defined($return) || defined($score) )
{
$_[1] = $text; # NOT SURE THIS IS NEEDED
Parse::RecDescent::_trace(q{<<Didn't match rule>>},
Parse::RecDescent::_tracefirst($_[1]),
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
return undef;
}
if (!defined($return) && defined($score))
{
Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
q{alternation},
$tracelevel)
if defined $::RD_TRACE;
$return = $score_return;
}
splice @{$thisparser->{errors}}, $err_at;
$return = $item[$#item] unless defined $return;
if (defined $::RD_TRACE)
{
Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
$return . q{])}, "",
q{alternation},
$tracelevel);
Parse::RecDescent::_trace(q{(consumed: [} .
Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
Parse::RecDescent::_tracefirst($text),
, q{alternation},
$tracelevel)
}
$_[1] = $text;
return $return;
}
# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args)
sub Parse::RecDescent::re::Parser::concat
{
my $thisparser = $_[0];
use vars q{$tracelevel};
local $tracelevel = ($tracelevel||0)+1;
$ERRORS = 0;
my $thisrule = $thisparser->{"rules"}{"concat"};
Parse::RecDescent::_trace(q{Trying rule: [concat]},
Parse::RecDescent::_tracefirst($_[1]),
q{concat},
$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 = defined($_[2]) && $_[2];
my $_noactions = defined($_[3]) && $_[3];
my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
my %arg = ($#arg & 01) ? @arg : (@arg, undef);
my $text;
my $lastsep="";
my $expectation = new Parse::RecDescent::Expectation($thisrule->expected());
$expectation->at($_[1]);
my $thisline;
tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
while (!$_matched && !$commit)
{
Parse::RecDescent::_trace(q{Trying production: [modified_atom]},
Parse::RecDescent::_tracefirst($_[1]),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
my $thisprod = $thisrule->{"prods"}[0];
$text = $_[1];
my $_savetext;
@item = (q{concat});
%item = (__RULE__ => q{concat});
my $repcount = 0;
Parse::RecDescent::_trace(q{Trying repeated subrule: [modified_atom]},
Parse::RecDescent::_tracefirst($text),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
$expectation->is(q{})->at($text);
unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::re::Parser::modified_atom, 0, 100000000, $_noactions,$expectation,undef)))
{
Parse::RecDescent::_trace(q{<<Didn't match repeated subrule: [modified_atom]>>},
Parse::RecDescent::_tracefirst($text),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched repeated subrule: [modified_atom]<< (}
. @$_tok . q{ times)},
Parse::RecDescent::_tracefirst($text),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
$item{q{modified_atom(s?)}} = $_tok;
push @item, $_tok;
Parse::RecDescent::_trace(q{Trying action},
Parse::RecDescent::_tracefirst($text),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
$_tok = ($_noactions) ? 0 : do {bless \%item, $item[0]};
unless (defined $_tok)
{
Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])})
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
. $_tok . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $_tok;
Parse::RecDescent::_trace(q{>>Matched production: [modified_atom]<<},
Parse::RecDescent::_tracefirst($text),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
$_matched = 1;
last;
}
unless ( $_matched || defined($return) || defined($score) )
{
$_[1] = $text; # NOT SURE THIS IS NEEDED
Parse::RecDescent::_trace(q{<<Didn't match rule>>},
Parse::RecDescent::_tracefirst($_[1]),
q{concat},
$tracelevel)
if defined $::RD_TRACE;
return undef;
}
if (!defined($return) && defined($score))
{
Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
q{concat},
$tracelevel)
if defined $::RD_TRACE;
$return = $score_return;
}
splice @{$thisparser->{errors}}, $err_at;
$return = $item[$#item] unless defined $return;
if (defined $::RD_TRACE)
{
Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
$return . q{])}, "",
q{concat},
$tracelevel);
Parse::RecDescent::_trace(q{(consumed: [} .
Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
Parse::RecDescent::_tracefirst($text),
, q{concat},
$tracelevel)
}
$_[1] = $text;
return $return;
}
# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args)
sub Parse::RecDescent::re::Parser::modifier
{
my $thisparser = $_[0];
use vars q{$tracelevel};
local $tracelevel = ($tracelevel||0)+1;
$ERRORS = 0;
my $thisrule = $thisparser->{"rules"}{"modifier"};
Parse::RecDescent::_trace(q{Trying rule: [modifier]},
Parse::RecDescent::_tracefirst($_[1]),
q{modifier},
$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 = defined($_[2]) && $_[2];
my $_noactions = defined($_[3]) && $_[3];
my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
my %arg = ($#arg & 01) ? @arg : (@arg, undef);
my $text;
my $lastsep="";
my $expectation = new Parse::RecDescent::Expectation($thisrule->expected());
$expectation->at($_[1]);
my $thisline;
tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
while (!$_matched && !$commit)
{
Parse::RecDescent::_trace(q{Trying production: [/[*]/]},
Parse::RecDescent::_tracefirst($_[1]),
q{modifier},
$tracelevel)
if defined $::RD_TRACE;
my $thisprod = $thisrule->{"prods"}[0];
$text = $_[1];
my $_savetext;
@item = (q{modifier});
%item = (__RULE__ => q{modifier});
my $repcount = 0;
Parse::RecDescent::_trace(q{Trying terminal: [/[*]/]}, Parse::RecDescent::_tracefirst($text),
q{modifier},
$tracelevel)
if defined $::RD_TRACE;
$lastsep = "";
$expectation->is(q{})->at($text);
unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[*])//)
{
$expectation->failed();
Parse::RecDescent::_trace(q{<<Didn't match terminal>>},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
. $& . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $item{__PATTERN1__}=$&;
Parse::RecDescent::_trace(q{Trying action},
Parse::RecDescent::_tracefirst($text),
q{modifier},
$tracelevel)
if defined $::RD_TRACE;
$_tok = ($_noactions) ? 0 : do {bless {__VALUE__=>$item[1]}, $item[0]};
unless (defined $_tok)
{
Parse::RecDescent::_trace(q{<<Didn't match action>> (return value: [undef])})
if defined $::RD_TRACE;
last;
}
Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
. $_tok . q{])},
Parse::RecDescent::_tracefirst($text))
if defined $::RD_TRACE;
push @item, $_tok;
Parse::RecDescent::_trace(q{>>Matched production: [/[*]/]<<},
Parse::RecDescent::_tracefirst($text),
q{modifier},
$tracelevel)
if defined $::RD_TRACE;
$_matched = 1;
last;
}
unless ( $_matched || defined($return) || defined($score) )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -