| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Module Parse::Yapp::Driver | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This module is part of the Parse::Yapp package available on your | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # nearest CPAN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Any use of this module in a standalone parser make the included | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # text under the same copyright as the Parse::Yapp module itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # This notice should remain unchanged. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # (see the pod text in Parse::Yapp module for use and distribution rights) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | package Parse::Yapp::Driver; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | require 5.004; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 9 | ▶ | use vars qw ( $VERSION $COMPATIBLE $FILENAME ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 9 | $VERSION = '1.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 9 | $COMPATIBLE = '0.07'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 9 | $FILENAME=__FILE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #Known parameters, all starting with YY (leading YY will be discarded) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | #Mandatory parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | my(@params)=('LEX','RULES','STATES'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 9 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 9 | my($class)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 9 | my($errst,$nberr,$token,$value,$check,$dotpos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 9 | my($self)={ ERROR => \&_Error, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ERRST => \$errst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | NBERR => \$nberr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | TOKEN => \$token, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | VALUE => \$value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | DOTPOS => \$dotpos, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | STACK => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | DEBUG => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | CHECK => \$check }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 9 | _CheckParams( [], \%params, \@_, $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | exists($$self{VERSION}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 9 | ▶ | and $$self{VERSION} < $COMPATIBLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"VERSION"} and $self->{"VERSION"} < $Parse::Yapp::Driver::COMPATIBLE
MC/DC0%0/2
exists $self->{"VERSION"} and $self->{"VERSION"} < $Parse::Yapp::Driver::COMPATIBLE
exists $self->{"VERSION"}
$self->{"VERSION"} < $Parse::Yapp::Driver::COMPATIBLE
Truth table33%1/3
A and B
A= exists $self->{"VERSION"}B= $self->{"VERSION"} < $Parse::Yapp::Driver::COMPATIBLE
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | and croak "Yapp driver version $VERSION ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | "incompatible with version $$self{VERSION}:\n". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | "Please recompile parser module."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ▶ | ref($class) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | and $class=ref($class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | bless($self,$class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub YYParse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYParse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my($retval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | _CheckParams( \@params, \%params, \@_, $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if($$self{DEBUG}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | _DBLoad(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $retval = eval '$self->_DBParse()';#Do not create stab entry on compile | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | $@ and die $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $retval = $self->_Parse(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $retval | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub YYData { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYData: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | exists($$self{USER}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | or $$self{USER}={}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $$self{USER}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub YYErrok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYErrok: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ${$$self{ERRST}}=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub YYNberr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYNberr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ${$$self{NBERR}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub YYRecovering { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYRecovering: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ${$$self{ERRST}} != 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub YYAbort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYAbort: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ${$$self{CHECK}}='ABORT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub YYAccept { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYAccept: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ${$$self{CHECK}}='ACCEPT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub YYError { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYError: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ${$$self{CHECK}}='ERROR'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub YYSemval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYSemval: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my($index)= $_[0] - ${$$self{DOTPOS}} - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | $index < 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | and -$index <= @{$$self{STACK}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | and return $$self{STACK}[$index][1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$index < 0 and -$index <= @{$self->{"STACK"};}
MC/DC0%0/2
$index < 0 and -$index <= @{$self->{"STACK"};}
$index < 0
-$index <= @{$self->{"STACK"};}
Truth table0%0/3
A and B
A= $index < 0B= -$index <= @{$self->{"STACK"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | undef; #Invalid index | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub YYCurtok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYCurtok: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | and ${$$self{TOKEN}}=$_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ${$$self{TOKEN}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub YYCurval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYCurval: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | and ${$$self{VALUE}}=$_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ${$$self{VALUE}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub YYExpect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYExpect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub YYLexer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
YYLexer: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $$self{LEX}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ################# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # Private stuff # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | ################# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 9 | ▶ | sub _CheckParams { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_CheckParams: called CC=6 SCAR=19.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 9 | my($mandatory,$checklist,$inarray,$outhash)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 9 | my($prm,$value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 9 | my($prmlst)={}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 9 | ▶ | while(($prm,$value)=splice(@$inarray,0,2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 27 | $prm=uc($prm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 27 | ▶ | exists($$checklist{$prm}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | or croak("Unknow parameter '$prm'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 27 | ▶ | ref($value) eq $$checklist{$prm} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | or croak("Invalid value for parameter '$prm'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 27 | $prm=unpack('@2A*',$prm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 27 | $$outhash{$prm}=$value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 9 | for (@$mandatory) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | exists($$outhash{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | or croak("Missing mandatory parameter '".lc($_)."'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | sub _Error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | print "Parse error.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub _DBLoad { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_DBLoad: not called CC=5 SCAR=30.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | and return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my($fname)=__FILE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my(@drv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | while(<DRV>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | s/^#DBG>//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | push(@drv,$_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | close(DRV); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $drv[0]=~s/_P/_DBP/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | eval join('',@drv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | #Note that for loading debugging version of the driver, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | #this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | #So, DO NOT remove comment at end of sub !!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub _Parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Parse: not called CC=27 SCAR=66.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my($self)=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | my($rules,$states,$lex,$error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | #DBG> my($debug)=$$self{DEBUG}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | #DBG> my($dbgerror)=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | #DBG> my($ShowCurToken) = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | #DBG> my($tok)='>'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | #DBG> for (split('',$$token)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | #DBG> $tok.= (ord($_) < 32 or ord($_) > 126) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | #DBG> ? sprintf('<%02X>',ord($_)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | #DBG> : $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | #DBG> } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | #DBG> $tok.='<'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | #DBG> }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $$errstatus=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $$nberror=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ($$token,$$value)=(undef,undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | @$stack=( [ 0, undef ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $$check=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my($actions,$act,$stateno); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $stateno=$$stack[-1][0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $actions=$$states[$stateno]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | #DBG> print STDERR ('-' x 40),"\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | #DBG> $debug & 0x2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | #DBG> and print STDERR "In state $stateno:\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | #DBG> $debug & 0x08 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | #DBG> and print STDERR "Stack:[". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | #DBG> join(',',map { $$_[0] } @$stack). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | #DBG> "]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if (exists($$actions{ACTIONS})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | defined($$token) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ($$token,$$value)=&$lex($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | #DBG> $debug & 0x01 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | #DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | $act= exists($$actions{ACTIONS}{$$token}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ? $$actions{ACTIONS}{$$token} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | : exists($$actions{DEFAULT}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | ? $$actions{DEFAULT} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $act=$$actions{DEFAULT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | #DBG> $debug & 0x01 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | #DBG> and print STDERR "Don't need token.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | defined($act) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $act > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | and do { #shift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | #DBG> and print STDERR "Shift and go to state $act.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | $$errstatus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | --$$errstatus; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | #DBG> and $dbgerror | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | #DBG> and $$errstatus == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | #DBG> and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | #DBG> print STDERR "**End of Error recovery.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | #DBG> $dbgerror=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | #DBG> }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | push(@$stack,[ $act, $$value ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $$token ne '' #Don't eat the eof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | and $$token=$$value=undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | #reduce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my($lhs,$len,$code,@sempar,$semval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ($lhs,$len,$code)=@{$$rules[-$act]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | #DBG> and $act | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | #DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | $act | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | or $self->YYAccept(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $$dotpos=$len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | unpack('A1',$lhs) eq '@' #In line rule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $lhs =~ /^\@[0-9]+\-([0-9]+)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | or die "In line rule name '$lhs' ill formed: ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | "report it as a BUG.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $$dotpos = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | @sempar = $$dotpos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | $semval = $code ? &$code( $self, @sempar ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | : @sempar ? $sempar[0] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | splice(@$stack,-$len,$len); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | $$check eq 'ACCEPT' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | #DBG> and print STDERR "Accept.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return($semval); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | $$check eq 'ABORT' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | #DBG> and print STDERR "Abort.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | #DBG> and print STDERR "Back to state $$stack[-1][0], then "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | $$check eq 'ERROR' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | #DBG> and print STDERR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | #DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | #DBG> and $dbgerror | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | #DBG> and $$errstatus == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | #DBG> and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | #DBG> print STDERR "**End of Error recovery.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | #DBG> $dbgerror=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | #DBG> }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | push(@$stack, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $$check=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | #DBG> $debug & 0x04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | #DBG> and print STDERR "Forced Error recovery.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $$check=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | #Error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | $$errstatus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | $$errstatus = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | &$error($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | $$errstatus # if 0, then YYErrok has been called | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | or next; # so continue parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | #DBG> and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | #DBG> print STDERR "**Entering Error recovery.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | #DBG> ++$dbgerror; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | #DBG> }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ++$$nberror; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | $$errstatus == 3 #The next token is not valid: discard it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | $$token eq '' # End of input: no hope | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | #DBG> and print STDERR "**At eof: aborting.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | #DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $$token=$$value=undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $$errstatus=3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | while( @$stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
@$stack and !(exists $$states[$stack->[-1][0]]{"ACTIONS"} && exists $$states[$stack->[-1][0]]{"ACTIONS"}{"error"}) || $$states[$stack->[-1][0]]{"ACTIONS"}{"error"} <= 0
not exists $$states[$stack->[-1][0]]{"ACTIONS"} && exists $$states[$stack->[-1][0]]{"ACTIONS"}{"error"} or $$states[$stack->[-1][0]]{"ACTIONS"}{"error"} <= 0
exists $$states[$stack->[-1][0]]{'ACTIONS'} && exists $$states[$stack->[-1][0]]{'ACTIONS'}{'error'}
MC/DC0%0/4
@$stack and !(exists $$states[$stack->[-1][0]]{"ACTIONS"} && exists $$states[$stack->[-1][0]]{"ACTIONS"}{"error"}) || $$states[$stack->[-1][0]]{"ACTIONS"}{"error"} <= 0
@$stack
exists $$states[$stack->[-1][0]]{'ACTIONS'}
exists $$states[$stack->[-1][0]]{'ACTIONS'}{'error'}
$$states[$stack->[-1][0]]{"ACTIONS"}{"error"} <= 0
Truth table0%0/5
A and not(B && C) or D
A= @$stackB= exists $$states[$stack->[-1][0]]{'ACTIONS'}C= exists $$states[$stack->[-1][0]]{'ACTIONS'}{'error'}D= $$states[$stack->[-1][0]]{"ACTIONS"}{"error"} <= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | and ( not exists($$states[$$stack[-1][0]]{ACTIONS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | or not exists($$states[$$stack[-1][0]]{ACTIONS}{error}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | #DBG> and print STDERR "**Pop state $$stack[-1][0].\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | pop(@$stack); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | @$stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | #DBG> and print STDERR "**No state left on stack: aborting.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | return(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | #shift the error token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | #DBG> $debug & 0x10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | #DBG> and print STDERR "**Shift \$error token and go to state ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | #DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | #DBG> ".\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | #never reached | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | croak("Error in driver logic. Please, report it as a BUG"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | }#_Parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | #DO NOT remove comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||