| 1 | package VIC::Grammar; | ||
| 2 | 33 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 33 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 33 | our $VERSION = '0.29'; | |
| 6 | 33 | $VERSION = eval $VERSION; | |
| 7 | |||
| 8 | 33 | ▶ | use Pegex::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 33 | extends 'Pegex::Grammar'; | |
| 10 | |||
| 11 | 33 | ▶ | use constant file => './share/vic.pgx'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | sub make_tree { # Generated/Inlined by Pegex::Grammar (0.60) | ||
| 14 | { | ||
| 15 | 33 | ▶ | '+grammar' => 'vic', |
|
Subroutine
make_tree: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | '+toprule' => 'program', | ||
| 17 | '+version' => '0.2.7', | ||
| 18 | 'COMMA' => { | ||
| 19 | '.rgx' => qr/\G,/ | ||
| 20 | }, | ||
| 21 | 'DOLLAR' => { | ||
| 22 | '.rgx' => qr/\G\$/ | ||
| 23 | }, | ||
| 24 | 'EOS' => { | ||
| 25 | '.rgx' => qr/\G\z/ | ||
| 26 | }, | ||
| 27 | '_' => { | ||
| 28 | '.rgx' => qr/\G[\ \t]*\r?\n?/ | ||
| 29 | }, | ||
| 30 | '__' => { | ||
| 31 | '.rgx' => qr/\G[\ \t]+\r?\n?/ | ||
| 32 | }, | ||
| 33 | 'anonymous_block' => { | ||
| 34 | '.all' => [ | ||
| 35 | { | ||
| 36 | '.ref' => 'start_block' | ||
| 37 | }, | ||
| 38 | { | ||
| 39 | '+min' => 0, | ||
| 40 | '.ref' => 'statement' | ||
| 41 | }, | ||
| 42 | { | ||
| 43 | '.ref' => 'end_block' | ||
| 44 | } | ||
| 45 | ] | ||
| 46 | }, | ||
| 47 | 'any_conditional' => { | ||
| 48 | '.any' => [ | ||
| 49 | { | ||
| 50 | '.ref' => 'single_conditional' | ||
| 51 | }, | ||
| 52 | { | ||
| 53 | '.ref' => 'nested_conditional' | ||
| 54 | } | ||
| 55 | ] | ||
| 56 | }, | ||
| 57 | 'array' => { | ||
| 58 | '.all' => [ | ||
| 59 | { | ||
| 60 | '.ref' => 'start_array' | ||
| 61 | }, | ||
| 62 | { | ||
| 63 | '.ref' => '_' | ||
| 64 | }, | ||
| 65 | { | ||
| 66 | '+max' => 1, | ||
| 67 | '.all' => [ | ||
| 68 | { | ||
| 69 | '.ref' => 'array_element_type' | ||
| 70 | }, | ||
| 71 | { | ||
| 72 | '+min' => 0, | ||
| 73 | '-flat' => 1, | ||
| 74 | '.all' => [ | ||
| 75 | { | ||
| 76 | '.ref' => 'list_separator' | ||
| 77 | }, | ||
| 78 | { | ||
| 79 | '.ref' => 'array_element_type' | ||
| 80 | } | ||
| 81 | ] | ||
| 82 | } | ||
| 83 | ] | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | '.ref' => '_' | ||
| 87 | }, | ||
| 88 | { | ||
| 89 | '.ref' => 'end_array' | ||
| 90 | } | ||
| 91 | ] | ||
| 92 | }, | ||
| 93 | 'array_element' => { | ||
| 94 | '.all' => [ | ||
| 95 | { | ||
| 96 | '.ref' => 'variable' | ||
| 97 | }, | ||
| 98 | { | ||
| 99 | '.ref' => 'start_array' | ||
| 100 | }, | ||
| 101 | { | ||
| 102 | '.ref' => 'rhs_expr' | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | '.ref' => 'end_array' | ||
| 106 | } | ||
| 107 | ] | ||
| 108 | }, | ||
| 109 | 'array_element_type' => { | ||
| 110 | '.all' => [ | ||
| 111 | { | ||
| 112 | '.ref' => '_' | ||
| 113 | }, | ||
| 114 | { | ||
| 115 | '.any' => [ | ||
| 116 | { | ||
| 117 | '.ref' => 'number_units' | ||
| 118 | }, | ||
| 119 | { | ||
| 120 | '.ref' => 'real_number' | ||
| 121 | }, | ||
| 122 | { | ||
| 123 | '.ref' => 'number' | ||
| 124 | }, | ||
| 125 | { | ||
| 126 | '.ref' => 'string' | ||
| 127 | } | ||
| 128 | ] | ||
| 129 | }, | ||
| 130 | { | ||
| 131 | '.ref' => '_' | ||
| 132 | } | ||
| 133 | ] | ||
| 134 | }, | ||
| 135 | 'assert_comparison' => { | ||
| 136 | '.all' => [ | ||
| 137 | { | ||
| 138 | '.ref' => 'assert_value' | ||
| 139 | }, | ||
| 140 | { | ||
| 141 | '.ref' => 'compare_operator' | ||
| 142 | }, | ||
| 143 | { | ||
| 144 | '.ref' => 'assert_value' | ||
| 145 | } | ||
| 146 | ] | ||
| 147 | }, | ||
| 148 | 'assert_condition' => { | ||
| 149 | '.ref' => 'assert_comparison' | ||
| 150 | }, | ||
| 151 | 'assert_message' => { | ||
| 152 | '.all' => [ | ||
| 153 | { | ||
| 154 | '.ref' => 'list_separator' | ||
| 155 | }, | ||
| 156 | { | ||
| 157 | '.ref' => '_' | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | '.ref' => 'string' | ||
| 161 | } | ||
| 162 | ] | ||
| 163 | }, | ||
| 164 | 'assert_statement' => { | ||
| 165 | '.all' => [ | ||
| 166 | { | ||
| 167 | '.ref' => 'name' | ||
| 168 | }, | ||
| 169 | { | ||
| 170 | '.ref' => 'assert_condition' | ||
| 171 | }, | ||
| 172 | { | ||
| 173 | '.ref' => '_' | ||
| 174 | }, | ||
| 175 | { | ||
| 176 | '+max' => 1, | ||
| 177 | '.ref' => 'assert_message' | ||
| 178 | }, | ||
| 179 | { | ||
| 180 | '.ref' => '_' | ||
| 181 | }, | ||
| 182 | { | ||
| 183 | '.ref' => 'line_ending' | ||
| 184 | } | ||
| 185 | ] | ||
| 186 | }, | ||
| 187 | 'assert_value' => { | ||
| 188 | '.all' => [ | ||
| 189 | { | ||
| 190 | '.ref' => '_' | ||
| 191 | }, | ||
| 192 | { | ||
| 193 | '.any' => [ | ||
| 194 | { | ||
| 195 | '.ref' => 'validated_variable' | ||
| 196 | }, | ||
| 197 | { | ||
| 198 | '.ref' => 'variable' | ||
| 199 | }, | ||
| 200 | { | ||
| 201 | '.ref' => 'number' | ||
| 202 | } | ||
| 203 | ] | ||
| 204 | }, | ||
| 205 | { | ||
| 206 | '.ref' => '_' | ||
| 207 | } | ||
| 208 | ] | ||
| 209 | }, | ||
| 210 | 'assign_expr' => { | ||
| 211 | '.all' => [ | ||
| 212 | { | ||
| 213 | '.ref' => '_' | ||
| 214 | }, | ||
| 215 | { | ||
| 216 | '.ref' => 'variable' | ||
| 217 | }, | ||
| 218 | { | ||
| 219 | '.ref' => '_' | ||
| 220 | }, | ||
| 221 | { | ||
| 222 | '.ref' => 'assign_operator' | ||
| 223 | }, | ||
| 224 | { | ||
| 225 | '.ref' => '_' | ||
| 226 | }, | ||
| 227 | { | ||
| 228 | '.ref' => 'rhs_expr' | ||
| 229 | } | ||
| 230 | ] | ||
| 231 | }, | ||
| 232 | 'assign_operator' => { | ||
| 233 | '.any' => [ | ||
| 234 | { | ||
| 235 | '.rgx' => qr/\G([\+\-%\^\*\|&\/\.]?=)/ | ||
| 236 | }, | ||
| 237 | { | ||
| 238 | '.ref' => 'shift_assign_operator' | ||
| 239 | } | ||
| 240 | ] | ||
| 241 | }, | ||
| 242 | 'bit_operator' => { | ||
| 243 | '.rgx' => qr/\G([\|\^&])/ | ||
| 244 | }, | ||
| 245 | 'blank_line' => { | ||
| 246 | '.rgx' => qr/\G[\ \t]*\r?\n?\r?\n/ | ||
| 247 | }, | ||
| 248 | 'block' => { | ||
| 249 | '.ref' => 'named_block' | ||
| 250 | }, | ||
| 251 | 'boolean' => { | ||
| 252 | '.rgx' => qr/\G(TRUE|FALSE|true|false|0|1)/ | ||
| 253 | }, | ||
| 254 | 'comment' => { | ||
| 255 | '.any' => [ | ||
| 256 | { | ||
| 257 | '.rgx' => qr/\G[\ \t]*\r?\n?\#.*\r?\n/ | ||
| 258 | }, | ||
| 259 | { | ||
| 260 | '.ref' => 'blank_line' | ||
| 261 | } | ||
| 262 | ] | ||
| 263 | }, | ||
| 264 | 'compare_operator' => { | ||
| 265 | '.rgx' => qr/\G([!=<\>]=|(?:<|\>))/ | ||
| 266 | }, | ||
| 267 | 'comparison' => { | ||
| 268 | '.all' => [ | ||
| 269 | { | ||
| 270 | '.ref' => 'expr_value' | ||
| 271 | }, | ||
| 272 | { | ||
| 273 | '.ref' => 'compare_operator' | ||
| 274 | }, | ||
| 275 | { | ||
| 276 | '.ref' => 'expr_value' | ||
| 277 | } | ||
| 278 | ] | ||
| 279 | }, | ||
| 280 | 'complement' => { | ||
| 281 | '.all' => [ | ||
| 282 | { | ||
| 283 | '.ref' => '_' | ||
| 284 | }, | ||
| 285 | { | ||
| 286 | '.ref' => 'complement_operator' | ||
| 287 | }, | ||
| 288 | { | ||
| 289 | '.ref' => '_' | ||
| 290 | }, | ||
| 291 | { | ||
| 292 | '.ref' => 'rhs_expr' | ||
| 293 | }, | ||
| 294 | { | ||
| 295 | '.ref' => '_' | ||
| 296 | } | ||
| 297 | ] | ||
| 298 | }, | ||
| 299 | 'complement_operator' => { | ||
| 300 | '.rgx' => qr/\G(\~|!)/ | ||
| 301 | }, | ||
| 302 | 'conditional_predicate' => { | ||
| 303 | '.all' => [ | ||
| 304 | { | ||
| 305 | '.ref' => '_' | ||
| 306 | }, | ||
| 307 | { | ||
| 308 | '.ref' => 'anonymous_block' | ||
| 309 | }, | ||
| 310 | { | ||
| 311 | '.ref' => '_' | ||
| 312 | }, | ||
| 313 | { | ||
| 314 | '+max' => 1, | ||
| 315 | '.all' => [ | ||
| 316 | { | ||
| 317 | '.rgx' => qr/\Gelse/ | ||
| 318 | }, | ||
| 319 | { | ||
| 320 | '.ref' => '_' | ||
| 321 | }, | ||
| 322 | { | ||
| 323 | '+min' => 0, | ||
| 324 | '.any' => [ | ||
| 325 | { | ||
| 326 | '.ref' => 'anonymous_block' | ||
| 327 | }, | ||
| 328 | { | ||
| 329 | '.ref' => 'conditional_statement' | ||
| 330 | } | ||
| 331 | ] | ||
| 332 | } | ||
| 333 | ] | ||
| 334 | }, | ||
| 335 | { | ||
| 336 | '.ref' => '_' | ||
| 337 | } | ||
| 338 | ] | ||
| 339 | }, | ||
| 340 | 'conditional_statement' => { | ||
| 341 | '.all' => [ | ||
| 342 | { | ||
| 343 | '.ref' => '_' | ||
| 344 | }, | ||
| 345 | { | ||
| 346 | '.rgx' => qr/\G(if|while)/ | ||
| 347 | }, | ||
| 348 | { | ||
| 349 | '.ref' => '_' | ||
| 350 | }, | ||
| 351 | { | ||
| 352 | '.ref' => 'conditional_subject' | ||
| 353 | }, | ||
| 354 | { | ||
| 355 | '.ref' => '_' | ||
| 356 | }, | ||
| 357 | { | ||
| 358 | '.ref' => 'conditional_predicate' | ||
| 359 | }, | ||
| 360 | { | ||
| 361 | '+max' => 1, | ||
| 362 | '.ref' => 'line_ending' | ||
| 363 | } | ||
| 364 | ] | ||
| 365 | }, | ||
| 366 | 'conditional_subject' => { | ||
| 367 | '.any' => [ | ||
| 368 | { | ||
| 369 | '.ref' => 'single_conditional_subject' | ||
| 370 | }, | ||
| 371 | { | ||
| 372 | '.ref' => 'nested_conditional_subject' | ||
| 373 | } | ||
| 374 | ] | ||
| 375 | }, | ||
| 376 | 'constant' => { | ||
| 377 | '.any' => [ | ||
| 378 | { | ||
| 379 | '.ref' => 'number_units' | ||
| 380 | }, | ||
| 381 | { | ||
| 382 | '.ref' => 'number' | ||
| 383 | }, | ||
| 384 | { | ||
| 385 | '.ref' => 'string' | ||
| 386 | }, | ||
| 387 | { | ||
| 388 | '.ref' => 'array' | ||
| 389 | } | ||
| 390 | ] | ||
| 391 | }, | ||
| 392 | 'declaration' => { | ||
| 393 | '.all' => [ | ||
| 394 | { | ||
| 395 | '.ref' => '_' | ||
| 396 | }, | ||
| 397 | { | ||
| 398 | '.ref' => 'variable' | ||
| 399 | }, | ||
| 400 | { | ||
| 401 | '.ref' => '_' | ||
| 402 | }, | ||
| 403 | { | ||
| 404 | '.rgx' => qr/\G=/ | ||
| 405 | }, | ||
| 406 | { | ||
| 407 | '.ref' => '_' | ||
| 408 | }, | ||
| 409 | { | ||
| 410 | '.any' => [ | ||
| 411 | { | ||
| 412 | '.ref' => 'constant' | ||
| 413 | }, | ||
| 414 | { | ||
| 415 | '.ref' => 'modifier_constant' | ||
| 416 | } | ||
| 417 | ] | ||
| 418 | } | ||
| 419 | ] | ||
| 420 | }, | ||
| 421 | 'double_quoted_string' => { | ||
| 422 | '.rgx' => qr/\G(?:"((?:[^\n\\"]|\\"|\\\\|\\[0nt])*?)")/ | ||
| 423 | }, | ||
| 424 | 'end_array' => { | ||
| 425 | '.rgx' => qr/\G[\ \t]*\r?\n?\][\ \t]*\r?\n?/ | ||
| 426 | }, | ||
| 427 | 'end_block' => { | ||
| 428 | '.rgx' => qr/\G[\ \t]*\r?\n?\}[\ \t]*\r?\n?\r?\n?/ | ||
| 429 | }, | ||
| 430 | 'end_nested_expr' => { | ||
| 431 | '.rgx' => qr/\G[\ \t]*\r?\n?\)[\ \t]*\r?\n?/ | ||
| 432 | }, | ||
| 433 | 'expr_value' => { | ||
| 434 | '.all' => [ | ||
| 435 | { | ||
| 436 | '.ref' => '_' | ||
| 437 | }, | ||
| 438 | { | ||
| 439 | '.any' => [ | ||
| 440 | { | ||
| 441 | '.ref' => 'parameter' | ||
| 442 | }, | ||
| 443 | { | ||
| 444 | '.ref' => 'number' | ||
| 445 | }, | ||
| 446 | { | ||
| 447 | '.ref' => 'array_element' | ||
| 448 | }, | ||
| 449 | { | ||
| 450 | '.ref' => 'variable' | ||
| 451 | }, | ||
| 452 | { | ||
| 453 | '.ref' => 'number_units' | ||
| 454 | }, | ||
| 455 | { | ||
| 456 | '.ref' => 'complement' | ||
| 457 | }, | ||
| 458 | { | ||
| 459 | '.ref' => 'modifier_variable' | ||
| 460 | }, | ||
| 461 | { | ||
| 462 | '.ref' => 'nested_expr_value' | ||
| 463 | } | ||
| 464 | ] | ||
| 465 | }, | ||
| 466 | { | ||
| 467 | '.ref' => '_' | ||
| 468 | } | ||
| 469 | ] | ||
| 470 | }, | ||
| 471 | 'expression' => { | ||
| 472 | '.all' => [ | ||
| 473 | { | ||
| 474 | '.any' => [ | ||
| 475 | { | ||
| 476 | '.ref' => 'assign_expr' | ||
| 477 | }, | ||
| 478 | { | ||
| 479 | '.ref' => 'unary_expr' | ||
| 480 | }, | ||
| 481 | { | ||
| 482 | '.ref' => 'declaration' | ||
| 483 | } | ||
| 484 | ] | ||
| 485 | }, | ||
| 486 | { | ||
| 487 | '.ref' => 'line_ending' | ||
| 488 | } | ||
| 489 | ] | ||
| 490 | }, | ||
| 491 | 'header' => { | ||
| 492 | '.any' => [ | ||
| 493 | { | ||
| 494 | '.ref' => 'pragmas' | ||
| 495 | }, | ||
| 496 | { | ||
| 497 | '.ref' => 'comment' | ||
| 498 | } | ||
| 499 | ] | ||
| 500 | }, | ||
| 501 | 'identifier' => { | ||
| 502 | '.rgx' => qr/\G([a-zA-Z][0-9A-Za-z_]*)/ | ||
| 503 | }, | ||
| 504 | 'identifier_without_keyword' => { | ||
| 505 | '.rgx' => qr/\G(?!if|else|while|true|false|TRUE|FALSE)([a-zA-Z][0-9A-Za-z_]*)/ | ||
| 506 | }, | ||
| 507 | 'instruction' => { | ||
| 508 | '.all' => [ | ||
| 509 | { | ||
| 510 | '.ref' => 'name' | ||
| 511 | }, | ||
| 512 | { | ||
| 513 | '.ref' => 'values' | ||
| 514 | }, | ||
| 515 | { | ||
| 516 | '.ref' => 'line_ending' | ||
| 517 | } | ||
| 518 | ] | ||
| 519 | }, | ||
| 520 | 'line_ending' => { | ||
| 521 | '.rgx' => qr/\G[\ \t]*\r?\n?;[\ \t]*\r?\n?\r?\n?/ | ||
| 522 | }, | ||
| 523 | 'list_separator' => { | ||
| 524 | '.all' => [ | ||
| 525 | { | ||
| 526 | '.ref' => '_' | ||
| 527 | }, | ||
| 528 | { | ||
| 529 | '.ref' => 'COMMA' | ||
| 530 | }, | ||
| 531 | { | ||
| 532 | '.ref' => '_' | ||
| 533 | }, | ||
| 534 | { | ||
| 535 | '+max' => 1, | ||
| 536 | '.ref' => 'comment' | ||
| 537 | } | ||
| 538 | ] | ||
| 539 | }, | ||
| 540 | 'logic_operator' => { | ||
| 541 | '.rgx' => qr/\G([&\|]{2})/ | ||
| 542 | }, | ||
| 543 | 'math_operator' => { | ||
| 544 | '.rgx' => qr/\G([\+\-\*\/%])/ | ||
| 545 | }, | ||
| 546 | 'mcu_select' => { | ||
| 547 | '.rgx' => qr/\GPIC[\ \t]+([a-zA-Z]+[0-9]+[a-zA-Z][0-9]+[a-zA-Z]?|Any)[\ \t]*\r?\n?;[\ \t]*\r?\n?\r?\n?/ | ||
| 548 | }, | ||
| 549 | 'modifier_constant' => { | ||
| 550 | '.all' => [ | ||
| 551 | { | ||
| 552 | '.ref' => 'identifier_without_keyword' | ||
| 553 | }, | ||
| 554 | { | ||
| 555 | '.ref' => '_' | ||
| 556 | }, | ||
| 557 | { | ||
| 558 | '.ref' => 'constant' | ||
| 559 | } | ||
| 560 | ] | ||
| 561 | }, | ||
| 562 | 'modifier_variable' => { | ||
| 563 | '.all' => [ | ||
| 564 | { | ||
| 565 | '.ref' => 'identifier_without_keyword' | ||
| 566 | }, | ||
| 567 | { | ||
| 568 | '.ref' => '_' | ||
| 569 | }, | ||
| 570 | { | ||
| 571 | '.ref' => 'variable' | ||
| 572 | } | ||
| 573 | ] | ||
| 574 | }, | ||
| 575 | 'name' => { | ||
| 576 | '.all' => [ | ||
| 577 | { | ||
| 578 | '.ref' => '_' | ||
| 579 | }, | ||
| 580 | { | ||
| 581 | '.ref' => 'identifier_without_keyword' | ||
| 582 | }, | ||
| 583 | { | ||
| 584 | '.ref' => '_' | ||
| 585 | } | ||
| 586 | ] | ||
| 587 | }, | ||
| 588 | 'named_block' => { | ||
| 589 | '.all' => [ | ||
| 590 | { | ||
| 591 | '.ref' => 'name' | ||
| 592 | }, | ||
| 593 | { | ||
| 594 | '.ref' => 'anonymous_block' | ||
| 595 | } | ||
| 596 | ] | ||
| 597 | }, | ||
| 598 | 'nested_conditional' => { | ||
| 599 | '.all' => [ | ||
| 600 | { | ||
| 601 | '.ref' => 'start_nested_expr' | ||
| 602 | }, | ||
| 603 | { | ||
| 604 | '.ref' => 'single_conditional' | ||
| 605 | }, | ||
| 606 | { | ||
| 607 | '.ref' => 'end_nested_expr' | ||
| 608 | } | ||
| 609 | ] | ||
| 610 | }, | ||
| 611 | 'nested_conditional_subject' => { | ||
| 612 | '.all' => [ | ||
| 613 | { | ||
| 614 | '.ref' => 'start_nested_expr' | ||
| 615 | }, | ||
| 616 | { | ||
| 617 | '.ref' => 'single_conditional_subject' | ||
| 618 | }, | ||
| 619 | { | ||
| 620 | '.ref' => 'end_nested_expr' | ||
| 621 | } | ||
| 622 | ] | ||
| 623 | }, | ||
| 624 | 'nested_expr_value' => { | ||
| 625 | '.all' => [ | ||
| 626 | { | ||
| 627 | '.ref' => 'start_nested_expr' | ||
| 628 | }, | ||
| 629 | { | ||
| 630 | '.ref' => 'rhs_expr' | ||
| 631 | }, | ||
| 632 | { | ||
| 633 | '.ref' => 'end_nested_expr' | ||
| 634 | } | ||
| 635 | ] | ||
| 636 | }, | ||
| 637 | 'number' => { | ||
| 638 | '.any' => [ | ||
| 639 | { | ||
| 640 | '.rgx' => qr/\G(0[xX][0-9a-fA-F]+|\-?[0-9]+)/ | ||
| 641 | }, | ||
| 642 | { | ||
| 643 | '.ref' => 'boolean' | ||
| 644 | } | ||
| 645 | ] | ||
| 646 | }, | ||
| 647 | 'number_units' => { | ||
| 648 | '.all' => [ | ||
| 649 | { | ||
| 650 | '.ref' => 'number' | ||
| 651 | }, | ||
| 652 | { | ||
| 653 | '.ref' => '_' | ||
| 654 | }, | ||
| 655 | { | ||
| 656 | '.ref' => 'units' | ||
| 657 | } | ||
| 658 | ] | ||
| 659 | }, | ||
| 660 | 'parameter' => { | ||
| 661 | '.rgx' => qr/\Gshift/ | ||
| 662 | }, | ||
| 663 | 'pragma_expression' => { | ||
| 664 | '.all' => [ | ||
| 665 | { | ||
| 666 | '.ref' => 'name' | ||
| 667 | }, | ||
| 668 | { | ||
| 669 | '.rgx' => qr/\G=[\ \t]*\r?\n?/ | ||
| 670 | }, | ||
| 671 | { | ||
| 672 | '.any' => [ | ||
| 673 | { | ||
| 674 | '.ref' => 'number_units' | ||
| 675 | }, | ||
| 676 | { | ||
| 677 | '.ref' => 'number' | ||
| 678 | }, | ||
| 679 | { | ||
| 680 | '.ref' => 'string' | ||
| 681 | } | ||
| 682 | ] | ||
| 683 | }, | ||
| 684 | { | ||
| 685 | '.ref' => '_' | ||
| 686 | } | ||
| 687 | ] | ||
| 688 | }, | ||
| 689 | 'pragmas' => { | ||
| 690 | '.all' => [ | ||
| 691 | { | ||
| 692 | '.rgx' => qr/\Gpragma/ | ||
| 693 | }, | ||
| 694 | { | ||
| 695 | '.ref' => '__' | ||
| 696 | }, | ||
| 697 | { | ||
| 698 | '.any' => [ | ||
| 699 | { | ||
| 700 | '.ref' => 'variable' | ||
| 701 | }, | ||
| 702 | { | ||
| 703 | '.ref' => 'name' | ||
| 704 | } | ||
| 705 | ] | ||
| 706 | }, | ||
| 707 | { | ||
| 708 | '+max' => 1, | ||
| 709 | '.any' => [ | ||
| 710 | { | ||
| 711 | '.ref' => 'pragma_expression' | ||
| 712 | }, | ||
| 713 | { | ||
| 714 | '.ref' => 'name' | ||
| 715 | } | ||
| 716 | ] | ||
| 717 | }, | ||
| 718 | { | ||
| 719 | '.ref' => 'line_ending' | ||
| 720 | } | ||
| 721 | ] | ||
| 722 | }, | ||
| 723 | 'program' => { | ||
| 724 | '.all' => [ | ||
| 725 | { | ||
| 726 | '+min' => 0, | ||
| 727 | '.ref' => 'comment' | ||
| 728 | }, | ||
| 729 | { | ||
| 730 | '.ref' => 'mcu_select' | ||
| 731 | }, | ||
| 732 | { | ||
| 733 | '+min' => 0, | ||
| 734 | '.ref' => 'header' | ||
| 735 | }, | ||
| 736 | { | ||
| 737 | '+min' => 0, | ||
| 738 | '.ref' => 'statement' | ||
| 739 | }, | ||
| 740 | { | ||
| 741 | '.ref' => 'EOS' | ||
| 742 | } | ||
| 743 | ] | ||
| 744 | }, | ||
| 745 | 'real_number' => { | ||
| 746 | '.any' => [ | ||
| 747 | { | ||
| 748 | '.rgx' => qr/\G(\-?[0-9]*\.[0-9]+)/ | ||
| 749 | }, | ||
| 750 | { | ||
| 751 | '.rgx' => qr/\G(\-?[0-9]+\.[0-9]*)/ | ||
| 752 | } | ||
| 753 | ] | ||
| 754 | }, | ||
| 755 | 'rhs_expr' => { | ||
| 756 | '.all' => [ | ||
| 757 | { | ||
| 758 | '.ref' => 'expr_value' | ||
| 759 | }, | ||
| 760 | { | ||
| 761 | '+min' => 0, | ||
| 762 | '-flat' => 1, | ||
| 763 | '.all' => [ | ||
| 764 | { | ||
| 765 | '.ref' => 'rhs_operator' | ||
| 766 | }, | ||
| 767 | { | ||
| 768 | '.ref' => 'expr_value' | ||
| 769 | } | ||
| 770 | ] | ||
| 771 | } | ||
| 772 | ] | ||
| 773 | }, | ||
| 774 | 'rhs_operator' => { | ||
| 775 | '.any' => [ | ||
| 776 | { | ||
| 777 | '.ref' => 'math_operator' | ||
| 778 | }, | ||
| 779 | { | ||
| 780 | '.ref' => 'bit_operator' | ||
| 781 | }, | ||
| 782 | { | ||
| 783 | '.ref' => 'shift_operator' | ||
| 784 | } | ||
| 785 | ] | ||
| 786 | }, | ||
| 787 | 'shift_assign_operator' => { | ||
| 788 | '.rgx' => qr/\G(<<=|\>\>=)/ | ||
| 789 | }, | ||
| 790 | 'shift_operator' => { | ||
| 791 | '.rgx' => qr/\G(<<|\>\>)/ | ||
| 792 | }, | ||
| 793 | 'single_conditional' => { | ||
| 794 | '.any' => [ | ||
| 795 | { | ||
| 796 | '.ref' => 'comparison' | ||
| 797 | }, | ||
| 798 | { | ||
| 799 | '.ref' => 'expr_value' | ||
| 800 | } | ||
| 801 | ] | ||
| 802 | }, | ||
| 803 | 'single_conditional_subject' => { | ||
| 804 | '.all' => [ | ||
| 805 | { | ||
| 806 | '.ref' => 'any_conditional' | ||
| 807 | }, | ||
| 808 | { | ||
| 809 | '+min' => 0, | ||
| 810 | '-flat' => 1, | ||
| 811 | '.all' => [ | ||
| 812 | { | ||
| 813 | '.ref' => 'logic_operator' | ||
| 814 | }, | ||
| 815 | { | ||
| 816 | '.ref' => 'any_conditional' | ||
| 817 | } | ||
| 818 | ] | ||
| 819 | } | ||
| 820 | ] | ||
| 821 | }, | ||
| 822 | 'single_quoted_string' => { | ||
| 823 | '.rgx' => qr/\G(?:'((?:[^\n\\']|\\'|\\\\)*?)')/ | ||
| 824 | }, | ||
| 825 | 'start_array' => { | ||
| 826 | '.rgx' => qr/\G[\ \t]*\r?\n?\[[\ \t]*\r?\n?/ | ||
| 827 | }, | ||
| 828 | 'start_block' => { | ||
| 829 | '.rgx' => qr/\G[\ \t]*\r?\n?\{[\ \t]*\r?\n?\r?\n?/ | ||
| 830 | }, | ||
| 831 | 'start_nested_expr' => { | ||
| 832 | '.rgx' => qr/\G[\ \t]*\r?\n?\([\ \t]*\r?\n?/ | ||
| 833 | }, | ||
| 834 | 'statement' => { | ||
| 835 | '.any' => [ | ||
| 836 | { | ||
| 837 | '.ref' => 'comment' | ||
| 838 | }, | ||
| 839 | { | ||
| 840 | '.ref' => 'instruction' | ||
| 841 | }, | ||
| 842 | { | ||
| 843 | '.ref' => 'expression' | ||
| 844 | }, | ||
| 845 | { | ||
| 846 | '.ref' => 'conditional_statement' | ||
| 847 | }, | ||
| 848 | { | ||
| 849 | '.ref' => 'assert_statement' | ||
| 850 | }, | ||
| 851 | { | ||
| 852 | '.ref' => 'block' | ||
| 853 | } | ||
| 854 | ] | ||
| 855 | }, | ||
| 856 | 'string' => { | ||
| 857 | '.any' => [ | ||
| 858 | { | ||
| 859 | '.ref' => 'single_quoted_string' | ||
| 860 | }, | ||
| 861 | { | ||
| 862 | '.ref' => 'double_quoted_string' | ||
| 863 | } | ||
| 864 | ] | ||
| 865 | }, | ||
| 866 | 'unary_expr' => { | ||
| 867 | '.any' => [ | ||
| 868 | { | ||
| 869 | '.ref' => 'unary_lhs' | ||
| 870 | }, | ||
| 871 | { | ||
| 872 | '.ref' => 'unary_rhs' | ||
| 873 | } | ||
| 874 | ] | ||
| 875 | }, | ||
| 876 | 'unary_lhs' => { | ||
| 877 | '.all' => [ | ||
| 878 | { | ||
| 879 | '.ref' => '_' | ||
| 880 | }, | ||
| 881 | { | ||
| 882 | '.ref' => 'unary_operator' | ||
| 883 | }, | ||
| 884 | { | ||
| 885 | '.ref' => '_' | ||
| 886 | }, | ||
| 887 | { | ||
| 888 | '.ref' => 'variable' | ||
| 889 | }, | ||
| 890 | { | ||
| 891 | '.ref' => '_' | ||
| 892 | } | ||
| 893 | ] | ||
| 894 | }, | ||
| 895 | 'unary_operator' => { | ||
| 896 | '.rgx' => qr/\G(\+\+|\-\-)/ | ||
| 897 | }, | ||
| 898 | 'unary_rhs' => { | ||
| 899 | '.all' => [ | ||
| 900 | { | ||
| 901 | '.ref' => '_' | ||
| 902 | }, | ||
| 903 | { | ||
| 904 | '.ref' => 'variable' | ||
| 905 | }, | ||
| 906 | { | ||
| 907 | '.ref' => '_' | ||
| 908 | }, | ||
| 909 | { | ||
| 910 | '.ref' => 'unary_operator' | ||
| 911 | }, | ||
| 912 | { | ||
| 913 | '.ref' => '_' | ||
| 914 | } | ||
| 915 | ] | ||
| 916 | }, | ||
| 917 | 'units' => { | ||
| 918 | '.rgx' => qr/\G([mu]?s|[kM]?Hz|%)/ | ||
| 919 | }, | ||
| 920 | 'validated_variable' => { | ||
| 921 | '.all' => [ | ||
| 922 | { | ||
| 923 | '.ref' => 'identifier_without_keyword' | ||
| 924 | }, | ||
| 925 | { | ||
| 926 | '.rgx' => qr/\G([+-]?)/ | ||
| 927 | } | ||
| 928 | ] | ||
| 929 | }, | ||
| 930 | 'value' => { | ||
| 931 | '.all' => [ | ||
| 932 | { | ||
| 933 | '.ref' => '_' | ||
| 934 | }, | ||
| 935 | { | ||
| 936 | '.any' => [ | ||
| 937 | { | ||
| 938 | '.ref' => 'string' | ||
| 939 | }, | ||
| 940 | { | ||
| 941 | '.ref' => 'number_units' | ||
| 942 | }, | ||
| 943 | { | ||
| 944 | '.ref' => 'number' | ||
| 945 | }, | ||
| 946 | { | ||
| 947 | '.ref' => 'array_element' | ||
| 948 | }, | ||
| 949 | { | ||
| 950 | '.ref' => 'variable' | ||
| 951 | }, | ||
| 952 | { | ||
| 953 | '.ref' => 'named_block' | ||
| 954 | }, | ||
| 955 | { | ||
| 956 | '.ref' => 'modifier_constant' | ||
| 957 | }, | ||
| 958 | { | ||
| 959 | '.ref' => 'modifier_variable' | ||
| 960 | }, | ||
| 961 | { | ||
| 962 | '.ref' => 'validated_variable' | ||
| 963 | } | ||
| 964 | ] | ||
| 965 | }, | ||
| 966 | { | ||
| 967 | '.ref' => '_' | ||
| 968 | } | ||
| 969 | ] | ||
| 970 | }, | ||
| 971 | 'values' => { | ||
| 972 | '+max' => 1, | ||
| 973 | '.all' => [ | ||
| 974 | { | ||
| 975 | '.ref' => 'value' | ||
| 976 | }, | ||
| 977 | { | ||
| 978 | '+min' => 0, | ||
| 979 | '-flat' => 1, | ||
| 980 | '.all' => [ | ||
| 981 | { | ||
| 982 | '.ref' => 'list_separator' | ||
| 983 | }, | ||
| 984 | { | ||
| 985 | '.ref' => 'value' | ||
| 986 | } | ||
| 987 | ] | ||
| 988 | } | ||
| 989 | ] | ||
| 990 | }, | ||
| 991 | 'variable' => { | ||
| 992 | '.all' => [ | ||
| 993 | { | ||
| 994 | '.ref' => 'DOLLAR' | ||
| 995 | }, | ||
| 996 | { | ||
| 997 | '.ref' => 'identifier' | ||
| 998 | } | ||
| 999 | ] | ||
| 1000 | } | ||
| 1001 | } | ||
| 1002 | } | ||
| 1003 | |||
| 1004 | 33 | 1; | |
| 1005 | |||
| 1006 | =encoding utf8 | ||
| 1007 | |||
| 1008 | =head1 NAME | ||
| 1009 | |||
| 1010 | VIC::Grammar | ||
| 1011 | |||
| 1012 | =head1 SYNOPSIS | ||
| 1013 | |||
| 1014 | The Pegex::Grammar class for handling the grammar. | ||
| 1015 | |||
| 1016 | =head1 DESCRIPTION | ||
| 1017 | |||
| 1018 | INTERNAL CLASS. THIS IS AUTO-GENERATED. DO NOT EDIT. | ||
| 1019 | |||
| 1020 | =head1 AUTHOR | ||
| 1021 | |||
| 1022 | Vikas N Kumar <vikas@cpan.org> | ||
| 1023 | |||
| 1024 | =head1 COPYRIGHT | ||
| 1025 | |||
| 1026 | Copyright (c) 2014. Vikas N Kumar | ||
| 1027 | |||
| 1028 | This program is free software; you can redistribute it and/or modify it | ||
| 1029 | under the same terms as Perl itself. | ||
| 1030 | |||
| 1031 | See http://www.perl.com/perl/misc/Artistic.html | ||
| 1032 | |||
| 1033 | =cut | ||