11/*************************
2- * Version: 1.1.1
2+ * Version: 1.2
33*************************/
44/*************************
55 * Other Functions / Classes
@@ -178,14 +178,7 @@ export class Ret {
178178 peg_c0 = "=>" ,
179179 peg_c1 = peg_literalExpectation ( "=>" , false ) ,
180180 peg_c2 = function ( head , v ) { return v ; } ,
181- peg_c3 = function ( head , tail ) {
182- let chain = [ head , ...tail ] ;
183- while ( chain . length > 1 ) {
184- const last = chain . pop ( ) ;
185- chain [ chain . length - 1 ] . nx = last ;
186- }
187- return chain [ 0 ] ;
188- } ,
181+ peg_c3 = function ( head , tail ) { return format_handler ( head , tail ) ; } ,
189182 peg_c4 = "|" ,
190183 peg_c5 = peg_literalExpectation ( "|" , false ) ,
191184 peg_c6 = function ( head , v ) { return v ; } ,
@@ -525,7 +518,7 @@ export class Ret {
525518 let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ;
526519
527520 s0 = peg_currPos ;
528- s1 = peg_parse_ ( ) ;
521+ s1 = peg_parseORB ( ) ;
529522 if ( s1 !== peg_FAILED ) {
530523 s2 = peg_parseType ( ) ;
531524 if ( s2 !== peg_FAILED ) {
@@ -602,9 +595,15 @@ export class Ret {
602595 }
603596 }
604597 if ( s3 !== peg_FAILED ) {
605- peg_savedPos = s0 ;
606- s1 = peg_c3 ( s2 , s3 ) ;
607- s0 = s1 ;
598+ s4 = peg_parseCRB ( ) ;
599+ if ( s4 !== peg_FAILED ) {
600+ peg_savedPos = s0 ;
601+ s1 = peg_c3 ( s2 , s3 ) ;
602+ s0 = s1 ;
603+ } else {
604+ peg_currPos = s0 ;
605+ s0 = peg_FAILED ;
606+ }
608607 } else {
609608 peg_currPos = s0 ;
610609 s0 = peg_FAILED ;
@@ -619,11 +618,83 @@ export class Ret {
619618 }
620619 if ( s0 === peg_FAILED ) {
621620 s0 = peg_currPos ;
622- s1 = peg_parse_ ( ) ;
621+ s1 = peg_parseType ( ) ;
623622 if ( s1 !== peg_FAILED ) {
624- s2 = peg_parseType ( ) ;
623+ s2 = [ ] ;
624+ s3 = peg_currPos ;
625+ s4 = peg_parse_ ( ) ;
626+ if ( s4 !== peg_FAILED ) {
627+ if ( input . substr ( peg_currPos , 2 ) === peg_c0 ) {
628+ s5 = peg_c0 ;
629+ peg_currPos += 2 ;
630+ } else {
631+ s5 = peg_FAILED ;
632+ if ( peg_silentFails === 0 ) { peg_fail ( peg_c1 ) ; }
633+ }
634+ if ( s5 !== peg_FAILED ) {
635+ s6 = peg_parse_ ( ) ;
636+ if ( s6 !== peg_FAILED ) {
637+ s7 = peg_parseType ( ) ;
638+ if ( s7 !== peg_FAILED ) {
639+ peg_savedPos = s3 ;
640+ s4 = peg_c2 ( s1 , s7 ) ;
641+ s3 = s4 ;
642+ } else {
643+ peg_currPos = s3 ;
644+ s3 = peg_FAILED ;
645+ }
646+ } else {
647+ peg_currPos = s3 ;
648+ s3 = peg_FAILED ;
649+ }
650+ } else {
651+ peg_currPos = s3 ;
652+ s3 = peg_FAILED ;
653+ }
654+ } else {
655+ peg_currPos = s3 ;
656+ s3 = peg_FAILED ;
657+ }
658+ while ( s3 !== peg_FAILED ) {
659+ s2 . push ( s3 ) ;
660+ s3 = peg_currPos ;
661+ s4 = peg_parse_ ( ) ;
662+ if ( s4 !== peg_FAILED ) {
663+ if ( input . substr ( peg_currPos , 2 ) === peg_c0 ) {
664+ s5 = peg_c0 ;
665+ peg_currPos += 2 ;
666+ } else {
667+ s5 = peg_FAILED ;
668+ if ( peg_silentFails === 0 ) { peg_fail ( peg_c1 ) ; }
669+ }
670+ if ( s5 !== peg_FAILED ) {
671+ s6 = peg_parse_ ( ) ;
672+ if ( s6 !== peg_FAILED ) {
673+ s7 = peg_parseType ( ) ;
674+ if ( s7 !== peg_FAILED ) {
675+ peg_savedPos = s3 ;
676+ s4 = peg_c2 ( s1 , s7 ) ;
677+ s3 = s4 ;
678+ } else {
679+ peg_currPos = s3 ;
680+ s3 = peg_FAILED ;
681+ }
682+ } else {
683+ peg_currPos = s3 ;
684+ s3 = peg_FAILED ;
685+ }
686+ } else {
687+ peg_currPos = s3 ;
688+ s3 = peg_FAILED ;
689+ }
690+ } else {
691+ peg_currPos = s3 ;
692+ s3 = peg_FAILED ;
693+ }
694+ }
625695 if ( s2 !== peg_FAILED ) {
626- s1 = [ s1 , s2 ] ;
696+ peg_savedPos = s0 ;
697+ s1 = peg_c3 ( s1 , s2 ) ;
627698 s0 = s1 ;
628699 } else {
629700 peg_currPos = s0 ;
@@ -633,6 +704,29 @@ export class Ret {
633704 peg_currPos = s0 ;
634705 s0 = peg_FAILED ;
635706 }
707+ if ( s0 === peg_FAILED ) {
708+ s0 = peg_currPos ;
709+ s1 = peg_parse_ ( ) ;
710+ if ( s1 !== peg_FAILED ) {
711+ s2 = peg_parseType ( ) ;
712+ if ( s2 !== peg_FAILED ) {
713+ s3 = peg_parse_ ( ) ;
714+ if ( s3 !== peg_FAILED ) {
715+ s1 = [ s1 , s2 , s3 ] ;
716+ s0 = s1 ;
717+ } else {
718+ peg_currPos = s0 ;
719+ s0 = peg_FAILED ;
720+ }
721+ } else {
722+ peg_currPos = s0 ;
723+ s0 = peg_FAILED ;
724+ }
725+ } else {
726+ peg_currPos = s0 ;
727+ s0 = peg_FAILED ;
728+ }
729+ }
636730 }
637731
638732 return s0 ;
@@ -3252,6 +3346,14 @@ export class Ret {
32523346 if ( ls !== null ) { ret . ls = ls ; }
32533347 return ret ;
32543348 }
3349+ function format_handler ( head , tail ) {
3350+ let chain = [ head , ...tail ] ;
3351+ while ( chain . length > 1 ) {
3352+ const last = chain . pop ( ) ;
3353+ chain [ chain . length - 1 ] . nx = last ;
3354+ }
3355+ return chain [ 0 ] ;
3356+ }
32553357
32563358
32573359 peg_result = peg_startRuleFunction ( ) ;
0 commit comments