| 1 |
#!perl |
| 2 |
# Copyright 2022 Jeffrey Kegler |
| 3 |
# This file is part of Marpa::R2. Marpa::R2 is free software: you can |
| 4 |
# redistribute it and/or modify it under the terms of the GNU Lesser |
| 5 |
# General Public License as published by the Free Software Foundation, |
| 6 |
# either version 3 of the License, or (at your option) any later version. |
| 7 |
# |
| 8 |
# Marpa::R2 is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
# Lesser General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU Lesser |
| 14 |
# General Public License along with Marpa::R2. If not, see |
| 15 |
# http://www.gnu.org/licenses/. |
| 16 |
# An ambiguous equation |
| 17 |
|
| 18 |
use 5.010001; |
| 19 |
use strict; |
| 20 |
use warnings; |
| 21 |
|
| 22 |
use Test::More tests => 7; |
| 23 |
|
| 24 |
use lib 'inc'; |
| 25 |
use Marpa::R2::Test; |
| 26 |
|
| 27 |
use Data::Dumper; |
| 28 |
use English qw( -no_match_vars ); |
| 29 |
use Fatal qw( close open ); |
| 30 |
use Marpa::R2; |
| 31 |
|
| 32 |
# Regression test for bug originally found and documented |
| 33 |
# by Tomas Jirotka |
| 34 |
|
| 35 |
## INPUT DATA |
| 36 |
my $tokens = [ |
| 37 |
[ 'CREATE', 'Create' ], |
| 38 |
[ 'METRIC', 'Metric' ], |
| 39 |
[ 'ID_METRIC', 'm' ], |
| 40 |
[ 'AS', 'As' ], |
| 41 |
[ 'SELECT', 'Select' ], |
| 42 |
[ 'NUMBER', 1 ], |
| 43 |
[ 'WHERE', 'Where' ], |
| 44 |
[ 'TRUE', 'True' ], |
| 45 |
]; |
| 46 |
|
| 47 |
my @terminals = |
| 48 |
qw/AS BY CREATE FALSE FOR METRIC PF SELECT TRUE WHERE WITH ID_METRIC SEPARATOR NUMBER/; |
| 49 |
my $grammar = Marpa::R2::Grammar->new( |
| 50 |
{ start => 'Input', |
| 51 |
action_object => 'Maql_Actions', |
| 52 |
default_action => 'tisk', |
| 53 |
default_empty_action => '::undef', |
| 54 |
terminals => \@terminals, |
| 55 |
rules => [ |
| 56 |
{ lhs => 'Input', |
| 57 |
rhs => ['Statement'], |
| 58 |
min => 1, |
| 59 |
separator => 'SEPARATOR' |
| 60 |
}, |
| 61 |
{ lhs => 'Statement', |
| 62 |
rhs => [qw/CREATE TypeDef/], |
| 63 |
}, |
| 64 |
{ lhs => 'TypeDef', |
| 65 |
rhs => [qw/METRIC ID_METRIC AS MetricSelect/], |
| 66 |
}, |
| 67 |
{ lhs => 'MetricSelect', |
| 68 |
rhs => [qw/SELECT MetricExpr ByClause Match Filter WithPf/], |
| 69 |
}, |
| 70 |
{ lhs => 'MetricExpr', |
| 71 |
rhs => [qw/NUMBER/], |
| 72 |
}, |
| 73 |
############################################################################## |
| 74 |
{ lhs => 'ByClause', |
| 75 |
rhs => [], |
| 76 |
}, |
| 77 |
{ lhs => 'ByClause', |
| 78 |
rhs => [qw/BY/], |
| 79 |
}, |
| 80 |
############################################################################## |
| 81 |
{ lhs => 'Match', |
| 82 |
rhs => [], |
| 83 |
}, |
| 84 |
{ lhs => 'Match', |
| 85 |
rhs => [qw/FOR/], |
| 86 |
}, |
| 87 |
############################################################################# |
| 88 |
{ lhs => 'Filter', |
| 89 |
rhs => [], |
| 90 |
}, |
| 91 |
{ lhs => 'Filter', |
| 92 |
rhs => [qw/WHERE FilterExpr/], |
| 93 |
}, |
| 94 |
{ lhs => 'FilterExpr', |
| 95 |
rhs => [qw/TRUE/], |
| 96 |
}, |
| 97 |
{ lhs => 'FilterExpr', |
| 98 |
rhs => [qw/FALSE/], |
| 99 |
}, |
| 100 |
############################################################################### |
| 101 |
{ lhs => 'WithPf', |
| 102 |
rhs => [], |
| 103 |
}, |
| 104 |
{ lhs => 'WithPf', |
| 105 |
rhs => [qw/WITH PF/], |
| 106 |
}, |
| 107 |
############################################################################### |
| 108 |
], |
| 109 |
} |
| 110 |
); |
| 111 |
|
| 112 |
$grammar->precompute(); |
| 113 |
|
| 114 |
Marpa::R2::Test::is( |
| 115 |
$grammar->show_symbols(), |
| 116 |
<<'END_OF_SYMBOLS', 'Symbols' ); |
| 117 |
0: AS, terminal |
| 118 |
1: BY, terminal |
| 119 |
2: CREATE, terminal |
| 120 |
3: FALSE, terminal |
| 121 |
4: FOR, terminal |
| 122 |
5: METRIC, terminal |
| 123 |
6: PF, terminal |
| 124 |
7: SELECT, terminal |
| 125 |
8: TRUE, terminal |
| 126 |
9: WHERE, terminal |
| 127 |
10: WITH, terminal |
| 128 |
11: ID_METRIC, terminal |
| 129 |
12: SEPARATOR, terminal |
| 130 |
13: NUMBER, terminal |
| 131 |
14: Input |
| 132 |
15: Statement |
| 133 |
16: TypeDef |
| 134 |
17: MetricSelect |
| 135 |
18: MetricExpr |
| 136 |
19: ByClause |
| 137 |
20: Match |
| 138 |
21: Filter |
| 139 |
22: WithPf |
| 140 |
23: FilterExpr |
| 141 |
END_OF_SYMBOLS |
| 142 |
|
| 143 |
Marpa::R2::Test::is( $grammar->show_rules(), |
| 144 |
<<'END_OF_RULES', 'Rules' ); |
| 145 |
0: Input -> Statement+ /* discard_sep */ |
| 146 |
1: Statement -> CREATE TypeDef |
| 147 |
2: TypeDef -> METRIC ID_METRIC AS MetricSelect |
| 148 |
3: MetricSelect -> SELECT MetricExpr ByClause Match Filter WithPf |
| 149 |
4: MetricExpr -> NUMBER |
| 150 |
5: ByClause -> /* empty !used */ |
| 151 |
6: ByClause -> BY |
| 152 |
7: Match -> /* empty !used */ |
| 153 |
8: Match -> FOR |
| 154 |
9: Filter -> /* empty !used */ |
| 155 |
10: Filter -> WHERE FilterExpr |
| 156 |
11: FilterExpr -> TRUE |
| 157 |
12: FilterExpr -> FALSE |
| 158 |
13: WithPf -> /* empty !used */ |
| 159 |
14: WithPf -> WITH PF |
| 160 |
END_OF_RULES |
| 161 |
|
| 162 |
Marpa::R2::Test::is( $grammar->show_ahms(), |
| 163 |
<<'END_OF_AHMS', 'AHMs' ); |
| 164 |
AHM 0: postdot = "Input[Seq]" |
| 165 |
Input ::= . Input[Seq] |
| 166 |
AHM 1: completion |
| 167 |
Input ::= Input[Seq] . |
| 168 |
AHM 2: postdot = "Input[Seq]" |
| 169 |
Input ::= . Input[Seq] SEPARATOR |
| 170 |
AHM 3: postdot = "SEPARATOR" |
| 171 |
Input ::= Input[Seq] . SEPARATOR |
| 172 |
AHM 4: completion |
| 173 |
Input ::= Input[Seq] SEPARATOR . |
| 174 |
AHM 5: postdot = "Statement" |
| 175 |
Input[Seq] ::= . Statement |
| 176 |
AHM 6: completion |
| 177 |
Input[Seq] ::= Statement . |
| 178 |
AHM 7: postdot = "Input[Seq]" |
| 179 |
Input[Seq] ::= . Input[Seq] SEPARATOR Statement |
| 180 |
AHM 8: postdot = "SEPARATOR" |
| 181 |
Input[Seq] ::= Input[Seq] . SEPARATOR Statement |
| 182 |
AHM 9: postdot = "Statement" |
| 183 |
Input[Seq] ::= Input[Seq] SEPARATOR . Statement |
| 184 |
AHM 10: completion |
| 185 |
Input[Seq] ::= Input[Seq] SEPARATOR Statement . |
| 186 |
AHM 11: postdot = "CREATE" |
| 187 |
Statement ::= . CREATE TypeDef |
| 188 |
AHM 12: postdot = "TypeDef" |
| 189 |
Statement ::= CREATE . TypeDef |
| 190 |
AHM 13: completion |
| 191 |
Statement ::= CREATE TypeDef . |
| 192 |
AHM 14: postdot = "METRIC" |
| 193 |
TypeDef ::= . METRIC ID_METRIC AS MetricSelect |
| 194 |
AHM 15: postdot = "ID_METRIC" |
| 195 |
TypeDef ::= METRIC . ID_METRIC AS MetricSelect |
| 196 |
AHM 16: postdot = "AS" |
| 197 |
TypeDef ::= METRIC ID_METRIC . AS MetricSelect |
| 198 |
AHM 17: postdot = "MetricSelect" |
| 199 |
TypeDef ::= METRIC ID_METRIC AS . MetricSelect |
| 200 |
AHM 18: completion |
| 201 |
TypeDef ::= METRIC ID_METRIC AS MetricSelect . |
| 202 |
AHM 19: postdot = "SELECT" |
| 203 |
MetricSelect ::= . SELECT MetricExpr ByClause MetricSelect[R3:3] |
| 204 |
AHM 20: postdot = "MetricExpr" |
| 205 |
MetricSelect ::= SELECT . MetricExpr ByClause MetricSelect[R3:3] |
| 206 |
AHM 21: postdot = "ByClause" |
| 207 |
MetricSelect ::= SELECT MetricExpr . ByClause MetricSelect[R3:3] |
| 208 |
AHM 22: postdot = "MetricSelect[R3:3]" |
| 209 |
MetricSelect ::= SELECT MetricExpr ByClause . MetricSelect[R3:3] |
| 210 |
AHM 23: completion |
| 211 |
MetricSelect ::= SELECT MetricExpr ByClause MetricSelect[R3:3] . |
| 212 |
AHM 24: postdot = "SELECT" |
| 213 |
MetricSelect ::= . SELECT MetricExpr ByClause Match[] Filter[] WithPf[] |
| 214 |
AHM 25: postdot = "MetricExpr" |
| 215 |
MetricSelect ::= SELECT . MetricExpr ByClause Match[] Filter[] WithPf[] |
| 216 |
AHM 26: postdot = "ByClause" |
| 217 |
MetricSelect ::= SELECT MetricExpr . ByClause Match[] Filter[] WithPf[] |
| 218 |
AHM 27: completion |
| 219 |
MetricSelect ::= SELECT MetricExpr ByClause Match[] Filter[] WithPf[] . |
| 220 |
AHM 28: postdot = "SELECT" |
| 221 |
MetricSelect ::= . SELECT MetricExpr ByClause[] MetricSelect[R3:3] |
| 222 |
AHM 29: postdot = "MetricExpr" |
| 223 |
MetricSelect ::= SELECT . MetricExpr ByClause[] MetricSelect[R3:3] |
| 224 |
AHM 30: postdot = "MetricSelect[R3:3]" |
| 225 |
MetricSelect ::= SELECT MetricExpr ByClause[] . MetricSelect[R3:3] |
| 226 |
AHM 31: completion |
| 227 |
MetricSelect ::= SELECT MetricExpr ByClause[] MetricSelect[R3:3] . |
| 228 |
AHM 32: postdot = "SELECT" |
| 229 |
MetricSelect ::= . SELECT MetricExpr ByClause[] Match[] Filter[] WithPf[] |
| 230 |
AHM 33: postdot = "MetricExpr" |
| 231 |
MetricSelect ::= SELECT . MetricExpr ByClause[] Match[] Filter[] WithPf[] |
| 232 |
AHM 34: completion |
| 233 |
MetricSelect ::= SELECT MetricExpr ByClause[] Match[] Filter[] WithPf[] . |
| 234 |
AHM 35: postdot = "Match" |
| 235 |
MetricSelect[R3:3] ::= . Match MetricSelect[R3:4] |
| 236 |
AHM 36: postdot = "MetricSelect[R3:4]" |
| 237 |
MetricSelect[R3:3] ::= Match . MetricSelect[R3:4] |
| 238 |
AHM 37: completion |
| 239 |
MetricSelect[R3:3] ::= Match MetricSelect[R3:4] . |
| 240 |
AHM 38: postdot = "Match" |
| 241 |
MetricSelect[R3:3] ::= . Match Filter[] WithPf[] |
| 242 |
AHM 39: completion |
| 243 |
MetricSelect[R3:3] ::= Match Filter[] WithPf[] . |
| 244 |
AHM 40: postdot = "MetricSelect[R3:4]" |
| 245 |
MetricSelect[R3:3] ::= Match[] . MetricSelect[R3:4] |
| 246 |
AHM 41: completion |
| 247 |
MetricSelect[R3:3] ::= Match[] MetricSelect[R3:4] . |
| 248 |
AHM 42: postdot = "Filter" |
| 249 |
MetricSelect[R3:4] ::= . Filter WithPf |
| 250 |
AHM 43: postdot = "WithPf" |
| 251 |
MetricSelect[R3:4] ::= Filter . WithPf |
| 252 |
AHM 44: completion |
| 253 |
MetricSelect[R3:4] ::= Filter WithPf . |
| 254 |
AHM 45: postdot = "Filter" |
| 255 |
MetricSelect[R3:4] ::= . Filter WithPf[] |
| 256 |
AHM 46: completion |
| 257 |
MetricSelect[R3:4] ::= Filter WithPf[] . |
| 258 |
AHM 47: postdot = "WithPf" |
| 259 |
MetricSelect[R3:4] ::= Filter[] . WithPf |
| 260 |
AHM 48: completion |
| 261 |
MetricSelect[R3:4] ::= Filter[] WithPf . |
| 262 |
AHM 49: postdot = "NUMBER" |
| 263 |
MetricExpr ::= . NUMBER |
| 264 |
AHM 50: completion |
| 265 |
MetricExpr ::= NUMBER . |
| 266 |
AHM 51: postdot = "BY" |
| 267 |
ByClause ::= . BY |
| 268 |
AHM 52: completion |
| 269 |
ByClause ::= BY . |
| 270 |
AHM 53: postdot = "FOR" |
| 271 |
Match ::= . FOR |
| 272 |
AHM 54: completion |
| 273 |
Match ::= FOR . |
| 274 |
AHM 55: postdot = "WHERE" |
| 275 |
Filter ::= . WHERE FilterExpr |
| 276 |
AHM 56: postdot = "FilterExpr" |
| 277 |
Filter ::= WHERE . FilterExpr |
| 278 |
AHM 57: completion |
| 279 |
Filter ::= WHERE FilterExpr . |
| 280 |
AHM 58: postdot = "TRUE" |
| 281 |
FilterExpr ::= . TRUE |
| 282 |
AHM 59: completion |
| 283 |
FilterExpr ::= TRUE . |
| 284 |
AHM 60: postdot = "FALSE" |
| 285 |
FilterExpr ::= . FALSE |
| 286 |
AHM 61: completion |
| 287 |
FilterExpr ::= FALSE . |
| 288 |
AHM 62: postdot = "WITH" |
| 289 |
WithPf ::= . WITH PF |
| 290 |
AHM 63: postdot = "PF" |
| 291 |
WithPf ::= WITH . PF |
| 292 |
AHM 64: completion |
| 293 |
WithPf ::= WITH PF . |
| 294 |
AHM 65: postdot = "Input" |
| 295 |
Input['] ::= . Input |
| 296 |
AHM 66: completion |
| 297 |
Input['] ::= Input . |
| 298 |
END_OF_AHMS |
| 299 |
|
| 300 |
my $recog = Marpa::R2::Recognizer->new( { grammar => $grammar } ); |
| 301 |
for my $token ( @{$tokens} ) { $recog->read( @{$token} ); } |
| 302 |
my @result = $recog->value(); |
| 303 |
|
| 304 |
Marpa::R2::Test::is( $recog->show_earley_sets(), |
| 305 |
<<'END_OF_EARLEY_SETS', 'Earley Sets' ); |
| 306 |
Last Completed: 8; Furthest: 8 |
| 307 |
Earley Set 0 |
| 308 |
ahm65: R23:0@0-0 |
| 309 |
R23:0: Input['] ::= . Input |
| 310 |
ahm0: R0:0@0-0 |
| 311 |
R0:0: Input ::= . Input[Seq] |
| 312 |
ahm2: R1:0@0-0 |
| 313 |
R1:0: Input ::= . Input[Seq] SEPARATOR |
| 314 |
ahm5: R2:0@0-0 |
| 315 |
R2:0: Input[Seq] ::= . Statement |
| 316 |
ahm7: R3:0@0-0 |
| 317 |
R3:0: Input[Seq] ::= . Input[Seq] SEPARATOR Statement |
| 318 |
ahm11: R4:0@0-0 |
| 319 |
R4:0: Statement ::= . CREATE TypeDef |
| 320 |
Earley Set 1 |
| 321 |
ahm12: R4:1@0-1 |
| 322 |
R4:1: Statement ::= CREATE . TypeDef |
| 323 |
[c=R4:0@0-0; s=CREATE; t=\'Create'] |
| 324 |
ahm14: R5:0@1-1 |
| 325 |
R5:0: TypeDef ::= . METRIC ID_METRIC AS MetricSelect |
| 326 |
Earley Set 2 |
| 327 |
ahm15: R5:1@1-2 |
| 328 |
R5:1: TypeDef ::= METRIC . ID_METRIC AS MetricSelect |
| 329 |
[c=R5:0@1-1; s=METRIC; t=\'Metric'] |
| 330 |
Earley Set 3 |
| 331 |
ahm16: R5:2@1-3 |
| 332 |
R5:2: TypeDef ::= METRIC ID_METRIC . AS MetricSelect |
| 333 |
[c=R5:1@1-2; s=ID_METRIC; t=\'m'] |
| 334 |
Earley Set 4 |
| 335 |
ahm17: R5:3@1-4 |
| 336 |
R5:3: TypeDef ::= METRIC ID_METRIC AS . MetricSelect |
| 337 |
[c=R5:2@1-3; s=AS; t=\'As'] |
| 338 |
ahm19: R6:0@4-4 |
| 339 |
R6:0: MetricSelect ::= . SELECT MetricExpr ByClause MetricSelect[R3:3] |
| 340 |
ahm24: R7:0@4-4 |
| 341 |
R7:0: MetricSelect ::= . SELECT MetricExpr ByClause Match[] Filter[] WithPf[] |
| 342 |
ahm28: R8:0@4-4 |
| 343 |
R8:0: MetricSelect ::= . SELECT MetricExpr ByClause[] MetricSelect[R3:3] |
| 344 |
ahm32: R9:0@4-4 |
| 345 |
R9:0: MetricSelect ::= . SELECT MetricExpr ByClause[] Match[] Filter[] WithPf[] |
| 346 |
Earley Set 5 |
| 347 |
ahm33: R9:1@4-5 |
| 348 |
R9:1: MetricSelect ::= SELECT . MetricExpr ByClause[] Match[] Filter[] WithPf[] |
| 349 |
[c=R9:0@4-4; s=SELECT; t=\'Select'] |
| 350 |
ahm29: R8:1@4-5 |
| 351 |
R8:1: MetricSelect ::= SELECT . MetricExpr ByClause[] MetricSelect[R3:3] |
| 352 |
[c=R8:0@4-4; s=SELECT; t=\'Select'] |
| 353 |
ahm25: R7:1@4-5 |
| 354 |
R7:1: MetricSelect ::= SELECT . MetricExpr ByClause Match[] Filter[] WithPf[] |
| 355 |
[c=R7:0@4-4; s=SELECT; t=\'Select'] |
| 356 |
ahm20: R6:1@4-5 |
| 357 |
R6:1: MetricSelect ::= SELECT . MetricExpr ByClause MetricSelect[R3:3] |
| 358 |
[c=R6:0@4-4; s=SELECT; t=\'Select'] |
| 359 |
ahm49: R16:0@5-5 |
| 360 |
R16:0: MetricExpr ::= . NUMBER |
| 361 |
Earley Set 6 |
| 362 |
ahm50: R16$@5-6 |
| 363 |
R16$: MetricExpr ::= NUMBER . |
| 364 |
[c=R16:0@5-5; s=NUMBER; t=\1] |
| 365 |
ahm21: R6:2@4-6 |
| 366 |
R6:2: MetricSelect ::= SELECT MetricExpr . ByClause MetricSelect[R3:3] |
| 367 |
[p=R6:1@4-5; c=R16$@5-6] |
| 368 |
ahm26: R7:2@4-6 |
| 369 |
R7:2: MetricSelect ::= SELECT MetricExpr . ByClause Match[] Filter[] WithPf[] |
| 370 |
[p=R7:1@4-5; c=R16$@5-6] |
| 371 |
ahm30: R8:3@4-6 |
| 372 |
R8:3: MetricSelect ::= SELECT MetricExpr ByClause[] . MetricSelect[R3:3] |
| 373 |
[p=R8:1@4-5; c=R16$@5-6] |
| 374 |
ahm34: R9$@4-6 |
| 375 |
R9$: MetricSelect ::= SELECT MetricExpr ByClause[] Match[] Filter[] WithPf[] . |
| 376 |
[p=R9:1@4-5; c=R16$@5-6] |
| 377 |
ahm18: R5$@1-6 |
| 378 |
R5$: TypeDef ::= METRIC ID_METRIC AS MetricSelect . |
| 379 |
[p=R5:3@1-4; c=R9$@4-6] |
| 380 |
ahm13: R4$@0-6 |
| 381 |
R4$: Statement ::= CREATE TypeDef . |
| 382 |
[p=R4:1@0-1; c=R5$@1-6] |
| 383 |
ahm6: R2$@0-6 |
| 384 |
R2$: Input[Seq] ::= Statement . |
| 385 |
[p=R2:0@0-0; c=R4$@0-6] |
| 386 |
ahm8: R3:1@0-6 |
| 387 |
R3:1: Input[Seq] ::= Input[Seq] . SEPARATOR Statement |
| 388 |
[p=R3:0@0-0; c=R2$@0-6] |
| 389 |
ahm3: R1:1@0-6 |
| 390 |
R1:1: Input ::= Input[Seq] . SEPARATOR |
| 391 |
[p=R1:0@0-0; c=R2$@0-6] |
| 392 |
ahm1: R0$@0-6 |
| 393 |
R0$: Input ::= Input[Seq] . |
| 394 |
[p=R0:0@0-0; c=R2$@0-6] |
| 395 |
ahm66: R23$@0-6 |
| 396 |
R23$: Input['] ::= Input . |
| 397 |
[p=R23:0@0-0; c=R0$@0-6] |
| 398 |
ahm51: R17:0@6-6 |
| 399 |
R17:0: ByClause ::= . BY |
| 400 |
ahm35: R10:0@6-6 |
| 401 |
R10:0: MetricSelect[R3:3] ::= . Match MetricSelect[R3:4] |
| 402 |
ahm38: R11:0@6-6 |
| 403 |
R11:0: MetricSelect[R3:3] ::= . Match Filter[] WithPf[] |
| 404 |
ahm40: R12:1@6-6 |
| 405 |
R12:1: MetricSelect[R3:3] ::= Match[] . MetricSelect[R3:4] |
| 406 |
ahm42: R13:0@6-6 |
| 407 |
R13:0: MetricSelect[R3:4] ::= . Filter WithPf |
| 408 |
ahm45: R14:0@6-6 |
| 409 |
R14:0: MetricSelect[R3:4] ::= . Filter WithPf[] |
| 410 |
ahm47: R15:1@6-6 |
| 411 |
R15:1: MetricSelect[R3:4] ::= Filter[] . WithPf |
| 412 |
ahm53: R18:0@6-6 |
| 413 |
R18:0: Match ::= . FOR |
| 414 |
ahm55: R19:0@6-6 |
| 415 |
R19:0: Filter ::= . WHERE FilterExpr |
| 416 |
ahm62: R22:0@6-6 |
| 417 |
R22:0: WithPf ::= . WITH PF |
| 418 |
Earley Set 7 |
| 419 |
ahm56: R19:1@6-7 |
| 420 |
R19:1: Filter ::= WHERE . FilterExpr |
| 421 |
[c=R19:0@6-6; s=WHERE; t=\'Where'] |
| 422 |
ahm58: R20:0@7-7 |
| 423 |
R20:0: FilterExpr ::= . TRUE |
| 424 |
ahm60: R21:0@7-7 |
| 425 |
R21:0: FilterExpr ::= . FALSE |
| 426 |
Earley Set 8 |
| 427 |
ahm59: R20$@7-8 |
| 428 |
R20$: FilterExpr ::= TRUE . |
| 429 |
[c=R20:0@7-7; s=TRUE; t=\'True'] |
| 430 |
ahm57: R19$@6-8 |
| 431 |
R19$: Filter ::= WHERE FilterExpr . |
| 432 |
[p=R19:1@6-7; c=R20$@7-8] |
| 433 |
ahm46: R14$@6-8 |
| 434 |
R14$: MetricSelect[R3:4] ::= Filter WithPf[] . |
| 435 |
[p=R14:0@6-6; c=R19$@6-8] |
| 436 |
ahm43: R13:1@6-8 |
| 437 |
R13:1: MetricSelect[R3:4] ::= Filter . WithPf |
| 438 |
[p=R13:0@6-6; c=R19$@6-8] |
| 439 |
ahm41: R12$@6-8 |
| 440 |
R12$: MetricSelect[R3:3] ::= Match[] MetricSelect[R3:4] . |
| 441 |
[p=R12:1@6-6; c=R14$@6-8] |
| 442 |
ahm31: R8$@4-8 |
| 443 |
R8$: MetricSelect ::= SELECT MetricExpr ByClause[] MetricSelect[R3:3] . |
| 444 |
[p=R8:3@4-6; c=R12$@6-8] |
| 445 |
ahm18: R5$@1-8 |
| 446 |
R5$: TypeDef ::= METRIC ID_METRIC AS MetricSelect . |
| 447 |
[p=R5:3@1-4; c=R8$@4-8] |
| 448 |
ahm13: R4$@0-8 |
| 449 |
R4$: Statement ::= CREATE TypeDef . |
| 450 |
[p=R4:1@0-1; c=R5$@1-8] |
| 451 |
ahm6: R2$@0-8 |
| 452 |
R2$: Input[Seq] ::= Statement . |
| 453 |
[p=R2:0@0-0; c=R4$@0-8] |
| 454 |
ahm8: R3:1@0-8 |
| 455 |
R3:1: Input[Seq] ::= Input[Seq] . SEPARATOR Statement |
| 456 |
[p=R3:0@0-0; c=R2$@0-8] |
| 457 |
ahm3: R1:1@0-8 |
| 458 |
R1:1: Input ::= Input[Seq] . SEPARATOR |
| 459 |
[p=R1:0@0-0; c=R2$@0-8] |
| 460 |
ahm1: R0$@0-8 |
| 461 |
R0$: Input ::= Input[Seq] . |
| 462 |
[p=R0:0@0-0; c=R2$@0-8] |
| 463 |
ahm66: R23$@0-8 |
| 464 |
R23$: Input['] ::= Input . |
| 465 |
[p=R23:0@0-0; c=R0$@0-8] |
| 466 |
ahm62: R22:0@8-8 |
| 467 |
R22:0: WithPf ::= . WITH PF |
| 468 |
END_OF_EARLEY_SETS |
| 469 |
|
| 470 |
Marpa::R2::Test::is( $recog->show_and_nodes(), |
| 471 |
<<'END_OF_AND_NODES', 'And Nodes' ); |
| 472 |
And-node #0: R4:1@0-1S2@0 |
| 473 |
And-node #1: R5:1@1-2S5@1 |
| 474 |
And-node #2: R5:2@1-3S11@2 |
| 475 |
And-node #3: R5:3@1-4S0@3 |
| 476 |
And-node #4: R8:1@4-5S7@4 |
| 477 |
And-node #5: R16:1@5-6S13@5 |
| 478 |
And-node #6: R8:2@4-6C16@5 |
| 479 |
And-node #7: R8:3@4-6S20@6 |
| 480 |
And-node #8: R12:1@6-6S22@6 |
| 481 |
And-node #9: R19:1@6-7S9@6 |
| 482 |
And-node #10: R20:1@7-8S8@7 |
| 483 |
And-node #11: R19:2@6-8C20@7 |
| 484 |
And-node #12: R14:1@6-8C19@6 |
| 485 |
And-node #13: R14:2@6-8S26@8 |
| 486 |
And-node #14: R12:2@6-8C14@6 |
| 487 |
And-node #15: R8:4@4-8C12@6 |
| 488 |
And-node #16: R5:4@1-8C8@4 |
| 489 |
And-node #17: R4:2@0-8C5@1 |
| 490 |
And-node #18: R2:1@0-8C4@0 |
| 491 |
And-node #19: R0:1@0-8C2@0 |
| 492 |
And-node #20: R23:1@0-8C0@0 |
| 493 |
END_OF_AND_NODES |
| 494 |
|
| 495 |
Marpa::R2::Test::is( $recog->show_or_nodes(), |
| 496 |
<<'END_OF_OR_NODES', 'Or Nodes' ); |
| 497 |
R4:1@0-1 |
| 498 |
R0:1@0-8 |
| 499 |
R2:1@0-8 |
| 500 |
R4:2@0-8 |
| 501 |
R23:1@0-8 |
| 502 |
R5:1@1-2 |
| 503 |
R5:2@1-3 |
| 504 |
R5:3@1-4 |
| 505 |
R5:4@1-8 |
| 506 |
R8:1@4-5 |
| 507 |
R8:2@4-6 |
| 508 |
R8:3@4-6 |
| 509 |
R8:4@4-8 |
| 510 |
R16:1@5-6 |
| 511 |
R12:1@6-6 |
| 512 |
R19:1@6-7 |
| 513 |
R12:2@6-8 |
| 514 |
R14:1@6-8 |
| 515 |
R14:2@6-8 |
| 516 |
R19:2@6-8 |
| 517 |
R20:1@7-8 |
| 518 |
END_OF_OR_NODES |
| 519 |
|
| 520 |
Marpa::R2::Test::is( Dumper( \@result ), <<'END_OF_STRING', 'Result' ); |
| 521 |
$VAR1 = [ |
| 522 |
\[ |
| 523 |
[ |
| 524 |
'Create', |
| 525 |
[ |
| 526 |
'Metric', |
| 527 |
'm', |
| 528 |
'As', |
| 529 |
[ |
| 530 |
'Select', |
| 531 |
[ |
| 532 |
1 |
| 533 |
], |
| 534 |
undef, |
| 535 |
undef, |
| 536 |
[ |
| 537 |
'Where', |
| 538 |
[ |
| 539 |
'True' |
| 540 |
] |
| 541 |
], |
| 542 |
undef |
| 543 |
] |
| 544 |
] |
| 545 |
] |
| 546 |
] |
| 547 |
]; |
| 548 |
END_OF_STRING |
| 549 |
|
| 550 |
############################################################################# |
| 551 |
package Maql_Actions; |
| 552 |
|
| 553 |
sub new { } |
| 554 |
|
| 555 |
sub tisk { shift; return \@_; } |
| 556 |
|