1# -*- tcl -*- 2## Parsing Expression Grammar 'pg::peg::grammar'. 3## Recursive Descent Packrat parser generated 4## by the PAGE writer plugin 'me'. 5## (C) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net> 6 7# ### ### ### ######### ######### ######### 8## Package description 9 10# The commands provided here match an input provided through a buffer 11# command to the PE grammar 'pg::peg::grammar'. The parser is based on the package 12# 'grammar::me::tcl' (recursive-descent, packrat, pulling chars, 13# pushing the generated AST). 14 15# ### ### ### ######### ######### ######### 16## Requisites 17 18package require grammar::me::tcl 19 20# ### ### ### ######### ######### ######### 21## Implementation 22 23namespace eval ::page::parse::peg { 24 # Import the virtual machine for matching. 25 26 namespace import ::grammar::me::tcl::* 27 upvar #0 ::grammar::me::tcl::ok ok 28} 29 30# ### ### ### ######### ######### ######### 31## API Implementation. 32 33proc ::page::parse::peg::parse {nxcmd emvar astvar} { 34 variable ok 35 variable se 36 37 upvar 1 $emvar emsg $astvar ast 38 39 init $nxcmd 40 41 matchSymbol_Grammar ; # (n Grammar) 42 43 isv_nonterminal_reduce ALL -1 44 set ast [sv] 45 if {!$ok} { 46 foreach {l m} [ier_get] break 47 lappend l [lc $l] 48 set emsg [list $l $m] 49 } 50 51 return $ok 52} 53 54# ### ### ### ######### ######### ######### 55## Internal helper methods 56 57# Grammar 'pg::peg::grammar' 58# 59# ALNUM = (x (t <) 60# (t a) 61# (t l) 62# (t n) 63# (t u) 64# (t m) 65# (t >) 66# (n SPACE)) 67# 68# ALPHA = (x (t <) 69# (t a) 70# (t l) 71# (t p) 72# (t h) 73# (t a) 74# (t >) 75# (n SPACE)) 76# 77# AND = (x (t &) 78# (n SPACE)) 79# 80# APOSTROPH = (t ') 81# 82# Attribute = (x (/ (n VOID) 83# (n LEAF) 84# (n MATCH)) 85# (n COLON)) 86# 87# Char = (/ (n CharSpecial) 88# (n CharOctalFull) 89# (n CharOctalPart) 90# (n CharUnicode) 91# (n CharUnescaped)) 92# 93# CharOctalFull = (x (t \) 94# (.. 0 2) 95# (.. 0 7) 96# (.. 0 7)) 97# 98# CharOctalPart = (x (t \) 99# (.. 0 7) 100# (? (.. 0 7))) 101# 102# CharSpecial = (x (t \) 103# (/ (t n) 104# (t r) 105# (t t) 106# (t ') 107# (t \") 108# (t [) 109# (t ]) 110# (t \))) 111# 112# CharUnescaped = (x (! (t \)) 113# (dot)) 114# 115# CharUnicode = (x (t \) 116# (t u) 117# (n HexDigit) 118# (? (x (n HexDigit) 119# (? (x (n HexDigit) 120# (? (n HexDigit))))))) 121# 122# Class = (x (n OPENB) 123# (* (x (! (n CLOSEB)) 124# (n Range))) 125# (n CLOSEB) 126# (n SPACE)) 127# 128# CLOSE = (x (t \)) 129# (n SPACE)) 130# 131# CLOSEB = (t ]) 132# 133# COLON = (x (t :) 134# (n SPACE)) 135# 136# COMMENT = (x (t #) 137# (* (x (! (n EOL)) 138# (dot))) 139# (n EOL)) 140# 141# DAPOSTROPH = (t \") 142# 143# Definition = (x (? (n Attribute)) 144# (n Identifier) 145# (n IS) 146# (n Expression) 147# (n SEMICOLON)) 148# 149# DOT = (x (t .) 150# (n SPACE)) 151# 152# END = (x (t E) 153# (t N) 154# (t D) 155# (n SPACE)) 156# 157# EOF = (! (dot)) 158# 159# EOL = (/ (x (t \n) 160# (t \r)) 161# (t \n) 162# (t \r)) 163# 164# Expression = (x (n Sequence) 165# (* (x (n SLASH) 166# (n Sequence)))) 167# 168# Final = (x (n END) 169# (n SEMICOLON) 170# (n SPACE)) 171# 172# Grammar = (x (n SPACE) 173# (n Header) 174# (+ (n Definition)) 175# (n Final) 176# (n EOF)) 177# 178# Header = (x (n PEG) 179# (n Identifier) 180# (n StartExpr)) 181# 182# HexDigit = (/ (.. 0 9) 183# (.. a f) 184# (.. A F)) 185# 186# Ident = (x (/ (t _) 187# (t :) 188# (alpha)) 189# (* (/ (t _) 190# (t :) 191# (alnum)))) 192# 193# Identifier = (x (n Ident) 194# (n SPACE)) 195# 196# IS = (x (t <) 197# (t -) 198# (n SPACE)) 199# 200# LEAF = (x (t l) 201# (t e) 202# (t a) 203# (t f) 204# (n SPACE)) 205# 206# Literal = (/ (x (n APOSTROPH) 207# (* (x (! (n APOSTROPH)) 208# (n Char))) 209# (n APOSTROPH) 210# (n SPACE)) 211# (x (n DAPOSTROPH) 212# (* (x (! (n DAPOSTROPH)) 213# (n Char))) 214# (n DAPOSTROPH) 215# (n SPACE))) 216# 217# MATCH = (x (t m) 218# (t a) 219# (t t) 220# (t c) 221# (t h) 222# (n SPACE)) 223# 224# NOT = (x (t !) 225# (n SPACE)) 226# 227# OPEN = (x (t \() 228# (n SPACE)) 229# 230# OPENB = (t [) 231# 232# PEG = (x (t P) 233# (t E) 234# (t G) 235# (n SPACE)) 236# 237# PLUS = (x (t +) 238# (n SPACE)) 239# 240# Prefix = (x (? (/ (n AND) 241# (n NOT))) 242# (n Suffix)) 243# 244# Primary = (/ (n ALNUM) 245# (n ALPHA) 246# (n Identifier) 247# (x (n OPEN) 248# (n Expression) 249# (n CLOSE)) 250# (n Literal) 251# (n Class) 252# (n DOT)) 253# 254# QUESTION = (x (t ?) 255# (n SPACE)) 256# 257# Range = (/ (x (n Char) 258# (n TO) 259# (n Char)) 260# (n Char)) 261# 262# SEMICOLON = (x (t ;) 263# (n SPACE)) 264# 265# Sequence = (+ (n Prefix)) 266# 267# SLASH = (x (t /) 268# (n SPACE)) 269# 270# SPACE = (* (/ (t <blank>) 271# (t \t) 272# (n EOL) 273# (n COMMENT))) 274# 275# STAR = (x (t *) 276# (n SPACE)) 277# 278# StartExpr = (x (n OPEN) 279# (n Expression) 280# (n CLOSE)) 281# 282# Suffix = (x (n Primary) 283# (? (/ (n QUESTION) 284# (n STAR) 285# (n PLUS)))) 286# 287# TO = (t -) 288# 289# VOID = (x (t v) 290# (t o) 291# (t i) 292# (t d) 293# (n SPACE)) 294# 295 296proc ::page::parse::peg::matchSymbol_ALNUM {} { 297 # ALNUM = (x (t <) 298 # (t a) 299 # (t l) 300 # (t n) 301 # (t u) 302 # (t m) 303 # (t >) 304 # (n SPACE)) 305 306 variable ok 307 if {[inc_restore ALNUM]} { 308 if {$ok} ias_push 309 return 310 } 311 312 set pos [icl_get] 313 314 eseq75 ; # (x (t <) 315 # (t a) 316 # (t l) 317 # (t n) 318 # (t u) 319 # (t m) 320 # (t >) 321 # (n SPACE)) 322 323 isv_nonterminal_leaf ALNUM $pos 324 inc_save ALNUM $pos 325 if {$ok} ias_push 326 ier_nonterminal "Expected ALNUM" $pos 327 return 328} 329 330proc ::page::parse::peg::eseq75 {} { 331 332 # (x (t <) 333 # (t a) 334 # (t l) 335 # (t n) 336 # (t u) 337 # (t m) 338 # (t >) 339 # (n SPACE)) 340 341 variable ok 342 343 set pos [icl_get] 344 345 set old [ier_get] 346 ict_advance "Expected < (got EOF)" 347 if {$ok} {ict_match_token < "Expected <"} 348 ier_merge $old 349 350 if {!$ok} {icl_rewind $pos ; return} 351 352 set old [ier_get] 353 ict_advance "Expected a (got EOF)" 354 if {$ok} {ict_match_token a "Expected a"} 355 ier_merge $old 356 357 if {!$ok} {icl_rewind $pos ; return} 358 359 set old [ier_get] 360 ict_advance "Expected l (got EOF)" 361 if {$ok} {ict_match_token l "Expected l"} 362 ier_merge $old 363 364 if {!$ok} {icl_rewind $pos ; return} 365 366 set old [ier_get] 367 ict_advance "Expected n (got EOF)" 368 if {$ok} {ict_match_token n "Expected n"} 369 ier_merge $old 370 371 if {!$ok} {icl_rewind $pos ; return} 372 373 set old [ier_get] 374 ict_advance "Expected u (got EOF)" 375 if {$ok} {ict_match_token u "Expected u"} 376 ier_merge $old 377 378 if {!$ok} {icl_rewind $pos ; return} 379 380 set old [ier_get] 381 ict_advance "Expected m (got EOF)" 382 if {$ok} {ict_match_token m "Expected m"} 383 ier_merge $old 384 385 if {!$ok} {icl_rewind $pos ; return} 386 387 set old [ier_get] 388 ict_advance "Expected > (got EOF)" 389 if {$ok} {ict_match_token > "Expected >"} 390 ier_merge $old 391 392 if {!$ok} {icl_rewind $pos ; return} 393 394 set old [ier_get] 395 matchSymbol_SPACE ; # (n SPACE) 396 ier_merge $old 397 398 if {!$ok} {icl_rewind $pos ; return} 399 400 return 401} 402 403proc ::page::parse::peg::matchSymbol_ALPHA {} { 404 # ALPHA = (x (t <) 405 # (t a) 406 # (t l) 407 # (t p) 408 # (t h) 409 # (t a) 410 # (t >) 411 # (n SPACE)) 412 413 variable ok 414 if {[inc_restore ALPHA]} { 415 if {$ok} ias_push 416 return 417 } 418 419 set pos [icl_get] 420 421 eseq74 ; # (x (t <) 422 # (t a) 423 # (t l) 424 # (t p) 425 # (t h) 426 # (t a) 427 # (t >) 428 # (n SPACE)) 429 430 isv_nonterminal_leaf ALPHA $pos 431 inc_save ALPHA $pos 432 if {$ok} ias_push 433 ier_nonterminal "Expected ALPHA" $pos 434 return 435} 436 437proc ::page::parse::peg::eseq74 {} { 438 439 # (x (t <) 440 # (t a) 441 # (t l) 442 # (t p) 443 # (t h) 444 # (t a) 445 # (t >) 446 # (n SPACE)) 447 448 variable ok 449 450 set pos [icl_get] 451 452 set old [ier_get] 453 ict_advance "Expected < (got EOF)" 454 if {$ok} {ict_match_token < "Expected <"} 455 ier_merge $old 456 457 if {!$ok} {icl_rewind $pos ; return} 458 459 set old [ier_get] 460 ict_advance "Expected a (got EOF)" 461 if {$ok} {ict_match_token a "Expected a"} 462 ier_merge $old 463 464 if {!$ok} {icl_rewind $pos ; return} 465 466 set old [ier_get] 467 ict_advance "Expected l (got EOF)" 468 if {$ok} {ict_match_token l "Expected l"} 469 ier_merge $old 470 471 if {!$ok} {icl_rewind $pos ; return} 472 473 set old [ier_get] 474 ict_advance "Expected p (got EOF)" 475 if {$ok} {ict_match_token p "Expected p"} 476 ier_merge $old 477 478 if {!$ok} {icl_rewind $pos ; return} 479 480 set old [ier_get] 481 ict_advance "Expected h (got EOF)" 482 if {$ok} {ict_match_token h "Expected h"} 483 ier_merge $old 484 485 if {!$ok} {icl_rewind $pos ; return} 486 487 set old [ier_get] 488 ict_advance "Expected a (got EOF)" 489 if {$ok} {ict_match_token a "Expected a"} 490 ier_merge $old 491 492 if {!$ok} {icl_rewind $pos ; return} 493 494 set old [ier_get] 495 ict_advance "Expected > (got EOF)" 496 if {$ok} {ict_match_token > "Expected >"} 497 ier_merge $old 498 499 if {!$ok} {icl_rewind $pos ; return} 500 501 set old [ier_get] 502 matchSymbol_SPACE ; # (n SPACE) 503 ier_merge $old 504 505 if {!$ok} {icl_rewind $pos ; return} 506 507 return 508} 509 510proc ::page::parse::peg::matchSymbol_AND {} { 511 # AND = (x (t &) 512 # (n SPACE)) 513 514 variable ok 515 if {[inc_restore AND]} { 516 if {$ok} ias_push 517 return 518 } 519 520 set pos [icl_get] 521 522 eseq66 ; # (x (t &) 523 # (n SPACE)) 524 525 isv_nonterminal_leaf AND $pos 526 inc_save AND $pos 527 if {$ok} ias_push 528 ier_nonterminal "Expected AND" $pos 529 return 530} 531 532proc ::page::parse::peg::eseq66 {} { 533 534 # (x (t &) 535 # (n SPACE)) 536 537 variable ok 538 539 set pos [icl_get] 540 541 set old [ier_get] 542 ict_advance "Expected & (got EOF)" 543 if {$ok} {ict_match_token & "Expected &"} 544 ier_merge $old 545 546 if {!$ok} {icl_rewind $pos ; return} 547 548 set old [ier_get] 549 matchSymbol_SPACE ; # (n SPACE) 550 ier_merge $old 551 552 if {!$ok} {icl_rewind $pos ; return} 553 554 return 555} 556 557proc ::page::parse::peg::matchSymbol_APOSTROPH {} { 558 # APOSTROPH = (t ') 559 560 variable ok 561 if {[inc_restore APOSTROPH]} return 562 563 set pos [icl_get] 564 565 ict_advance "Expected ' (got EOF)" 566 if {$ok} {ict_match_token ' "Expected '"} 567 568 isv_clear 569 inc_save APOSTROPH $pos 570 ier_nonterminal "Expected APOSTROPH" $pos 571 return 572} 573 574proc ::page::parse::peg::matchSymbol_Attribute {} { 575 # Attribute = (x (/ (n VOID) 576 # (n LEAF) 577 # (n MATCH)) 578 # (n COLON)) 579 580 variable ok 581 if {[inc_restore Attribute]} { 582 if {$ok} ias_push 583 return 584 } 585 586 set pos [icl_get] 587 set mrk [ias_mark] 588 589 eseq7 ; # (x (/ (n VOID) 590 # (n LEAF) 591 # (n MATCH)) 592 # (n COLON)) 593 594 isv_nonterminal_reduce Attribute $pos $mrk 595 inc_save Attribute $pos 596 ias_pop2mark $mrk 597 if {$ok} ias_push 598 ier_nonterminal "Expected Attribute" $pos 599 return 600} 601 602proc ::page::parse::peg::eseq7 {} { 603 604 # (x (/ (n VOID) 605 # (n LEAF) 606 # (n MATCH)) 607 # (n COLON)) 608 609 variable ok 610 611 set pos [icl_get] 612 613 set mrk [ias_mark] 614 615 set old [ier_get] 616 ebra6 ; # (/ (n VOID) 617 # (n LEAF) 618 # (n MATCH)) 619 ier_merge $old 620 621 if {!$ok} { 622 ias_pop2mark $mrk 623 icl_rewind $pos 624 return 625 } 626 627 set old [ier_get] 628 matchSymbol_COLON ; # (n COLON) 629 ier_merge $old 630 631 if {!$ok} { 632 ias_pop2mark $mrk 633 icl_rewind $pos 634 return 635 } 636 637 return 638} 639 640proc ::page::parse::peg::ebra6 {} { 641 642 # (/ (n VOID) 643 # (n LEAF) 644 # (n MATCH)) 645 646 variable ok 647 648 set pos [icl_get] 649 650 set mrk [ias_mark] 651 set old [ier_get] 652 matchSymbol_VOID ; # (n VOID) 653 ier_merge $old 654 655 if {$ok} return 656 ias_pop2mark $mrk 657 icl_rewind $pos 658 659 set mrk [ias_mark] 660 set old [ier_get] 661 matchSymbol_LEAF ; # (n LEAF) 662 ier_merge $old 663 664 if {$ok} return 665 ias_pop2mark $mrk 666 icl_rewind $pos 667 668 set mrk [ias_mark] 669 set old [ier_get] 670 matchSymbol_MATCH ; # (n MATCH) 671 ier_merge $old 672 673 if {$ok} return 674 ias_pop2mark $mrk 675 icl_rewind $pos 676 677 return 678} 679 680proc ::page::parse::peg::matchSymbol_Char {} { 681 # Char = (/ (n CharSpecial) 682 # (n CharOctalFull) 683 # (n CharOctalPart) 684 # (n CharUnicode) 685 # (n CharUnescaped)) 686 687 variable ok 688 if {[inc_restore Char]} { 689 if {$ok} ias_push 690 return 691 } 692 693 set pos [icl_get] 694 set mrk [ias_mark] 695 696 ebra42 ; # (/ (n CharSpecial) 697 # (n CharOctalFull) 698 # (n CharOctalPart) 699 # (n CharUnicode) 700 # (n CharUnescaped)) 701 702 isv_nonterminal_reduce Char $pos $mrk 703 inc_save Char $pos 704 ias_pop2mark $mrk 705 if {$ok} ias_push 706 ier_nonterminal "Expected Char" $pos 707 return 708} 709 710proc ::page::parse::peg::ebra42 {} { 711 712 # (/ (n CharSpecial) 713 # (n CharOctalFull) 714 # (n CharOctalPart) 715 # (n CharUnicode) 716 # (n CharUnescaped)) 717 718 variable ok 719 720 set pos [icl_get] 721 722 set mrk [ias_mark] 723 set old [ier_get] 724 matchSymbol_CharSpecial ; # (n CharSpecial) 725 ier_merge $old 726 727 if {$ok} return 728 ias_pop2mark $mrk 729 icl_rewind $pos 730 731 set mrk [ias_mark] 732 set old [ier_get] 733 matchSymbol_CharOctalFull ; # (n CharOctalFull) 734 ier_merge $old 735 736 if {$ok} return 737 ias_pop2mark $mrk 738 icl_rewind $pos 739 740 set mrk [ias_mark] 741 set old [ier_get] 742 matchSymbol_CharOctalPart ; # (n CharOctalPart) 743 ier_merge $old 744 745 if {$ok} return 746 ias_pop2mark $mrk 747 icl_rewind $pos 748 749 set mrk [ias_mark] 750 set old [ier_get] 751 matchSymbol_CharUnicode ; # (n CharUnicode) 752 ier_merge $old 753 754 if {$ok} return 755 ias_pop2mark $mrk 756 icl_rewind $pos 757 758 set mrk [ias_mark] 759 set old [ier_get] 760 matchSymbol_CharUnescaped ; # (n CharUnescaped) 761 ier_merge $old 762 763 if {$ok} return 764 ias_pop2mark $mrk 765 icl_rewind $pos 766 767 return 768} 769 770proc ::page::parse::peg::matchSymbol_CharOctalFull {} { 771 # CharOctalFull = (x (t \) 772 # (.. 0 2) 773 # (.. 0 7) 774 # (.. 0 7)) 775 776 variable ok 777 if {[inc_restore CharOctalFull]} { 778 if {$ok} ias_push 779 return 780 } 781 782 set pos [icl_get] 783 784 eseq45 ; # (x (t \) 785 # (.. 0 2) 786 # (.. 0 7) 787 # (.. 0 7)) 788 789 isv_nonterminal_range CharOctalFull $pos 790 inc_save CharOctalFull $pos 791 if {$ok} ias_push 792 ier_nonterminal "Expected CharOctalFull" $pos 793 return 794} 795 796proc ::page::parse::peg::eseq45 {} { 797 798 # (x (t \) 799 # (.. 0 2) 800 # (.. 0 7) 801 # (.. 0 7)) 802 803 variable ok 804 805 set pos [icl_get] 806 807 set old [ier_get] 808 ict_advance "Expected \\ (got EOF)" 809 if {$ok} {ict_match_token \134 "Expected \\"} 810 ier_merge $old 811 812 if {!$ok} {icl_rewind $pos ; return} 813 814 set old [ier_get] 815 ict_advance "Expected \[0..2\] (got EOF)" 816 if {$ok} {ict_match_tokrange 0 2 "Expected \[0..2\]"} 817 ier_merge $old 818 819 if {!$ok} {icl_rewind $pos ; return} 820 821 set old [ier_get] 822 ict_advance "Expected \[0..7\] (got EOF)" 823 if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"} 824 ier_merge $old 825 826 if {!$ok} {icl_rewind $pos ; return} 827 828 set old [ier_get] 829 ict_advance "Expected \[0..7\] (got EOF)" 830 if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"} 831 ier_merge $old 832 833 if {!$ok} {icl_rewind $pos ; return} 834 835 return 836} 837 838proc ::page::parse::peg::matchSymbol_CharOctalPart {} { 839 # CharOctalPart = (x (t \) 840 # (.. 0 7) 841 # (? (.. 0 7))) 842 843 variable ok 844 if {[inc_restore CharOctalPart]} { 845 if {$ok} ias_push 846 return 847 } 848 849 set pos [icl_get] 850 851 eseq47 ; # (x (t \) 852 # (.. 0 7) 853 # (? (.. 0 7))) 854 855 isv_nonterminal_range CharOctalPart $pos 856 inc_save CharOctalPart $pos 857 if {$ok} ias_push 858 ier_nonterminal "Expected CharOctalPart" $pos 859 return 860} 861 862proc ::page::parse::peg::eseq47 {} { 863 864 # (x (t \) 865 # (.. 0 7) 866 # (? (.. 0 7))) 867 868 variable ok 869 870 set pos [icl_get] 871 872 set old [ier_get] 873 ict_advance "Expected \\ (got EOF)" 874 if {$ok} {ict_match_token \134 "Expected \\"} 875 ier_merge $old 876 877 if {!$ok} {icl_rewind $pos ; return} 878 879 set old [ier_get] 880 ict_advance "Expected \[0..7\] (got EOF)" 881 if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"} 882 ier_merge $old 883 884 if {!$ok} {icl_rewind $pos ; return} 885 886 set old [ier_get] 887 eopt46 ; # (? (.. 0 7)) 888 ier_merge $old 889 890 if {!$ok} {icl_rewind $pos ; return} 891 892 return 893} 894 895proc ::page::parse::peg::eopt46 {} { 896 897 # (? (.. 0 7)) 898 899 variable ok 900 901 set pos [icl_get] 902 903 set old [ier_get] 904 ict_advance "Expected \[0..7\] (got EOF)" 905 if {$ok} {ict_match_tokrange 0 7 "Expected \[0..7\]"} 906 ier_merge $old 907 908 if {$ok} return 909 icl_rewind $pos 910 iok_ok 911 return 912} 913 914proc ::page::parse::peg::matchSymbol_CharSpecial {} { 915 # CharSpecial = (x (t \) 916 # (/ (t n) 917 # (t r) 918 # (t t) 919 # (t ') 920 # (t \") 921 # (t [) 922 # (t ]) 923 # (t \))) 924 925 variable ok 926 if {[inc_restore CharSpecial]} { 927 if {$ok} ias_push 928 return 929 } 930 931 set pos [icl_get] 932 933 eseq44 ; # (x (t \) 934 # (/ (t n) 935 # (t r) 936 # (t t) 937 # (t ') 938 # (t \") 939 # (t [) 940 # (t ]) 941 # (t \))) 942 943 isv_nonterminal_range CharSpecial $pos 944 inc_save CharSpecial $pos 945 if {$ok} ias_push 946 ier_nonterminal "Expected CharSpecial" $pos 947 return 948} 949 950proc ::page::parse::peg::eseq44 {} { 951 952 # (x (t \) 953 # (/ (t n) 954 # (t r) 955 # (t t) 956 # (t ') 957 # (t \") 958 # (t [) 959 # (t ]) 960 # (t \))) 961 962 variable ok 963 964 set pos [icl_get] 965 966 set old [ier_get] 967 ict_advance "Expected \\ (got EOF)" 968 if {$ok} {ict_match_token \134 "Expected \\"} 969 ier_merge $old 970 971 if {!$ok} {icl_rewind $pos ; return} 972 973 set old [ier_get] 974 ebra43 ; # (/ (t n) 975 # (t r) 976 # (t t) 977 # (t ') 978 # (t \") 979 # (t [) 980 # (t ]) 981 # (t \)) 982 ier_merge $old 983 984 if {!$ok} {icl_rewind $pos ; return} 985 986 return 987} 988 989proc ::page::parse::peg::ebra43 {} { 990 991 # (/ (t n) 992 # (t r) 993 # (t t) 994 # (t ') 995 # (t \") 996 # (t [) 997 # (t ]) 998 # (t \)) 999 1000 variable ok 1001 1002 set pos [icl_get] 1003 1004 set old [ier_get] 1005 ict_advance "Expected n (got EOF)" 1006 if {$ok} {ict_match_token n "Expected n"} 1007 ier_merge $old 1008 1009 if {$ok} return 1010 icl_rewind $pos 1011 1012 set old [ier_get] 1013 ict_advance "Expected r (got EOF)" 1014 if {$ok} {ict_match_token r "Expected r"} 1015 ier_merge $old 1016 1017 if {$ok} return 1018 icl_rewind $pos 1019 1020 set old [ier_get] 1021 ict_advance "Expected t (got EOF)" 1022 if {$ok} {ict_match_token t "Expected t"} 1023 ier_merge $old 1024 1025 if {$ok} return 1026 icl_rewind $pos 1027 1028 set old [ier_get] 1029 ict_advance "Expected ' (got EOF)" 1030 if {$ok} {ict_match_token ' "Expected '"} 1031 ier_merge $old 1032 1033 if {$ok} return 1034 icl_rewind $pos 1035 1036 set old [ier_get] 1037 ict_advance "Expected \" (got EOF)" 1038 if {$ok} {ict_match_token \42 "Expected \""} 1039 ier_merge $old 1040 1041 if {$ok} return 1042 icl_rewind $pos 1043 1044 set old [ier_get] 1045 ict_advance "Expected \[ (got EOF)" 1046 if {$ok} {ict_match_token \133 "Expected \["} 1047 ier_merge $old 1048 1049 if {$ok} return 1050 icl_rewind $pos 1051 1052 set old [ier_get] 1053 ict_advance "Expected \] (got EOF)" 1054 if {$ok} {ict_match_token \135 "Expected \]"} 1055 ier_merge $old 1056 1057 if {$ok} return 1058 icl_rewind $pos 1059 1060 set old [ier_get] 1061 ict_advance "Expected \\ (got EOF)" 1062 if {$ok} {ict_match_token \134 "Expected \\"} 1063 ier_merge $old 1064 1065 if {$ok} return 1066 icl_rewind $pos 1067 1068 return 1069} 1070 1071proc ::page::parse::peg::matchSymbol_CharUnescaped {} { 1072 # CharUnescaped = (x (! (t \)) 1073 # (dot)) 1074 1075 variable ok 1076 if {[inc_restore CharUnescaped]} { 1077 if {$ok} ias_push 1078 return 1079 } 1080 1081 set pos [icl_get] 1082 1083 eseq55 ; # (x (! (t \)) 1084 # (dot)) 1085 1086 isv_nonterminal_range CharUnescaped $pos 1087 inc_save CharUnescaped $pos 1088 if {$ok} ias_push 1089 ier_nonterminal "Expected CharUnescaped" $pos 1090 return 1091} 1092 1093proc ::page::parse::peg::eseq55 {} { 1094 1095 # (x (! (t \)) 1096 # (dot)) 1097 1098 variable ok 1099 1100 set pos [icl_get] 1101 1102 set old [ier_get] 1103 ebang54 1104 ier_merge $old 1105 1106 if {!$ok} {icl_rewind $pos ; return} 1107 1108 set old [ier_get] 1109 ict_advance "Expected any character (got EOF)" 1110 ier_merge $old 1111 1112 if {!$ok} {icl_rewind $pos ; return} 1113 1114 return 1115} 1116 1117proc ::page::parse::peg::ebang54 {} { 1118 variable ok 1119 1120 set pos [icl_get] 1121 1122 ict_advance "Expected \\ (got EOF)" 1123 if {$ok} {ict_match_token \134 "Expected \\"} 1124 1125 icl_rewind $pos 1126 iok_negate 1127 return 1128} 1129 1130proc ::page::parse::peg::matchSymbol_CharUnicode {} { 1131 # CharUnicode = (x (t \) 1132 # (t u) 1133 # (n HexDigit) 1134 # (? (x (n HexDigit) 1135 # (? (x (n HexDigit) 1136 # (? (n HexDigit))))))) 1137 1138 variable ok 1139 if {[inc_restore CharUnicode]} { 1140 if {$ok} ias_push 1141 return 1142 } 1143 1144 set pos [icl_get] 1145 1146 eseq53 ; # (x (t \) 1147 # (t u) 1148 # (n HexDigit) 1149 # (? (x (n HexDigit) 1150 # (? (x (n HexDigit) 1151 # (? (n HexDigit))))))) 1152 1153 isv_nonterminal_range CharUnicode $pos 1154 inc_save CharUnicode $pos 1155 if {$ok} ias_push 1156 ier_nonterminal "Expected CharUnicode" $pos 1157 return 1158} 1159 1160proc ::page::parse::peg::eseq53 {} { 1161 1162 # (x (t \) 1163 # (t u) 1164 # (n HexDigit) 1165 # (? (x (n HexDigit) 1166 # (? (x (n HexDigit) 1167 # (? (n HexDigit))))))) 1168 1169 variable ok 1170 1171 set pos [icl_get] 1172 1173 set old [ier_get] 1174 ict_advance "Expected \\ (got EOF)" 1175 if {$ok} {ict_match_token \134 "Expected \\"} 1176 ier_merge $old 1177 1178 if {!$ok} {icl_rewind $pos ; return} 1179 1180 set old [ier_get] 1181 ict_advance "Expected u (got EOF)" 1182 if {$ok} {ict_match_token u "Expected u"} 1183 ier_merge $old 1184 1185 if {!$ok} {icl_rewind $pos ; return} 1186 1187 set old [ier_get] 1188 matchSymbol_HexDigit ; # (n HexDigit) 1189 ier_merge $old 1190 1191 if {!$ok} {icl_rewind $pos ; return} 1192 1193 set old [ier_get] 1194 eopt52 ; # (? (x (n HexDigit) 1195 # (? (x (n HexDigit) 1196 # (? (n HexDigit)))))) 1197 ier_merge $old 1198 1199 if {!$ok} {icl_rewind $pos ; return} 1200 1201 return 1202} 1203 1204proc ::page::parse::peg::eopt52 {} { 1205 1206 # (? (x (n HexDigit) 1207 # (? (x (n HexDigit) 1208 # (? (n HexDigit)))))) 1209 1210 variable ok 1211 1212 set pos [icl_get] 1213 1214 set old [ier_get] 1215 eseq51 ; # (x (n HexDigit) 1216 # (? (x (n HexDigit) 1217 # (? (n HexDigit))))) 1218 ier_merge $old 1219 1220 if {$ok} return 1221 icl_rewind $pos 1222 iok_ok 1223 return 1224} 1225 1226proc ::page::parse::peg::eseq51 {} { 1227 1228 # (x (n HexDigit) 1229 # (? (x (n HexDigit) 1230 # (? (n HexDigit))))) 1231 1232 variable ok 1233 1234 set pos [icl_get] 1235 1236 set old [ier_get] 1237 matchSymbol_HexDigit ; # (n HexDigit) 1238 ier_merge $old 1239 1240 if {!$ok} {icl_rewind $pos ; return} 1241 1242 set old [ier_get] 1243 eopt50 ; # (? (x (n HexDigit) 1244 # (? (n HexDigit)))) 1245 ier_merge $old 1246 1247 if {!$ok} {icl_rewind $pos ; return} 1248 1249 return 1250} 1251 1252proc ::page::parse::peg::eopt50 {} { 1253 1254 # (? (x (n HexDigit) 1255 # (? (n HexDigit)))) 1256 1257 variable ok 1258 1259 set pos [icl_get] 1260 1261 set old [ier_get] 1262 eseq49 ; # (x (n HexDigit) 1263 # (? (n HexDigit))) 1264 ier_merge $old 1265 1266 if {$ok} return 1267 icl_rewind $pos 1268 iok_ok 1269 return 1270} 1271 1272proc ::page::parse::peg::eseq49 {} { 1273 1274 # (x (n HexDigit) 1275 # (? (n HexDigit))) 1276 1277 variable ok 1278 1279 set pos [icl_get] 1280 1281 set old [ier_get] 1282 matchSymbol_HexDigit ; # (n HexDigit) 1283 ier_merge $old 1284 1285 if {!$ok} {icl_rewind $pos ; return} 1286 1287 set old [ier_get] 1288 eopt48 ; # (? (n HexDigit)) 1289 ier_merge $old 1290 1291 if {!$ok} {icl_rewind $pos ; return} 1292 1293 return 1294} 1295 1296proc ::page::parse::peg::eopt48 {} { 1297 1298 # (? (n HexDigit)) 1299 1300 variable ok 1301 1302 set pos [icl_get] 1303 1304 set old [ier_get] 1305 matchSymbol_HexDigit ; # (n HexDigit) 1306 ier_merge $old 1307 1308 if {$ok} return 1309 icl_rewind $pos 1310 iok_ok 1311 return 1312} 1313 1314proc ::page::parse::peg::matchSymbol_Class {} { 1315 # Class = (x (n OPENB) 1316 # (* (x (! (n CLOSEB)) 1317 # (n Range))) 1318 # (n CLOSEB) 1319 # (n SPACE)) 1320 1321 variable ok 1322 if {[inc_restore Class]} { 1323 if {$ok} ias_push 1324 return 1325 } 1326 1327 set pos [icl_get] 1328 set mrk [ias_mark] 1329 1330 eseq32 ; # (x (n OPENB) 1331 # (* (x (! (n CLOSEB)) 1332 # (n Range))) 1333 # (n CLOSEB) 1334 # (n SPACE)) 1335 1336 isv_nonterminal_reduce Class $pos $mrk 1337 inc_save Class $pos 1338 ias_pop2mark $mrk 1339 if {$ok} ias_push 1340 ier_nonterminal "Expected Class" $pos 1341 return 1342} 1343 1344proc ::page::parse::peg::eseq32 {} { 1345 1346 # (x (n OPENB) 1347 # (* (x (! (n CLOSEB)) 1348 # (n Range))) 1349 # (n CLOSEB) 1350 # (n SPACE)) 1351 1352 variable ok 1353 1354 set pos [icl_get] 1355 1356 set old [ier_get] 1357 matchSymbol_OPENB ; # (n OPENB) 1358 ier_merge $old 1359 1360 if {!$ok} {icl_rewind $pos ; return} 1361 1362 set mrk [ias_mark] 1363 1364 set old [ier_get] 1365 ekleene31 ; # (* (x (! (n CLOSEB)) 1366 # (n Range))) 1367 ier_merge $old 1368 1369 if {!$ok} { 1370 ias_pop2mark $mrk 1371 icl_rewind $pos 1372 return 1373 } 1374 1375 set old [ier_get] 1376 matchSymbol_CLOSEB ; # (n CLOSEB) 1377 ier_merge $old 1378 1379 if {!$ok} { 1380 ias_pop2mark $mrk 1381 icl_rewind $pos 1382 return 1383 } 1384 1385 set old [ier_get] 1386 matchSymbol_SPACE ; # (n SPACE) 1387 ier_merge $old 1388 1389 if {!$ok} { 1390 ias_pop2mark $mrk 1391 icl_rewind $pos 1392 return 1393 } 1394 1395 return 1396} 1397 1398proc ::page::parse::peg::ekleene31 {} { 1399 1400 # (* (x (! (n CLOSEB)) 1401 # (n Range))) 1402 1403 variable ok 1404 1405 while {1} { 1406 set pos [icl_get] 1407 1408 set old [ier_get] 1409 eseq30 ; # (x (! (n CLOSEB)) 1410 # (n Range)) 1411 ier_merge $old 1412 1413 if {$ok} continue 1414 break 1415 } 1416 1417 icl_rewind $pos 1418 iok_ok 1419 return 1420} 1421 1422proc ::page::parse::peg::eseq30 {} { 1423 1424 # (x (! (n CLOSEB)) 1425 # (n Range)) 1426 1427 variable ok 1428 1429 set pos [icl_get] 1430 1431 set old [ier_get] 1432 ebang29 1433 ier_merge $old 1434 1435 if {!$ok} {icl_rewind $pos ; return} 1436 1437 set mrk [ias_mark] 1438 1439 set old [ier_get] 1440 matchSymbol_Range ; # (n Range) 1441 ier_merge $old 1442 1443 if {!$ok} { 1444 ias_pop2mark $mrk 1445 icl_rewind $pos 1446 return 1447 } 1448 1449 return 1450} 1451 1452proc ::page::parse::peg::ebang29 {} { 1453 set pos [icl_get] 1454 1455 matchSymbol_CLOSEB ; # (n CLOSEB) 1456 1457 icl_rewind $pos 1458 iok_negate 1459 return 1460} 1461 1462proc ::page::parse::peg::matchSymbol_CLOSE {} { 1463 # CLOSE = (x (t \)) 1464 # (n SPACE)) 1465 1466 if {[inc_restore CLOSE]} return 1467 1468 set pos [icl_get] 1469 1470 eseq72 ; # (x (t \)) 1471 # (n SPACE)) 1472 1473 isv_clear 1474 inc_save CLOSE $pos 1475 ier_nonterminal "Expected CLOSE" $pos 1476 return 1477} 1478 1479proc ::page::parse::peg::eseq72 {} { 1480 1481 # (x (t \)) 1482 # (n SPACE)) 1483 1484 variable ok 1485 1486 set pos [icl_get] 1487 1488 set old [ier_get] 1489 ict_advance "Expected \) (got EOF)" 1490 if {$ok} {ict_match_token \51 "Expected \)"} 1491 ier_merge $old 1492 1493 if {!$ok} {icl_rewind $pos ; return} 1494 1495 set old [ier_get] 1496 matchSymbol_SPACE ; # (n SPACE) 1497 ier_merge $old 1498 1499 if {!$ok} {icl_rewind $pos ; return} 1500 1501 return 1502} 1503 1504proc ::page::parse::peg::matchSymbol_CLOSEB {} { 1505 # CLOSEB = (t ]) 1506 1507 variable ok 1508 if {[inc_restore CLOSEB]} return 1509 1510 set pos [icl_get] 1511 1512 ict_advance "Expected \] (got EOF)" 1513 if {$ok} {ict_match_token \135 "Expected \]"} 1514 1515 isv_clear 1516 inc_save CLOSEB $pos 1517 ier_nonterminal "Expected CLOSEB" $pos 1518 return 1519} 1520 1521proc ::page::parse::peg::matchSymbol_COLON {} { 1522 # COLON = (x (t :) 1523 # (n SPACE)) 1524 1525 if {[inc_restore COLON]} return 1526 1527 set pos [icl_get] 1528 1529 eseq64 ; # (x (t :) 1530 # (n SPACE)) 1531 1532 isv_clear 1533 inc_save COLON $pos 1534 ier_nonterminal "Expected COLON" $pos 1535 return 1536} 1537 1538proc ::page::parse::peg::eseq64 {} { 1539 1540 # (x (t :) 1541 # (n SPACE)) 1542 1543 variable ok 1544 1545 set pos [icl_get] 1546 1547 set old [ier_get] 1548 ict_advance "Expected : (got EOF)" 1549 if {$ok} {ict_match_token : "Expected :"} 1550 ier_merge $old 1551 1552 if {!$ok} {icl_rewind $pos ; return} 1553 1554 set old [ier_get] 1555 matchSymbol_SPACE ; # (n SPACE) 1556 ier_merge $old 1557 1558 if {!$ok} {icl_rewind $pos ; return} 1559 1560 return 1561} 1562 1563proc ::page::parse::peg::matchSymbol_COMMENT {} { 1564 # COMMENT = (x (t #) 1565 # (* (x (! (n EOL)) 1566 # (dot))) 1567 # (n EOL)) 1568 1569 if {[inc_restore COMMENT]} return 1570 1571 set pos [icl_get] 1572 1573 eseq81 ; # (x (t #) 1574 # (* (x (! (n EOL)) 1575 # (dot))) 1576 # (n EOL)) 1577 1578 isv_clear 1579 inc_save COMMENT $pos 1580 ier_nonterminal "Expected COMMENT" $pos 1581 return 1582} 1583 1584proc ::page::parse::peg::eseq81 {} { 1585 1586 # (x (t #) 1587 # (* (x (! (n EOL)) 1588 # (dot))) 1589 # (n EOL)) 1590 1591 variable ok 1592 1593 set pos [icl_get] 1594 1595 set old [ier_get] 1596 ict_advance "Expected # (got EOF)" 1597 if {$ok} {ict_match_token # "Expected #"} 1598 ier_merge $old 1599 1600 if {!$ok} {icl_rewind $pos ; return} 1601 1602 set old [ier_get] 1603 ekleene80 ; # (* (x (! (n EOL)) 1604 # (dot))) 1605 ier_merge $old 1606 1607 if {!$ok} {icl_rewind $pos ; return} 1608 1609 set old [ier_get] 1610 matchSymbol_EOL ; # (n EOL) 1611 ier_merge $old 1612 1613 if {!$ok} {icl_rewind $pos ; return} 1614 1615 return 1616} 1617 1618proc ::page::parse::peg::ekleene80 {} { 1619 1620 # (* (x (! (n EOL)) 1621 # (dot))) 1622 1623 variable ok 1624 1625 while {1} { 1626 set pos [icl_get] 1627 1628 set old [ier_get] 1629 eseq79 ; # (x (! (n EOL)) 1630 # (dot)) 1631 ier_merge $old 1632 1633 if {$ok} continue 1634 break 1635 } 1636 1637 icl_rewind $pos 1638 iok_ok 1639 return 1640} 1641 1642proc ::page::parse::peg::eseq79 {} { 1643 1644 # (x (! (n EOL)) 1645 # (dot)) 1646 1647 variable ok 1648 1649 set pos [icl_get] 1650 1651 set old [ier_get] 1652 ebang78 1653 ier_merge $old 1654 1655 if {!$ok} {icl_rewind $pos ; return} 1656 1657 set old [ier_get] 1658 ict_advance "Expected any character (got EOF)" 1659 ier_merge $old 1660 1661 if {!$ok} {icl_rewind $pos ; return} 1662 1663 return 1664} 1665 1666proc ::page::parse::peg::ebang78 {} { 1667 set pos [icl_get] 1668 1669 matchSymbol_EOL ; # (n EOL) 1670 1671 icl_rewind $pos 1672 iok_negate 1673 return 1674} 1675 1676proc ::page::parse::peg::matchSymbol_DAPOSTROPH {} { 1677 # DAPOSTROPH = (t \") 1678 1679 variable ok 1680 if {[inc_restore DAPOSTROPH]} return 1681 1682 set pos [icl_get] 1683 1684 ict_advance "Expected \" (got EOF)" 1685 if {$ok} {ict_match_token \42 "Expected \""} 1686 1687 isv_clear 1688 inc_save DAPOSTROPH $pos 1689 ier_nonterminal "Expected DAPOSTROPH" $pos 1690 return 1691} 1692 1693proc ::page::parse::peg::matchSymbol_Definition {} { 1694 # Definition = (x (? (n Attribute)) 1695 # (n Identifier) 1696 # (n IS) 1697 # (n Expression) 1698 # (n SEMICOLON)) 1699 1700 variable ok 1701 if {[inc_restore Definition]} { 1702 if {$ok} ias_push 1703 return 1704 } 1705 1706 set pos [icl_get] 1707 set mrk [ias_mark] 1708 1709 eseq5 ; # (x (? (n Attribute)) 1710 # (n Identifier) 1711 # (n IS) 1712 # (n Expression) 1713 # (n SEMICOLON)) 1714 1715 isv_nonterminal_reduce Definition $pos $mrk 1716 inc_save Definition $pos 1717 ias_pop2mark $mrk 1718 if {$ok} ias_push 1719 ier_nonterminal "Expected Definition" $pos 1720 return 1721} 1722 1723proc ::page::parse::peg::eseq5 {} { 1724 1725 # (x (? (n Attribute)) 1726 # (n Identifier) 1727 # (n IS) 1728 # (n Expression) 1729 # (n SEMICOLON)) 1730 1731 variable ok 1732 1733 set pos [icl_get] 1734 1735 set mrk [ias_mark] 1736 1737 set old [ier_get] 1738 eopt4 ; # (? (n Attribute)) 1739 ier_merge $old 1740 1741 if {!$ok} { 1742 ias_pop2mark $mrk 1743 icl_rewind $pos 1744 return 1745 } 1746 1747 set old [ier_get] 1748 matchSymbol_Identifier ; # (n Identifier) 1749 ier_merge $old 1750 1751 if {!$ok} { 1752 ias_pop2mark $mrk 1753 icl_rewind $pos 1754 return 1755 } 1756 1757 set old [ier_get] 1758 matchSymbol_IS ; # (n IS) 1759 ier_merge $old 1760 1761 if {!$ok} { 1762 ias_pop2mark $mrk 1763 icl_rewind $pos 1764 return 1765 } 1766 1767 set old [ier_get] 1768 matchSymbol_Expression ; # (n Expression) 1769 ier_merge $old 1770 1771 if {!$ok} { 1772 ias_pop2mark $mrk 1773 icl_rewind $pos 1774 return 1775 } 1776 1777 set old [ier_get] 1778 matchSymbol_SEMICOLON ; # (n SEMICOLON) 1779 ier_merge $old 1780 1781 if {!$ok} { 1782 ias_pop2mark $mrk 1783 icl_rewind $pos 1784 return 1785 } 1786 1787 return 1788} 1789 1790proc ::page::parse::peg::eopt4 {} { 1791 1792 # (? (n Attribute)) 1793 1794 variable ok 1795 1796 set pos [icl_get] 1797 1798 set old [ier_get] 1799 matchSymbol_Attribute ; # (n Attribute) 1800 ier_merge $old 1801 1802 if {$ok} return 1803 icl_rewind $pos 1804 iok_ok 1805 return 1806} 1807 1808proc ::page::parse::peg::matchSymbol_DOT {} { 1809 # DOT = (x (t .) 1810 # (n SPACE)) 1811 1812 variable ok 1813 if {[inc_restore DOT]} { 1814 if {$ok} ias_push 1815 return 1816 } 1817 1818 set pos [icl_get] 1819 1820 eseq73 ; # (x (t .) 1821 # (n SPACE)) 1822 1823 isv_nonterminal_leaf DOT $pos 1824 inc_save DOT $pos 1825 if {$ok} ias_push 1826 ier_nonterminal "Expected DOT" $pos 1827 return 1828} 1829 1830proc ::page::parse::peg::eseq73 {} { 1831 1832 # (x (t .) 1833 # (n SPACE)) 1834 1835 variable ok 1836 1837 set pos [icl_get] 1838 1839 set old [ier_get] 1840 ict_advance "Expected . (got EOF)" 1841 if {$ok} {ict_match_token . "Expected ."} 1842 ier_merge $old 1843 1844 if {!$ok} {icl_rewind $pos ; return} 1845 1846 set old [ier_get] 1847 matchSymbol_SPACE ; # (n SPACE) 1848 ier_merge $old 1849 1850 if {!$ok} {icl_rewind $pos ; return} 1851 1852 return 1853} 1854 1855proc ::page::parse::peg::matchSymbol_END {} { 1856 # END = (x (t E) 1857 # (t N) 1858 # (t D) 1859 # (n SPACE)) 1860 1861 if {[inc_restore END]} return 1862 1863 set pos [icl_get] 1864 1865 eseq62 ; # (x (t E) 1866 # (t N) 1867 # (t D) 1868 # (n SPACE)) 1869 1870 isv_clear 1871 inc_save END $pos 1872 ier_nonterminal "Expected END" $pos 1873 return 1874} 1875 1876proc ::page::parse::peg::eseq62 {} { 1877 1878 # (x (t E) 1879 # (t N) 1880 # (t D) 1881 # (n SPACE)) 1882 1883 variable ok 1884 1885 set pos [icl_get] 1886 1887 set old [ier_get] 1888 ict_advance "Expected E (got EOF)" 1889 if {$ok} {ict_match_token E "Expected E"} 1890 ier_merge $old 1891 1892 if {!$ok} {icl_rewind $pos ; return} 1893 1894 set old [ier_get] 1895 ict_advance "Expected N (got EOF)" 1896 if {$ok} {ict_match_token N "Expected N"} 1897 ier_merge $old 1898 1899 if {!$ok} {icl_rewind $pos ; return} 1900 1901 set old [ier_get] 1902 ict_advance "Expected D (got EOF)" 1903 if {$ok} {ict_match_token D "Expected D"} 1904 ier_merge $old 1905 1906 if {!$ok} {icl_rewind $pos ; return} 1907 1908 set old [ier_get] 1909 matchSymbol_SPACE ; # (n SPACE) 1910 ier_merge $old 1911 1912 if {!$ok} {icl_rewind $pos ; return} 1913 1914 return 1915} 1916 1917proc ::page::parse::peg::matchSymbol_EOF {} { 1918 # EOF = (! (dot)) 1919 1920 if {[inc_restore EOF]} return 1921 1922 set pos [icl_get] 1923 1924 ebang84 1925 1926 isv_clear 1927 inc_save EOF $pos 1928 ier_nonterminal "Expected EOF" $pos 1929 return 1930} 1931 1932proc ::page::parse::peg::ebang84 {} { 1933 set pos [icl_get] 1934 1935 ict_advance "Expected any character (got EOF)" 1936 1937 icl_rewind $pos 1938 iok_negate 1939 return 1940} 1941 1942proc ::page::parse::peg::matchSymbol_EOL {} { 1943 # EOL = (/ (x (t \n) 1944 # (t \r)) 1945 # (t \n) 1946 # (t \r)) 1947 1948 if {[inc_restore EOL]} return 1949 1950 set pos [icl_get] 1951 1952 ebra83 ; # (/ (x (t \n) 1953 # (t \r)) 1954 # (t \n) 1955 # (t \r)) 1956 1957 isv_clear 1958 inc_save EOL $pos 1959 ier_nonterminal "Expected EOL" $pos 1960 return 1961} 1962 1963proc ::page::parse::peg::ebra83 {} { 1964 1965 # (/ (x (t \n) 1966 # (t \r)) 1967 # (t \n) 1968 # (t \r)) 1969 1970 variable ok 1971 1972 set pos [icl_get] 1973 1974 set old [ier_get] 1975 eseq82 ; # (x (t \n) 1976 # (t \r)) 1977 ier_merge $old 1978 1979 if {$ok} return 1980 icl_rewind $pos 1981 1982 set old [ier_get] 1983 ict_advance "Expected \\n (got EOF)" 1984 if {$ok} {ict_match_token \n "Expected \\n"} 1985 ier_merge $old 1986 1987 if {$ok} return 1988 icl_rewind $pos 1989 1990 set old [ier_get] 1991 ict_advance "Expected \\r (got EOF)" 1992 if {$ok} {ict_match_token \r "Expected \\r"} 1993 ier_merge $old 1994 1995 if {$ok} return 1996 icl_rewind $pos 1997 1998 return 1999} 2000 2001proc ::page::parse::peg::eseq82 {} { 2002 2003 # (x (t \n) 2004 # (t \r)) 2005 2006 variable ok 2007 2008 set pos [icl_get] 2009 2010 set old [ier_get] 2011 ict_advance "Expected \\n (got EOF)" 2012 if {$ok} {ict_match_token \n "Expected \\n"} 2013 ier_merge $old 2014 2015 if {!$ok} {icl_rewind $pos ; return} 2016 2017 set old [ier_get] 2018 ict_advance "Expected \\r (got EOF)" 2019 if {$ok} {ict_match_token \r "Expected \\r"} 2020 ier_merge $old 2021 2022 if {!$ok} {icl_rewind $pos ; return} 2023 2024 return 2025} 2026 2027proc ::page::parse::peg::matchSymbol_Expression {} { 2028 # Expression = (x (n Sequence) 2029 # (* (x (n SLASH) 2030 # (n Sequence)))) 2031 2032 variable ok 2033 if {[inc_restore Expression]} { 2034 if {$ok} ias_push 2035 return 2036 } 2037 2038 set pos [icl_get] 2039 set mrk [ias_mark] 2040 2041 eseq10 ; # (x (n Sequence) 2042 # (* (x (n SLASH) 2043 # (n Sequence)))) 2044 2045 isv_nonterminal_reduce Expression $pos $mrk 2046 inc_save Expression $pos 2047 ias_pop2mark $mrk 2048 if {$ok} ias_push 2049 ier_nonterminal "Expected Expression" $pos 2050 return 2051} 2052 2053proc ::page::parse::peg::eseq10 {} { 2054 2055 # (x (n Sequence) 2056 # (* (x (n SLASH) 2057 # (n Sequence)))) 2058 2059 variable ok 2060 2061 set pos [icl_get] 2062 2063 set mrk [ias_mark] 2064 2065 set old [ier_get] 2066 matchSymbol_Sequence ; # (n Sequence) 2067 ier_merge $old 2068 2069 if {!$ok} { 2070 ias_pop2mark $mrk 2071 icl_rewind $pos 2072 return 2073 } 2074 2075 set old [ier_get] 2076 ekleene9 ; # (* (x (n SLASH) 2077 # (n Sequence))) 2078 ier_merge $old 2079 2080 if {!$ok} { 2081 ias_pop2mark $mrk 2082 icl_rewind $pos 2083 return 2084 } 2085 2086 return 2087} 2088 2089proc ::page::parse::peg::ekleene9 {} { 2090 2091 # (* (x (n SLASH) 2092 # (n Sequence))) 2093 2094 variable ok 2095 2096 while {1} { 2097 set pos [icl_get] 2098 2099 set old [ier_get] 2100 eseq8 ; # (x (n SLASH) 2101 # (n Sequence)) 2102 ier_merge $old 2103 2104 if {$ok} continue 2105 break 2106 } 2107 2108 icl_rewind $pos 2109 iok_ok 2110 return 2111} 2112 2113proc ::page::parse::peg::eseq8 {} { 2114 2115 # (x (n SLASH) 2116 # (n Sequence)) 2117 2118 variable ok 2119 2120 set pos [icl_get] 2121 2122 set old [ier_get] 2123 matchSymbol_SLASH ; # (n SLASH) 2124 ier_merge $old 2125 2126 if {!$ok} {icl_rewind $pos ; return} 2127 2128 set mrk [ias_mark] 2129 2130 set old [ier_get] 2131 matchSymbol_Sequence ; # (n Sequence) 2132 ier_merge $old 2133 2134 if {!$ok} { 2135 ias_pop2mark $mrk 2136 icl_rewind $pos 2137 return 2138 } 2139 2140 return 2141} 2142 2143proc ::page::parse::peg::matchSymbol_Final {} { 2144 # Final = (x (n END) 2145 # (n SEMICOLON) 2146 # (n SPACE)) 2147 2148 if {[inc_restore Final]} return 2149 2150 set pos [icl_get] 2151 2152 eseq36 ; # (x (n END) 2153 # (n SEMICOLON) 2154 # (n SPACE)) 2155 2156 isv_clear 2157 inc_save Final $pos 2158 ier_nonterminal "Expected Final" $pos 2159 return 2160} 2161 2162proc ::page::parse::peg::eseq36 {} { 2163 2164 # (x (n END) 2165 # (n SEMICOLON) 2166 # (n SPACE)) 2167 2168 variable ok 2169 2170 set pos [icl_get] 2171 2172 set old [ier_get] 2173 matchSymbol_END ; # (n END) 2174 ier_merge $old 2175 2176 if {!$ok} {icl_rewind $pos ; return} 2177 2178 set old [ier_get] 2179 matchSymbol_SEMICOLON ; # (n SEMICOLON) 2180 ier_merge $old 2181 2182 if {!$ok} {icl_rewind $pos ; return} 2183 2184 set old [ier_get] 2185 matchSymbol_SPACE ; # (n SPACE) 2186 ier_merge $old 2187 2188 if {!$ok} {icl_rewind $pos ; return} 2189 2190 return 2191} 2192 2193proc ::page::parse::peg::matchSymbol_Grammar {} { 2194 # Grammar = (x (n SPACE) 2195 # (n Header) 2196 # (+ (n Definition)) 2197 # (n Final) 2198 # (n EOF)) 2199 2200 variable ok 2201 if {[inc_restore Grammar]} { 2202 if {$ok} ias_push 2203 return 2204 } 2205 2206 set pos [icl_get] 2207 set mrk [ias_mark] 2208 2209 eseq2 ; # (x (n SPACE) 2210 # (n Header) 2211 # (+ (n Definition)) 2212 # (n Final) 2213 # (n EOF)) 2214 2215 isv_nonterminal_reduce Grammar $pos $mrk 2216 inc_save Grammar $pos 2217 ias_pop2mark $mrk 2218 if {$ok} ias_push 2219 ier_nonterminal "Expected Grammar" $pos 2220 return 2221} 2222 2223proc ::page::parse::peg::eseq2 {} { 2224 2225 # (x (n SPACE) 2226 # (n Header) 2227 # (+ (n Definition)) 2228 # (n Final) 2229 # (n EOF)) 2230 2231 variable ok 2232 2233 set pos [icl_get] 2234 2235 set old [ier_get] 2236 matchSymbol_SPACE ; # (n SPACE) 2237 ier_merge $old 2238 2239 if {!$ok} {icl_rewind $pos ; return} 2240 2241 set mrk [ias_mark] 2242 2243 set old [ier_get] 2244 matchSymbol_Header ; # (n Header) 2245 ier_merge $old 2246 2247 if {!$ok} { 2248 ias_pop2mark $mrk 2249 icl_rewind $pos 2250 return 2251 } 2252 2253 set old [ier_get] 2254 epkleene1 ; # (+ (n Definition)) 2255 ier_merge $old 2256 2257 if {!$ok} { 2258 ias_pop2mark $mrk 2259 icl_rewind $pos 2260 return 2261 } 2262 2263 set old [ier_get] 2264 matchSymbol_Final ; # (n Final) 2265 ier_merge $old 2266 2267 if {!$ok} { 2268 ias_pop2mark $mrk 2269 icl_rewind $pos 2270 return 2271 } 2272 2273 set old [ier_get] 2274 matchSymbol_EOF ; # (n EOF) 2275 ier_merge $old 2276 2277 if {!$ok} { 2278 ias_pop2mark $mrk 2279 icl_rewind $pos 2280 return 2281 } 2282 2283 return 2284} 2285 2286proc ::page::parse::peg::epkleene1 {} { 2287 2288 # (+ (n Definition)) 2289 2290 variable ok 2291 2292 set pos [icl_get] 2293 2294 set old [ier_get] 2295 matchSymbol_Definition ; # (n Definition) 2296 ier_merge $old 2297 2298 if {!$ok} { 2299 icl_rewind $pos 2300 return 2301 } 2302 2303 while {1} { 2304 set pos [icl_get] 2305 2306 set old [ier_get] 2307 matchSymbol_Definition ; # (n Definition) 2308 ier_merge $old 2309 2310 if {$ok} continue 2311 break 2312 } 2313 2314 icl_rewind $pos 2315 iok_ok 2316 return 2317} 2318 2319proc ::page::parse::peg::matchSymbol_Header {} { 2320 # Header = (x (n PEG) 2321 # (n Identifier) 2322 # (n StartExpr)) 2323 2324 variable ok 2325 if {[inc_restore Header]} { 2326 if {$ok} ias_push 2327 return 2328 } 2329 2330 set pos [icl_get] 2331 set mrk [ias_mark] 2332 2333 eseq3 ; # (x (n PEG) 2334 # (n Identifier) 2335 # (n StartExpr)) 2336 2337 isv_nonterminal_reduce Header $pos $mrk 2338 inc_save Header $pos 2339 ias_pop2mark $mrk 2340 if {$ok} ias_push 2341 ier_nonterminal "Expected Header" $pos 2342 return 2343} 2344 2345proc ::page::parse::peg::eseq3 {} { 2346 2347 # (x (n PEG) 2348 # (n Identifier) 2349 # (n StartExpr)) 2350 2351 variable ok 2352 2353 set pos [icl_get] 2354 2355 set old [ier_get] 2356 matchSymbol_PEG ; # (n PEG) 2357 ier_merge $old 2358 2359 if {!$ok} {icl_rewind $pos ; return} 2360 2361 set mrk [ias_mark] 2362 2363 set old [ier_get] 2364 matchSymbol_Identifier ; # (n Identifier) 2365 ier_merge $old 2366 2367 if {!$ok} { 2368 ias_pop2mark $mrk 2369 icl_rewind $pos 2370 return 2371 } 2372 2373 set old [ier_get] 2374 matchSymbol_StartExpr ; # (n StartExpr) 2375 ier_merge $old 2376 2377 if {!$ok} { 2378 ias_pop2mark $mrk 2379 icl_rewind $pos 2380 return 2381 } 2382 2383 return 2384} 2385 2386proc ::page::parse::peg::matchSymbol_HexDigit {} { 2387 # HexDigit = (/ (.. 0 9) 2388 # (.. a f) 2389 # (.. A F)) 2390 2391 if {[inc_restore HexDigit]} return 2392 2393 set pos [icl_get] 2394 2395 ebra56 ; # (/ (.. 0 9) 2396 # (.. a f) 2397 # (.. A F)) 2398 2399 isv_clear 2400 inc_save HexDigit $pos 2401 ier_nonterminal "Expected HexDigit" $pos 2402 return 2403} 2404 2405proc ::page::parse::peg::ebra56 {} { 2406 2407 # (/ (.. 0 9) 2408 # (.. a f) 2409 # (.. A F)) 2410 2411 variable ok 2412 2413 set pos [icl_get] 2414 2415 set old [ier_get] 2416 ict_advance "Expected \[0..9\] (got EOF)" 2417 if {$ok} {ict_match_tokrange 0 9 "Expected \[0..9\]"} 2418 ier_merge $old 2419 2420 if {$ok} return 2421 icl_rewind $pos 2422 2423 set old [ier_get] 2424 ict_advance "Expected \[a..f\] (got EOF)" 2425 if {$ok} {ict_match_tokrange a f "Expected \[a..f\]"} 2426 ier_merge $old 2427 2428 if {$ok} return 2429 icl_rewind $pos 2430 2431 set old [ier_get] 2432 ict_advance "Expected \[A..F\] (got EOF)" 2433 if {$ok} {ict_match_tokrange A F "Expected \[A..F\]"} 2434 ier_merge $old 2435 2436 if {$ok} return 2437 icl_rewind $pos 2438 2439 return 2440} 2441 2442proc ::page::parse::peg::matchSymbol_Ident {} { 2443 # Ident = (x (/ (t _) 2444 # (t :) 2445 # (alpha)) 2446 # (* (/ (t _) 2447 # (t :) 2448 # (alnum)))) 2449 2450 variable ok 2451 if {[inc_restore Ident]} { 2452 if {$ok} ias_push 2453 return 2454 } 2455 2456 set pos [icl_get] 2457 2458 eseq41 ; # (x (/ (t _) 2459 # (t :) 2460 # (alpha)) 2461 # (* (/ (t _) 2462 # (t :) 2463 # (alnum)))) 2464 2465 isv_nonterminal_range Ident $pos 2466 inc_save Ident $pos 2467 if {$ok} ias_push 2468 ier_nonterminal "Expected Ident" $pos 2469 return 2470} 2471 2472proc ::page::parse::peg::eseq41 {} { 2473 2474 # (x (/ (t _) 2475 # (t :) 2476 # (alpha)) 2477 # (* (/ (t _) 2478 # (t :) 2479 # (alnum)))) 2480 2481 variable ok 2482 2483 set pos [icl_get] 2484 2485 set old [ier_get] 2486 ebra38 ; # (/ (t _) 2487 # (t :) 2488 # (alpha)) 2489 ier_merge $old 2490 2491 if {!$ok} {icl_rewind $pos ; return} 2492 2493 set old [ier_get] 2494 ekleene40 ; # (* (/ (t _) 2495 # (t :) 2496 # (alnum))) 2497 ier_merge $old 2498 2499 if {!$ok} {icl_rewind $pos ; return} 2500 2501 return 2502} 2503 2504proc ::page::parse::peg::ebra38 {} { 2505 2506 # (/ (t _) 2507 # (t :) 2508 # (alpha)) 2509 2510 variable ok 2511 2512 set pos [icl_get] 2513 2514 set old [ier_get] 2515 ict_advance "Expected _ (got EOF)" 2516 if {$ok} {ict_match_token _ "Expected _"} 2517 ier_merge $old 2518 2519 if {$ok} return 2520 icl_rewind $pos 2521 2522 set old [ier_get] 2523 ict_advance "Expected : (got EOF)" 2524 if {$ok} {ict_match_token : "Expected :"} 2525 ier_merge $old 2526 2527 if {$ok} return 2528 icl_rewind $pos 2529 2530 set old [ier_get] 2531 ict_advance "Expected <alpha> (got EOF)" 2532 if {$ok} {ict_match_tokclass alpha "Expected <alpha>"} 2533 ier_merge $old 2534 2535 if {$ok} return 2536 icl_rewind $pos 2537 2538 return 2539} 2540 2541proc ::page::parse::peg::ekleene40 {} { 2542 2543 # (* (/ (t _) 2544 # (t :) 2545 # (alnum))) 2546 2547 variable ok 2548 2549 while {1} { 2550 set pos [icl_get] 2551 2552 set old [ier_get] 2553 ebra39 ; # (/ (t _) 2554 # (t :) 2555 # (alnum)) 2556 ier_merge $old 2557 2558 if {$ok} continue 2559 break 2560 } 2561 2562 icl_rewind $pos 2563 iok_ok 2564 return 2565} 2566 2567proc ::page::parse::peg::ebra39 {} { 2568 2569 # (/ (t _) 2570 # (t :) 2571 # (alnum)) 2572 2573 variable ok 2574 2575 set pos [icl_get] 2576 2577 set old [ier_get] 2578 ict_advance "Expected _ (got EOF)" 2579 if {$ok} {ict_match_token _ "Expected _"} 2580 ier_merge $old 2581 2582 if {$ok} return 2583 icl_rewind $pos 2584 2585 set old [ier_get] 2586 ict_advance "Expected : (got EOF)" 2587 if {$ok} {ict_match_token : "Expected :"} 2588 ier_merge $old 2589 2590 if {$ok} return 2591 icl_rewind $pos 2592 2593 set old [ier_get] 2594 ict_advance "Expected <alnum> (got EOF)" 2595 if {$ok} {ict_match_tokclass alnum "Expected <alnum>"} 2596 ier_merge $old 2597 2598 if {$ok} return 2599 icl_rewind $pos 2600 2601 return 2602} 2603 2604proc ::page::parse::peg::matchSymbol_Identifier {} { 2605 # Identifier = (x (n Ident) 2606 # (n SPACE)) 2607 2608 variable ok 2609 if {[inc_restore Identifier]} { 2610 if {$ok} ias_push 2611 return 2612 } 2613 2614 set pos [icl_get] 2615 set mrk [ias_mark] 2616 2617 eseq37 ; # (x (n Ident) 2618 # (n SPACE)) 2619 2620 isv_nonterminal_reduce Identifier $pos $mrk 2621 inc_save Identifier $pos 2622 ias_pop2mark $mrk 2623 if {$ok} ias_push 2624 ier_nonterminal "Expected Identifier" $pos 2625 return 2626} 2627 2628proc ::page::parse::peg::eseq37 {} { 2629 2630 # (x (n Ident) 2631 # (n SPACE)) 2632 2633 variable ok 2634 2635 set pos [icl_get] 2636 2637 set mrk [ias_mark] 2638 2639 set old [ier_get] 2640 matchSymbol_Ident ; # (n Ident) 2641 ier_merge $old 2642 2643 if {!$ok} { 2644 ias_pop2mark $mrk 2645 icl_rewind $pos 2646 return 2647 } 2648 2649 set old [ier_get] 2650 matchSymbol_SPACE ; # (n SPACE) 2651 ier_merge $old 2652 2653 if {!$ok} { 2654 ias_pop2mark $mrk 2655 icl_rewind $pos 2656 return 2657 } 2658 2659 return 2660} 2661 2662proc ::page::parse::peg::matchSymbol_IS {} { 2663 # IS = (x (t <) 2664 # (t -) 2665 # (n SPACE)) 2666 2667 if {[inc_restore IS]} return 2668 2669 set pos [icl_get] 2670 2671 eseq58 ; # (x (t <) 2672 # (t -) 2673 # (n SPACE)) 2674 2675 isv_clear 2676 inc_save IS $pos 2677 ier_nonterminal "Expected IS" $pos 2678 return 2679} 2680 2681proc ::page::parse::peg::eseq58 {} { 2682 2683 # (x (t <) 2684 # (t -) 2685 # (n SPACE)) 2686 2687 variable ok 2688 2689 set pos [icl_get] 2690 2691 set old [ier_get] 2692 ict_advance "Expected < (got EOF)" 2693 if {$ok} {ict_match_token < "Expected <"} 2694 ier_merge $old 2695 2696 if {!$ok} {icl_rewind $pos ; return} 2697 2698 set old [ier_get] 2699 ict_advance "Expected - (got EOF)" 2700 if {$ok} {ict_match_token - "Expected -"} 2701 ier_merge $old 2702 2703 if {!$ok} {icl_rewind $pos ; return} 2704 2705 set old [ier_get] 2706 matchSymbol_SPACE ; # (n SPACE) 2707 ier_merge $old 2708 2709 if {!$ok} {icl_rewind $pos ; return} 2710 2711 return 2712} 2713 2714proc ::page::parse::peg::matchSymbol_LEAF {} { 2715 # LEAF = (x (t l) 2716 # (t e) 2717 # (t a) 2718 # (t f) 2719 # (n SPACE)) 2720 2721 variable ok 2722 if {[inc_restore LEAF]} { 2723 if {$ok} ias_push 2724 return 2725 } 2726 2727 set pos [icl_get] 2728 2729 eseq60 ; # (x (t l) 2730 # (t e) 2731 # (t a) 2732 # (t f) 2733 # (n SPACE)) 2734 2735 isv_nonterminal_leaf LEAF $pos 2736 inc_save LEAF $pos 2737 if {$ok} ias_push 2738 ier_nonterminal "Expected LEAF" $pos 2739 return 2740} 2741 2742proc ::page::parse::peg::eseq60 {} { 2743 2744 # (x (t l) 2745 # (t e) 2746 # (t a) 2747 # (t f) 2748 # (n SPACE)) 2749 2750 variable ok 2751 2752 set pos [icl_get] 2753 2754 set old [ier_get] 2755 ict_advance "Expected l (got EOF)" 2756 if {$ok} {ict_match_token l "Expected l"} 2757 ier_merge $old 2758 2759 if {!$ok} {icl_rewind $pos ; return} 2760 2761 set old [ier_get] 2762 ict_advance "Expected e (got EOF)" 2763 if {$ok} {ict_match_token e "Expected e"} 2764 ier_merge $old 2765 2766 if {!$ok} {icl_rewind $pos ; return} 2767 2768 set old [ier_get] 2769 ict_advance "Expected a (got EOF)" 2770 if {$ok} {ict_match_token a "Expected a"} 2771 ier_merge $old 2772 2773 if {!$ok} {icl_rewind $pos ; return} 2774 2775 set old [ier_get] 2776 ict_advance "Expected f (got EOF)" 2777 if {$ok} {ict_match_token f "Expected f"} 2778 ier_merge $old 2779 2780 if {!$ok} {icl_rewind $pos ; return} 2781 2782 set old [ier_get] 2783 matchSymbol_SPACE ; # (n SPACE) 2784 ier_merge $old 2785 2786 if {!$ok} {icl_rewind $pos ; return} 2787 2788 return 2789} 2790 2791proc ::page::parse::peg::matchSymbol_Literal {} { 2792 # Literal = (/ (x (n APOSTROPH) 2793 # (* (x (! (n APOSTROPH)) 2794 # (n Char))) 2795 # (n APOSTROPH) 2796 # (n SPACE)) 2797 # (x (n DAPOSTROPH) 2798 # (* (x (! (n DAPOSTROPH)) 2799 # (n Char))) 2800 # (n DAPOSTROPH) 2801 # (n SPACE))) 2802 2803 variable ok 2804 if {[inc_restore Literal]} { 2805 if {$ok} ias_push 2806 return 2807 } 2808 2809 set pos [icl_get] 2810 set mrk [ias_mark] 2811 2812 ebra28 ; # (/ (x (n APOSTROPH) 2813 # (* (x (! (n APOSTROPH)) 2814 # (n Char))) 2815 # (n APOSTROPH) 2816 # (n SPACE)) 2817 # (x (n DAPOSTROPH) 2818 # (* (x (! (n DAPOSTROPH)) 2819 # (n Char))) 2820 # (n DAPOSTROPH) 2821 # (n SPACE))) 2822 2823 isv_nonterminal_reduce Literal $pos $mrk 2824 inc_save Literal $pos 2825 ias_pop2mark $mrk 2826 if {$ok} ias_push 2827 ier_nonterminal "Expected Literal" $pos 2828 return 2829} 2830 2831proc ::page::parse::peg::ebra28 {} { 2832 2833 # (/ (x (n APOSTROPH) 2834 # (* (x (! (n APOSTROPH)) 2835 # (n Char))) 2836 # (n APOSTROPH) 2837 # (n SPACE)) 2838 # (x (n DAPOSTROPH) 2839 # (* (x (! (n DAPOSTROPH)) 2840 # (n Char))) 2841 # (n DAPOSTROPH) 2842 # (n SPACE))) 2843 2844 variable ok 2845 2846 set pos [icl_get] 2847 2848 set mrk [ias_mark] 2849 set old [ier_get] 2850 eseq23 ; # (x (n APOSTROPH) 2851 # (* (x (! (n APOSTROPH)) 2852 # (n Char))) 2853 # (n APOSTROPH) 2854 # (n SPACE)) 2855 ier_merge $old 2856 2857 if {$ok} return 2858 ias_pop2mark $mrk 2859 icl_rewind $pos 2860 2861 set mrk [ias_mark] 2862 set old [ier_get] 2863 eseq27 ; # (x (n DAPOSTROPH) 2864 # (* (x (! (n DAPOSTROPH)) 2865 # (n Char))) 2866 # (n DAPOSTROPH) 2867 # (n SPACE)) 2868 ier_merge $old 2869 2870 if {$ok} return 2871 ias_pop2mark $mrk 2872 icl_rewind $pos 2873 2874 return 2875} 2876 2877proc ::page::parse::peg::eseq23 {} { 2878 2879 # (x (n APOSTROPH) 2880 # (* (x (! (n APOSTROPH)) 2881 # (n Char))) 2882 # (n APOSTROPH) 2883 # (n SPACE)) 2884 2885 variable ok 2886 2887 set pos [icl_get] 2888 2889 set old [ier_get] 2890 matchSymbol_APOSTROPH ; # (n APOSTROPH) 2891 ier_merge $old 2892 2893 if {!$ok} {icl_rewind $pos ; return} 2894 2895 set mrk [ias_mark] 2896 2897 set old [ier_get] 2898 ekleene22 ; # (* (x (! (n APOSTROPH)) 2899 # (n Char))) 2900 ier_merge $old 2901 2902 if {!$ok} { 2903 ias_pop2mark $mrk 2904 icl_rewind $pos 2905 return 2906 } 2907 2908 set old [ier_get] 2909 matchSymbol_APOSTROPH ; # (n APOSTROPH) 2910 ier_merge $old 2911 2912 if {!$ok} { 2913 ias_pop2mark $mrk 2914 icl_rewind $pos 2915 return 2916 } 2917 2918 set old [ier_get] 2919 matchSymbol_SPACE ; # (n SPACE) 2920 ier_merge $old 2921 2922 if {!$ok} { 2923 ias_pop2mark $mrk 2924 icl_rewind $pos 2925 return 2926 } 2927 2928 return 2929} 2930 2931proc ::page::parse::peg::ekleene22 {} { 2932 2933 # (* (x (! (n APOSTROPH)) 2934 # (n Char))) 2935 2936 variable ok 2937 2938 while {1} { 2939 set pos [icl_get] 2940 2941 set old [ier_get] 2942 eseq21 ; # (x (! (n APOSTROPH)) 2943 # (n Char)) 2944 ier_merge $old 2945 2946 if {$ok} continue 2947 break 2948 } 2949 2950 icl_rewind $pos 2951 iok_ok 2952 return 2953} 2954 2955proc ::page::parse::peg::eseq21 {} { 2956 2957 # (x (! (n APOSTROPH)) 2958 # (n Char)) 2959 2960 variable ok 2961 2962 set pos [icl_get] 2963 2964 set old [ier_get] 2965 ebang20 2966 ier_merge $old 2967 2968 if {!$ok} {icl_rewind $pos ; return} 2969 2970 set mrk [ias_mark] 2971 2972 set old [ier_get] 2973 matchSymbol_Char ; # (n Char) 2974 ier_merge $old 2975 2976 if {!$ok} { 2977 ias_pop2mark $mrk 2978 icl_rewind $pos 2979 return 2980 } 2981 2982 return 2983} 2984 2985proc ::page::parse::peg::ebang20 {} { 2986 set pos [icl_get] 2987 2988 matchSymbol_APOSTROPH ; # (n APOSTROPH) 2989 2990 icl_rewind $pos 2991 iok_negate 2992 return 2993} 2994 2995proc ::page::parse::peg::eseq27 {} { 2996 2997 # (x (n DAPOSTROPH) 2998 # (* (x (! (n DAPOSTROPH)) 2999 # (n Char))) 3000 # (n DAPOSTROPH) 3001 # (n SPACE)) 3002 3003 variable ok 3004 3005 set pos [icl_get] 3006 3007 set old [ier_get] 3008 matchSymbol_DAPOSTROPH ; # (n DAPOSTROPH) 3009 ier_merge $old 3010 3011 if {!$ok} {icl_rewind $pos ; return} 3012 3013 set mrk [ias_mark] 3014 3015 set old [ier_get] 3016 ekleene26 ; # (* (x (! (n DAPOSTROPH)) 3017 # (n Char))) 3018 ier_merge $old 3019 3020 if {!$ok} { 3021 ias_pop2mark $mrk 3022 icl_rewind $pos 3023 return 3024 } 3025 3026 set old [ier_get] 3027 matchSymbol_DAPOSTROPH ; # (n DAPOSTROPH) 3028 ier_merge $old 3029 3030 if {!$ok} { 3031 ias_pop2mark $mrk 3032 icl_rewind $pos 3033 return 3034 } 3035 3036 set old [ier_get] 3037 matchSymbol_SPACE ; # (n SPACE) 3038 ier_merge $old 3039 3040 if {!$ok} { 3041 ias_pop2mark $mrk 3042 icl_rewind $pos 3043 return 3044 } 3045 3046 return 3047} 3048 3049proc ::page::parse::peg::ekleene26 {} { 3050 3051 # (* (x (! (n DAPOSTROPH)) 3052 # (n Char))) 3053 3054 variable ok 3055 3056 while {1} { 3057 set pos [icl_get] 3058 3059 set old [ier_get] 3060 eseq25 ; # (x (! (n DAPOSTROPH)) 3061 # (n Char)) 3062 ier_merge $old 3063 3064 if {$ok} continue 3065 break 3066 } 3067 3068 icl_rewind $pos 3069 iok_ok 3070 return 3071} 3072 3073proc ::page::parse::peg::eseq25 {} { 3074 3075 # (x (! (n DAPOSTROPH)) 3076 # (n Char)) 3077 3078 variable ok 3079 3080 set pos [icl_get] 3081 3082 set old [ier_get] 3083 ebang24 3084 ier_merge $old 3085 3086 if {!$ok} {icl_rewind $pos ; return} 3087 3088 set mrk [ias_mark] 3089 3090 set old [ier_get] 3091 matchSymbol_Char ; # (n Char) 3092 ier_merge $old 3093 3094 if {!$ok} { 3095 ias_pop2mark $mrk 3096 icl_rewind $pos 3097 return 3098 } 3099 3100 return 3101} 3102 3103proc ::page::parse::peg::ebang24 {} { 3104 set pos [icl_get] 3105 3106 matchSymbol_DAPOSTROPH ; # (n DAPOSTROPH) 3107 3108 icl_rewind $pos 3109 iok_negate 3110 return 3111} 3112 3113proc ::page::parse::peg::matchSymbol_MATCH {} { 3114 # MATCH = (x (t m) 3115 # (t a) 3116 # (t t) 3117 # (t c) 3118 # (t h) 3119 # (n SPACE)) 3120 3121 variable ok 3122 if {[inc_restore MATCH]} { 3123 if {$ok} ias_push 3124 return 3125 } 3126 3127 set pos [icl_get] 3128 3129 eseq61 ; # (x (t m) 3130 # (t a) 3131 # (t t) 3132 # (t c) 3133 # (t h) 3134 # (n SPACE)) 3135 3136 isv_nonterminal_leaf MATCH $pos 3137 inc_save MATCH $pos 3138 if {$ok} ias_push 3139 ier_nonterminal "Expected MATCH" $pos 3140 return 3141} 3142 3143proc ::page::parse::peg::eseq61 {} { 3144 3145 # (x (t m) 3146 # (t a) 3147 # (t t) 3148 # (t c) 3149 # (t h) 3150 # (n SPACE)) 3151 3152 variable ok 3153 3154 set pos [icl_get] 3155 3156 set old [ier_get] 3157 ict_advance "Expected m (got EOF)" 3158 if {$ok} {ict_match_token m "Expected m"} 3159 ier_merge $old 3160 3161 if {!$ok} {icl_rewind $pos ; return} 3162 3163 set old [ier_get] 3164 ict_advance "Expected a (got EOF)" 3165 if {$ok} {ict_match_token a "Expected a"} 3166 ier_merge $old 3167 3168 if {!$ok} {icl_rewind $pos ; return} 3169 3170 set old [ier_get] 3171 ict_advance "Expected t (got EOF)" 3172 if {$ok} {ict_match_token t "Expected t"} 3173 ier_merge $old 3174 3175 if {!$ok} {icl_rewind $pos ; return} 3176 3177 set old [ier_get] 3178 ict_advance "Expected c (got EOF)" 3179 if {$ok} {ict_match_token c "Expected c"} 3180 ier_merge $old 3181 3182 if {!$ok} {icl_rewind $pos ; return} 3183 3184 set old [ier_get] 3185 ict_advance "Expected h (got EOF)" 3186 if {$ok} {ict_match_token h "Expected h"} 3187 ier_merge $old 3188 3189 if {!$ok} {icl_rewind $pos ; return} 3190 3191 set old [ier_get] 3192 matchSymbol_SPACE ; # (n SPACE) 3193 ier_merge $old 3194 3195 if {!$ok} {icl_rewind $pos ; return} 3196 3197 return 3198} 3199 3200proc ::page::parse::peg::matchSymbol_NOT {} { 3201 # NOT = (x (t !) 3202 # (n SPACE)) 3203 3204 variable ok 3205 if {[inc_restore NOT]} { 3206 if {$ok} ias_push 3207 return 3208 } 3209 3210 set pos [icl_get] 3211 3212 eseq67 ; # (x (t !) 3213 # (n SPACE)) 3214 3215 isv_nonterminal_leaf NOT $pos 3216 inc_save NOT $pos 3217 if {$ok} ias_push 3218 ier_nonterminal "Expected NOT" $pos 3219 return 3220} 3221 3222proc ::page::parse::peg::eseq67 {} { 3223 3224 # (x (t !) 3225 # (n SPACE)) 3226 3227 variable ok 3228 3229 set pos [icl_get] 3230 3231 set old [ier_get] 3232 ict_advance "Expected ! (got EOF)" 3233 if {$ok} {ict_match_token ! "Expected !"} 3234 ier_merge $old 3235 3236 if {!$ok} {icl_rewind $pos ; return} 3237 3238 set old [ier_get] 3239 matchSymbol_SPACE ; # (n SPACE) 3240 ier_merge $old 3241 3242 if {!$ok} {icl_rewind $pos ; return} 3243 3244 return 3245} 3246 3247proc ::page::parse::peg::matchSymbol_OPEN {} { 3248 # OPEN = (x (t \() 3249 # (n SPACE)) 3250 3251 if {[inc_restore OPEN]} return 3252 3253 set pos [icl_get] 3254 3255 eseq71 ; # (x (t \() 3256 # (n SPACE)) 3257 3258 isv_clear 3259 inc_save OPEN $pos 3260 ier_nonterminal "Expected OPEN" $pos 3261 return 3262} 3263 3264proc ::page::parse::peg::eseq71 {} { 3265 3266 # (x (t \() 3267 # (n SPACE)) 3268 3269 variable ok 3270 3271 set pos [icl_get] 3272 3273 set old [ier_get] 3274 ict_advance "Expected \( (got EOF)" 3275 if {$ok} {ict_match_token \50 "Expected \("} 3276 ier_merge $old 3277 3278 if {!$ok} {icl_rewind $pos ; return} 3279 3280 set old [ier_get] 3281 matchSymbol_SPACE ; # (n SPACE) 3282 ier_merge $old 3283 3284 if {!$ok} {icl_rewind $pos ; return} 3285 3286 return 3287} 3288 3289proc ::page::parse::peg::matchSymbol_OPENB {} { 3290 # OPENB = (t [) 3291 3292 variable ok 3293 if {[inc_restore OPENB]} return 3294 3295 set pos [icl_get] 3296 3297 ict_advance "Expected \[ (got EOF)" 3298 if {$ok} {ict_match_token \133 "Expected \["} 3299 3300 isv_clear 3301 inc_save OPENB $pos 3302 ier_nonterminal "Expected OPENB" $pos 3303 return 3304} 3305 3306proc ::page::parse::peg::matchSymbol_PEG {} { 3307 # PEG = (x (t P) 3308 # (t E) 3309 # (t G) 3310 # (n SPACE)) 3311 3312 if {[inc_restore PEG]} return 3313 3314 set pos [icl_get] 3315 3316 eseq57 ; # (x (t P) 3317 # (t E) 3318 # (t G) 3319 # (n SPACE)) 3320 3321 isv_clear 3322 inc_save PEG $pos 3323 ier_nonterminal "Expected PEG" $pos 3324 return 3325} 3326 3327proc ::page::parse::peg::eseq57 {} { 3328 3329 # (x (t P) 3330 # (t E) 3331 # (t G) 3332 # (n SPACE)) 3333 3334 variable ok 3335 3336 set pos [icl_get] 3337 3338 set old [ier_get] 3339 ict_advance "Expected P (got EOF)" 3340 if {$ok} {ict_match_token P "Expected P"} 3341 ier_merge $old 3342 3343 if {!$ok} {icl_rewind $pos ; return} 3344 3345 set old [ier_get] 3346 ict_advance "Expected E (got EOF)" 3347 if {$ok} {ict_match_token E "Expected E"} 3348 ier_merge $old 3349 3350 if {!$ok} {icl_rewind $pos ; return} 3351 3352 set old [ier_get] 3353 ict_advance "Expected G (got EOF)" 3354 if {$ok} {ict_match_token G "Expected G"} 3355 ier_merge $old 3356 3357 if {!$ok} {icl_rewind $pos ; return} 3358 3359 set old [ier_get] 3360 matchSymbol_SPACE ; # (n SPACE) 3361 ier_merge $old 3362 3363 if {!$ok} {icl_rewind $pos ; return} 3364 3365 return 3366} 3367 3368proc ::page::parse::peg::matchSymbol_PLUS {} { 3369 # PLUS = (x (t +) 3370 # (n SPACE)) 3371 3372 variable ok 3373 if {[inc_restore PLUS]} { 3374 if {$ok} ias_push 3375 return 3376 } 3377 3378 set pos [icl_get] 3379 3380 eseq70 ; # (x (t +) 3381 # (n SPACE)) 3382 3383 isv_nonterminal_leaf PLUS $pos 3384 inc_save PLUS $pos 3385 if {$ok} ias_push 3386 ier_nonterminal "Expected PLUS" $pos 3387 return 3388} 3389 3390proc ::page::parse::peg::eseq70 {} { 3391 3392 # (x (t +) 3393 # (n SPACE)) 3394 3395 variable ok 3396 3397 set pos [icl_get] 3398 3399 set old [ier_get] 3400 ict_advance "Expected + (got EOF)" 3401 if {$ok} {ict_match_token + "Expected +"} 3402 ier_merge $old 3403 3404 if {!$ok} {icl_rewind $pos ; return} 3405 3406 set old [ier_get] 3407 matchSymbol_SPACE ; # (n SPACE) 3408 ier_merge $old 3409 3410 if {!$ok} {icl_rewind $pos ; return} 3411 3412 return 3413} 3414 3415proc ::page::parse::peg::matchSymbol_Prefix {} { 3416 # Prefix = (x (? (/ (n AND) 3417 # (n NOT))) 3418 # (n Suffix)) 3419 3420 variable ok 3421 if {[inc_restore Prefix]} { 3422 if {$ok} ias_push 3423 return 3424 } 3425 3426 set pos [icl_get] 3427 set mrk [ias_mark] 3428 3429 eseq14 ; # (x (? (/ (n AND) 3430 # (n NOT))) 3431 # (n Suffix)) 3432 3433 isv_nonterminal_reduce Prefix $pos $mrk 3434 inc_save Prefix $pos 3435 ias_pop2mark $mrk 3436 if {$ok} ias_push 3437 ier_nonterminal "Expected Prefix" $pos 3438 return 3439} 3440 3441proc ::page::parse::peg::eseq14 {} { 3442 3443 # (x (? (/ (n AND) 3444 # (n NOT))) 3445 # (n Suffix)) 3446 3447 variable ok 3448 3449 set pos [icl_get] 3450 3451 set mrk [ias_mark] 3452 3453 set old [ier_get] 3454 eopt13 ; # (? (/ (n AND) 3455 # (n NOT))) 3456 ier_merge $old 3457 3458 if {!$ok} { 3459 ias_pop2mark $mrk 3460 icl_rewind $pos 3461 return 3462 } 3463 3464 set old [ier_get] 3465 matchSymbol_Suffix ; # (n Suffix) 3466 ier_merge $old 3467 3468 if {!$ok} { 3469 ias_pop2mark $mrk 3470 icl_rewind $pos 3471 return 3472 } 3473 3474 return 3475} 3476 3477proc ::page::parse::peg::eopt13 {} { 3478 3479 # (? (/ (n AND) 3480 # (n NOT))) 3481 3482 variable ok 3483 3484 set pos [icl_get] 3485 3486 set old [ier_get] 3487 ebra12 ; # (/ (n AND) 3488 # (n NOT)) 3489 ier_merge $old 3490 3491 if {$ok} return 3492 icl_rewind $pos 3493 iok_ok 3494 return 3495} 3496 3497proc ::page::parse::peg::ebra12 {} { 3498 3499 # (/ (n AND) 3500 # (n NOT)) 3501 3502 variable ok 3503 3504 set pos [icl_get] 3505 3506 set mrk [ias_mark] 3507 set old [ier_get] 3508 matchSymbol_AND ; # (n AND) 3509 ier_merge $old 3510 3511 if {$ok} return 3512 ias_pop2mark $mrk 3513 icl_rewind $pos 3514 3515 set mrk [ias_mark] 3516 set old [ier_get] 3517 matchSymbol_NOT ; # (n NOT) 3518 ier_merge $old 3519 3520 if {$ok} return 3521 ias_pop2mark $mrk 3522 icl_rewind $pos 3523 3524 return 3525} 3526 3527proc ::page::parse::peg::matchSymbol_Primary {} { 3528 # Primary = (/ (n ALNUM) 3529 # (n ALPHA) 3530 # (n Identifier) 3531 # (x (n OPEN) 3532 # (n Expression) 3533 # (n CLOSE)) 3534 # (n Literal) 3535 # (n Class) 3536 # (n DOT)) 3537 3538 variable ok 3539 if {[inc_restore Primary]} { 3540 if {$ok} ias_push 3541 return 3542 } 3543 3544 set pos [icl_get] 3545 set mrk [ias_mark] 3546 3547 ebra19 ; # (/ (n ALNUM) 3548 # (n ALPHA) 3549 # (n Identifier) 3550 # (x (n OPEN) 3551 # (n Expression) 3552 # (n CLOSE)) 3553 # (n Literal) 3554 # (n Class) 3555 # (n DOT)) 3556 3557 isv_nonterminal_reduce Primary $pos $mrk 3558 inc_save Primary $pos 3559 ias_pop2mark $mrk 3560 if {$ok} ias_push 3561 ier_nonterminal "Expected Primary" $pos 3562 return 3563} 3564 3565proc ::page::parse::peg::ebra19 {} { 3566 3567 # (/ (n ALNUM) 3568 # (n ALPHA) 3569 # (n Identifier) 3570 # (x (n OPEN) 3571 # (n Expression) 3572 # (n CLOSE)) 3573 # (n Literal) 3574 # (n Class) 3575 # (n DOT)) 3576 3577 variable ok 3578 3579 set pos [icl_get] 3580 3581 set mrk [ias_mark] 3582 set old [ier_get] 3583 matchSymbol_ALNUM ; # (n ALNUM) 3584 ier_merge $old 3585 3586 if {$ok} return 3587 ias_pop2mark $mrk 3588 icl_rewind $pos 3589 3590 set mrk [ias_mark] 3591 set old [ier_get] 3592 matchSymbol_ALPHA ; # (n ALPHA) 3593 ier_merge $old 3594 3595 if {$ok} return 3596 ias_pop2mark $mrk 3597 icl_rewind $pos 3598 3599 set mrk [ias_mark] 3600 set old [ier_get] 3601 matchSymbol_Identifier ; # (n Identifier) 3602 ier_merge $old 3603 3604 if {$ok} return 3605 ias_pop2mark $mrk 3606 icl_rewind $pos 3607 3608 set mrk [ias_mark] 3609 set old [ier_get] 3610 eseq18 ; # (x (n OPEN) 3611 # (n Expression) 3612 # (n CLOSE)) 3613 ier_merge $old 3614 3615 if {$ok} return 3616 ias_pop2mark $mrk 3617 icl_rewind $pos 3618 3619 set mrk [ias_mark] 3620 set old [ier_get] 3621 matchSymbol_Literal ; # (n Literal) 3622 ier_merge $old 3623 3624 if {$ok} return 3625 ias_pop2mark $mrk 3626 icl_rewind $pos 3627 3628 set mrk [ias_mark] 3629 set old [ier_get] 3630 matchSymbol_Class ; # (n Class) 3631 ier_merge $old 3632 3633 if {$ok} return 3634 ias_pop2mark $mrk 3635 icl_rewind $pos 3636 3637 set mrk [ias_mark] 3638 set old [ier_get] 3639 matchSymbol_DOT ; # (n DOT) 3640 ier_merge $old 3641 3642 if {$ok} return 3643 ias_pop2mark $mrk 3644 icl_rewind $pos 3645 3646 return 3647} 3648 3649proc ::page::parse::peg::eseq18 {} { 3650 3651 # (x (n OPEN) 3652 # (n Expression) 3653 # (n CLOSE)) 3654 3655 variable ok 3656 3657 set pos [icl_get] 3658 3659 set old [ier_get] 3660 matchSymbol_OPEN ; # (n OPEN) 3661 ier_merge $old 3662 3663 if {!$ok} {icl_rewind $pos ; return} 3664 3665 set mrk [ias_mark] 3666 3667 set old [ier_get] 3668 matchSymbol_Expression ; # (n Expression) 3669 ier_merge $old 3670 3671 if {!$ok} { 3672 ias_pop2mark $mrk 3673 icl_rewind $pos 3674 return 3675 } 3676 3677 set old [ier_get] 3678 matchSymbol_CLOSE ; # (n CLOSE) 3679 ier_merge $old 3680 3681 if {!$ok} { 3682 ias_pop2mark $mrk 3683 icl_rewind $pos 3684 return 3685 } 3686 3687 return 3688} 3689 3690proc ::page::parse::peg::matchSymbol_QUESTION {} { 3691 # QUESTION = (x (t ?) 3692 # (n SPACE)) 3693 3694 variable ok 3695 if {[inc_restore QUESTION]} { 3696 if {$ok} ias_push 3697 return 3698 } 3699 3700 set pos [icl_get] 3701 3702 eseq68 ; # (x (t ?) 3703 # (n SPACE)) 3704 3705 isv_nonterminal_leaf QUESTION $pos 3706 inc_save QUESTION $pos 3707 if {$ok} ias_push 3708 ier_nonterminal "Expected QUESTION" $pos 3709 return 3710} 3711 3712proc ::page::parse::peg::eseq68 {} { 3713 3714 # (x (t ?) 3715 # (n SPACE)) 3716 3717 variable ok 3718 3719 set pos [icl_get] 3720 3721 set old [ier_get] 3722 ict_advance "Expected ? (got EOF)" 3723 if {$ok} {ict_match_token ? "Expected ?"} 3724 ier_merge $old 3725 3726 if {!$ok} {icl_rewind $pos ; return} 3727 3728 set old [ier_get] 3729 matchSymbol_SPACE ; # (n SPACE) 3730 ier_merge $old 3731 3732 if {!$ok} {icl_rewind $pos ; return} 3733 3734 return 3735} 3736 3737proc ::page::parse::peg::matchSymbol_Range {} { 3738 # Range = (/ (x (n Char) 3739 # (n TO) 3740 # (n Char)) 3741 # (n Char)) 3742 3743 variable ok 3744 if {[inc_restore Range]} { 3745 if {$ok} ias_push 3746 return 3747 } 3748 3749 set pos [icl_get] 3750 set mrk [ias_mark] 3751 3752 ebra34 ; # (/ (x (n Char) 3753 # (n TO) 3754 # (n Char)) 3755 # (n Char)) 3756 3757 isv_nonterminal_reduce Range $pos $mrk 3758 inc_save Range $pos 3759 ias_pop2mark $mrk 3760 if {$ok} ias_push 3761 ier_nonterminal "Expected Range" $pos 3762 return 3763} 3764 3765proc ::page::parse::peg::ebra34 {} { 3766 3767 # (/ (x (n Char) 3768 # (n TO) 3769 # (n Char)) 3770 # (n Char)) 3771 3772 variable ok 3773 3774 set pos [icl_get] 3775 3776 set mrk [ias_mark] 3777 set old [ier_get] 3778 eseq33 ; # (x (n Char) 3779 # (n TO) 3780 # (n Char)) 3781 ier_merge $old 3782 3783 if {$ok} return 3784 ias_pop2mark $mrk 3785 icl_rewind $pos 3786 3787 set mrk [ias_mark] 3788 set old [ier_get] 3789 matchSymbol_Char ; # (n Char) 3790 ier_merge $old 3791 3792 if {$ok} return 3793 ias_pop2mark $mrk 3794 icl_rewind $pos 3795 3796 return 3797} 3798 3799proc ::page::parse::peg::eseq33 {} { 3800 3801 # (x (n Char) 3802 # (n TO) 3803 # (n Char)) 3804 3805 variable ok 3806 3807 set pos [icl_get] 3808 3809 set mrk [ias_mark] 3810 3811 set old [ier_get] 3812 matchSymbol_Char ; # (n Char) 3813 ier_merge $old 3814 3815 if {!$ok} { 3816 ias_pop2mark $mrk 3817 icl_rewind $pos 3818 return 3819 } 3820 3821 set old [ier_get] 3822 matchSymbol_TO ; # (n TO) 3823 ier_merge $old 3824 3825 if {!$ok} { 3826 ias_pop2mark $mrk 3827 icl_rewind $pos 3828 return 3829 } 3830 3831 set old [ier_get] 3832 matchSymbol_Char ; # (n Char) 3833 ier_merge $old 3834 3835 if {!$ok} { 3836 ias_pop2mark $mrk 3837 icl_rewind $pos 3838 return 3839 } 3840 3841 return 3842} 3843 3844proc ::page::parse::peg::matchSymbol_SEMICOLON {} { 3845 # SEMICOLON = (x (t ;) 3846 # (n SPACE)) 3847 3848 if {[inc_restore SEMICOLON]} return 3849 3850 set pos [icl_get] 3851 3852 eseq63 ; # (x (t ;) 3853 # (n SPACE)) 3854 3855 isv_clear 3856 inc_save SEMICOLON $pos 3857 ier_nonterminal "Expected SEMICOLON" $pos 3858 return 3859} 3860 3861proc ::page::parse::peg::eseq63 {} { 3862 3863 # (x (t ;) 3864 # (n SPACE)) 3865 3866 variable ok 3867 3868 set pos [icl_get] 3869 3870 set old [ier_get] 3871 ict_advance "Expected \; (got EOF)" 3872 if {$ok} {ict_match_token \73 "Expected \;"} 3873 ier_merge $old 3874 3875 if {!$ok} {icl_rewind $pos ; return} 3876 3877 set old [ier_get] 3878 matchSymbol_SPACE ; # (n SPACE) 3879 ier_merge $old 3880 3881 if {!$ok} {icl_rewind $pos ; return} 3882 3883 return 3884} 3885 3886proc ::page::parse::peg::matchSymbol_Sequence {} { 3887 # Sequence = (+ (n Prefix)) 3888 3889 variable ok 3890 if {[inc_restore Sequence]} { 3891 if {$ok} ias_push 3892 return 3893 } 3894 3895 set pos [icl_get] 3896 set mrk [ias_mark] 3897 3898 epkleene11 ; # (+ (n Prefix)) 3899 3900 isv_nonterminal_reduce Sequence $pos $mrk 3901 inc_save Sequence $pos 3902 ias_pop2mark $mrk 3903 if {$ok} ias_push 3904 ier_nonterminal "Expected Sequence" $pos 3905 return 3906} 3907 3908proc ::page::parse::peg::epkleene11 {} { 3909 3910 # (+ (n Prefix)) 3911 3912 variable ok 3913 3914 set pos [icl_get] 3915 3916 set old [ier_get] 3917 matchSymbol_Prefix ; # (n Prefix) 3918 ier_merge $old 3919 3920 if {!$ok} { 3921 icl_rewind $pos 3922 return 3923 } 3924 3925 while {1} { 3926 set pos [icl_get] 3927 3928 set old [ier_get] 3929 matchSymbol_Prefix ; # (n Prefix) 3930 ier_merge $old 3931 3932 if {$ok} continue 3933 break 3934 } 3935 3936 icl_rewind $pos 3937 iok_ok 3938 return 3939} 3940 3941proc ::page::parse::peg::matchSymbol_SLASH {} { 3942 # SLASH = (x (t /) 3943 # (n SPACE)) 3944 3945 if {[inc_restore SLASH]} return 3946 3947 set pos [icl_get] 3948 3949 eseq65 ; # (x (t /) 3950 # (n SPACE)) 3951 3952 isv_clear 3953 inc_save SLASH $pos 3954 ier_nonterminal "Expected SLASH" $pos 3955 return 3956} 3957 3958proc ::page::parse::peg::eseq65 {} { 3959 3960 # (x (t /) 3961 # (n SPACE)) 3962 3963 variable ok 3964 3965 set pos [icl_get] 3966 3967 set old [ier_get] 3968 ict_advance "Expected / (got EOF)" 3969 if {$ok} {ict_match_token / "Expected /"} 3970 ier_merge $old 3971 3972 if {!$ok} {icl_rewind $pos ; return} 3973 3974 set old [ier_get] 3975 matchSymbol_SPACE ; # (n SPACE) 3976 ier_merge $old 3977 3978 if {!$ok} {icl_rewind $pos ; return} 3979 3980 return 3981} 3982 3983proc ::page::parse::peg::matchSymbol_SPACE {} { 3984 # SPACE = (* (/ (t <blank>) 3985 # (t \t) 3986 # (n EOL) 3987 # (n COMMENT))) 3988 3989 if {[inc_restore SPACE]} return 3990 3991 set pos [icl_get] 3992 3993 ekleene77 ; # (* (/ (t <blank>) 3994 # (t \t) 3995 # (n EOL) 3996 # (n COMMENT))) 3997 3998 isv_clear 3999 inc_save SPACE $pos 4000 ier_nonterminal "Expected SPACE" $pos 4001 return 4002} 4003 4004proc ::page::parse::peg::ekleene77 {} { 4005 4006 # (* (/ (t <blank>) 4007 # (t \t) 4008 # (n EOL) 4009 # (n COMMENT))) 4010 4011 variable ok 4012 4013 while {1} { 4014 set pos [icl_get] 4015 4016 set old [ier_get] 4017 ebra76 ; # (/ (t <blank>) 4018 # (t \t) 4019 # (n EOL) 4020 # (n COMMENT)) 4021 ier_merge $old 4022 4023 if {$ok} continue 4024 break 4025 } 4026 4027 icl_rewind $pos 4028 iok_ok 4029 return 4030} 4031 4032proc ::page::parse::peg::ebra76 {} { 4033 4034 # (/ (t <blank>) 4035 # (t \t) 4036 # (n EOL) 4037 # (n COMMENT)) 4038 4039 variable ok 4040 4041 set pos [icl_get] 4042 4043 set old [ier_get] 4044 ict_advance "Expected <blank> (got EOF)" 4045 if {$ok} {ict_match_token \40 "Expected <blank>"} 4046 ier_merge $old 4047 4048 if {$ok} return 4049 icl_rewind $pos 4050 4051 set old [ier_get] 4052 ict_advance "Expected \\t (got EOF)" 4053 if {$ok} {ict_match_token \t "Expected \\t"} 4054 ier_merge $old 4055 4056 if {$ok} return 4057 icl_rewind $pos 4058 4059 set old [ier_get] 4060 matchSymbol_EOL ; # (n EOL) 4061 ier_merge $old 4062 4063 if {$ok} return 4064 icl_rewind $pos 4065 4066 set old [ier_get] 4067 matchSymbol_COMMENT ; # (n COMMENT) 4068 ier_merge $old 4069 4070 if {$ok} return 4071 icl_rewind $pos 4072 4073 return 4074} 4075 4076proc ::page::parse::peg::matchSymbol_STAR {} { 4077 # STAR = (x (t *) 4078 # (n SPACE)) 4079 4080 variable ok 4081 if {[inc_restore STAR]} { 4082 if {$ok} ias_push 4083 return 4084 } 4085 4086 set pos [icl_get] 4087 4088 eseq69 ; # (x (t *) 4089 # (n SPACE)) 4090 4091 isv_nonterminal_leaf STAR $pos 4092 inc_save STAR $pos 4093 if {$ok} ias_push 4094 ier_nonterminal "Expected STAR" $pos 4095 return 4096} 4097 4098proc ::page::parse::peg::eseq69 {} { 4099 4100 # (x (t *) 4101 # (n SPACE)) 4102 4103 variable ok 4104 4105 set pos [icl_get] 4106 4107 set old [ier_get] 4108 ict_advance "Expected * (got EOF)" 4109 if {$ok} {ict_match_token * "Expected *"} 4110 ier_merge $old 4111 4112 if {!$ok} {icl_rewind $pos ; return} 4113 4114 set old [ier_get] 4115 matchSymbol_SPACE ; # (n SPACE) 4116 ier_merge $old 4117 4118 if {!$ok} {icl_rewind $pos ; return} 4119 4120 return 4121} 4122 4123proc ::page::parse::peg::matchSymbol_StartExpr {} { 4124 # StartExpr = (x (n OPEN) 4125 # (n Expression) 4126 # (n CLOSE)) 4127 4128 variable ok 4129 if {[inc_restore StartExpr]} { 4130 if {$ok} ias_push 4131 return 4132 } 4133 4134 set pos [icl_get] 4135 set mrk [ias_mark] 4136 4137 eseq35 ; # (x (n OPEN) 4138 # (n Expression) 4139 # (n CLOSE)) 4140 4141 isv_nonterminal_reduce StartExpr $pos $mrk 4142 inc_save StartExpr $pos 4143 ias_pop2mark $mrk 4144 if {$ok} ias_push 4145 ier_nonterminal "Expected StartExpr" $pos 4146 return 4147} 4148 4149proc ::page::parse::peg::eseq35 {} { 4150 4151 # (x (n OPEN) 4152 # (n Expression) 4153 # (n CLOSE)) 4154 4155 variable ok 4156 4157 set pos [icl_get] 4158 4159 set old [ier_get] 4160 matchSymbol_OPEN ; # (n OPEN) 4161 ier_merge $old 4162 4163 if {!$ok} {icl_rewind $pos ; return} 4164 4165 set mrk [ias_mark] 4166 4167 set old [ier_get] 4168 matchSymbol_Expression ; # (n Expression) 4169 ier_merge $old 4170 4171 if {!$ok} { 4172 ias_pop2mark $mrk 4173 icl_rewind $pos 4174 return 4175 } 4176 4177 set old [ier_get] 4178 matchSymbol_CLOSE ; # (n CLOSE) 4179 ier_merge $old 4180 4181 if {!$ok} { 4182 ias_pop2mark $mrk 4183 icl_rewind $pos 4184 return 4185 } 4186 4187 return 4188} 4189 4190proc ::page::parse::peg::matchSymbol_Suffix {} { 4191 # Suffix = (x (n Primary) 4192 # (? (/ (n QUESTION) 4193 # (n STAR) 4194 # (n PLUS)))) 4195 4196 variable ok 4197 if {[inc_restore Suffix]} { 4198 if {$ok} ias_push 4199 return 4200 } 4201 4202 set pos [icl_get] 4203 set mrk [ias_mark] 4204 4205 eseq17 ; # (x (n Primary) 4206 # (? (/ (n QUESTION) 4207 # (n STAR) 4208 # (n PLUS)))) 4209 4210 isv_nonterminal_reduce Suffix $pos $mrk 4211 inc_save Suffix $pos 4212 ias_pop2mark $mrk 4213 if {$ok} ias_push 4214 ier_nonterminal "Expected Suffix" $pos 4215 return 4216} 4217 4218proc ::page::parse::peg::eseq17 {} { 4219 4220 # (x (n Primary) 4221 # (? (/ (n QUESTION) 4222 # (n STAR) 4223 # (n PLUS)))) 4224 4225 variable ok 4226 4227 set pos [icl_get] 4228 4229 set mrk [ias_mark] 4230 4231 set old [ier_get] 4232 matchSymbol_Primary ; # (n Primary) 4233 ier_merge $old 4234 4235 if {!$ok} { 4236 ias_pop2mark $mrk 4237 icl_rewind $pos 4238 return 4239 } 4240 4241 set old [ier_get] 4242 eopt16 ; # (? (/ (n QUESTION) 4243 # (n STAR) 4244 # (n PLUS))) 4245 ier_merge $old 4246 4247 if {!$ok} { 4248 ias_pop2mark $mrk 4249 icl_rewind $pos 4250 return 4251 } 4252 4253 return 4254} 4255 4256proc ::page::parse::peg::eopt16 {} { 4257 4258 # (? (/ (n QUESTION) 4259 # (n STAR) 4260 # (n PLUS))) 4261 4262 variable ok 4263 4264 set pos [icl_get] 4265 4266 set old [ier_get] 4267 ebra15 ; # (/ (n QUESTION) 4268 # (n STAR) 4269 # (n PLUS)) 4270 ier_merge $old 4271 4272 if {$ok} return 4273 icl_rewind $pos 4274 iok_ok 4275 return 4276} 4277 4278proc ::page::parse::peg::ebra15 {} { 4279 4280 # (/ (n QUESTION) 4281 # (n STAR) 4282 # (n PLUS)) 4283 4284 variable ok 4285 4286 set pos [icl_get] 4287 4288 set mrk [ias_mark] 4289 set old [ier_get] 4290 matchSymbol_QUESTION ; # (n QUESTION) 4291 ier_merge $old 4292 4293 if {$ok} return 4294 ias_pop2mark $mrk 4295 icl_rewind $pos 4296 4297 set mrk [ias_mark] 4298 set old [ier_get] 4299 matchSymbol_STAR ; # (n STAR) 4300 ier_merge $old 4301 4302 if {$ok} return 4303 ias_pop2mark $mrk 4304 icl_rewind $pos 4305 4306 set mrk [ias_mark] 4307 set old [ier_get] 4308 matchSymbol_PLUS ; # (n PLUS) 4309 ier_merge $old 4310 4311 if {$ok} return 4312 ias_pop2mark $mrk 4313 icl_rewind $pos 4314 4315 return 4316} 4317 4318proc ::page::parse::peg::matchSymbol_TO {} { 4319 # TO = (t -) 4320 4321 variable ok 4322 if {[inc_restore TO]} return 4323 4324 set pos [icl_get] 4325 4326 ict_advance "Expected - (got EOF)" 4327 if {$ok} {ict_match_token - "Expected -"} 4328 4329 isv_clear 4330 inc_save TO $pos 4331 ier_nonterminal "Expected TO" $pos 4332 return 4333} 4334 4335proc ::page::parse::peg::matchSymbol_VOID {} { 4336 # VOID = (x (t v) 4337 # (t o) 4338 # (t i) 4339 # (t d) 4340 # (n SPACE)) 4341 4342 variable ok 4343 if {[inc_restore VOID]} { 4344 if {$ok} ias_push 4345 return 4346 } 4347 4348 set pos [icl_get] 4349 4350 eseq59 ; # (x (t v) 4351 # (t o) 4352 # (t i) 4353 # (t d) 4354 # (n SPACE)) 4355 4356 isv_nonterminal_leaf VOID $pos 4357 inc_save VOID $pos 4358 if {$ok} ias_push 4359 ier_nonterminal "Expected VOID" $pos 4360 return 4361} 4362 4363proc ::page::parse::peg::eseq59 {} { 4364 4365 # (x (t v) 4366 # (t o) 4367 # (t i) 4368 # (t d) 4369 # (n SPACE)) 4370 4371 variable ok 4372 4373 set pos [icl_get] 4374 4375 set old [ier_get] 4376 ict_advance "Expected v (got EOF)" 4377 if {$ok} {ict_match_token v "Expected v"} 4378 ier_merge $old 4379 4380 if {!$ok} {icl_rewind $pos ; return} 4381 4382 set old [ier_get] 4383 ict_advance "Expected o (got EOF)" 4384 if {$ok} {ict_match_token o "Expected o"} 4385 ier_merge $old 4386 4387 if {!$ok} {icl_rewind $pos ; return} 4388 4389 set old [ier_get] 4390 ict_advance "Expected i (got EOF)" 4391 if {$ok} {ict_match_token i "Expected i"} 4392 ier_merge $old 4393 4394 if {!$ok} {icl_rewind $pos ; return} 4395 4396 set old [ier_get] 4397 ict_advance "Expected d (got EOF)" 4398 if {$ok} {ict_match_token d "Expected d"} 4399 ier_merge $old 4400 4401 if {!$ok} {icl_rewind $pos ; return} 4402 4403 set old [ier_get] 4404 matchSymbol_SPACE ; # (n SPACE) 4405 ier_merge $old 4406 4407 if {!$ok} {icl_rewind $pos ; return} 4408 4409 return 4410} 4411 4412# ### ### ### ######### ######### ######### 4413## Package Management 4414 4415package provide page::parse::peg 0.1 4416