in reply to Re: Parse::RecDescent grammar and Parenthesis
in thread Parse::RecDescent grammar and Parenthesis

Yes I have, but it behaves the same as before (it will print a straight number, but not an expression).

My original modifications look like they should work also, but sadly that is not the case ;(

update:

Upon the suggestion of jmcnamara i've set $::RD_TRACE = 1; and ran the beast and got the following in my STDERR (readmore follows)

|myprint_in|Trying rule: [myprint_instruction] |4 |myprint_in| |"print( 6+9 )" |myprint_in|Trying production: ['print(' | | |expression ')'] | |myprint_in|Trying terminal: ['print('] | |myprint_in|>>Matched terminal<< (return value: | | |[print(]) | |myprint_in| |" 6+9 )" |myprint_in|Trying subrule: [expression] | |expression|Trying rule: [expression] | |expression|Trying production: [INTEGER OP | | |expression] | |expression|Trying subrule: [INTEGER] | | INTEGER |Trying rule: [INTEGER] | | INTEGER |Trying production: [/[-+]?\d+/] | | INTEGER |Trying terminal: [/[-+]?\d+/] | | INTEGER |>>Matched terminal<< (return value: | | |[6]) | | INTEGER | |"+9 )" | INTEGER |>>Matched production: [/[-+]?\d+/]<< | | INTEGER |>>Matched rule<< (return value: [6]) | | INTEGER |(consumed: [ 6]) | |expression|>>Matched subrule: [INTEGER]<< (return| | |value: [6] | |expression|Trying subrule: [OP] | | OP |Trying rule: [OP] | | OP |Trying production: [m([-+*/%])] | | OP |Trying terminal: [m([-+*/%])] | | OP |>>Matched terminal<< (return value: | | |[+]) | | OP | |"9 )" | OP |>>Matched production: [m([-+*/%])]<< | | OP |>>Matched rule<< (return value: [+]) | | OP |(consumed: [+]) | |expression|>>Matched subrule: [OP]<< (return | | |value: [+] | |expression|Trying subrule: [expression] | |expression|Trying rule: [expression] | |expression|Trying production: [INTEGER OP | | |expression] | |expression|Trying subrule: [INTEGER] | | INTEGER |Trying rule: [INTEGER] | | INTEGER |Trying production: [/[-+]?\d+/] | | INTEGER |Trying terminal: [/[-+]?\d+/] | | INTEGER |>>Matched terminal<< (return value: | | |[9]) | | INTEGER | |" )" | INTEGER |>>Matched production: [/[-+]?\d+/]<< | | INTEGER |>>Matched rule<< (return value: [9]) | | INTEGER |(consumed: [9]) | |expression|>>Matched subrule: [INTEGER]<< (return| | |value: [9] | |expression|Trying subrule: [OP] | | OP |Trying rule: [OP] | | OP |Trying production: [m([-+*/%])] | | OP |Trying terminal: [m([-+*/%])] | | OP |<<Didn't match terminal>> | | OP | |")" | OP |<<Didn't match rule>> | |expression|<<Didn't match subrule: [OP]>> | |expression|Trying production: [VARIABLE OP | | |expression] | |expression| |"9 )" |expression|Trying subrule: [VARIABLE] | | VARIABLE |Trying rule: [VARIABLE] | | VARIABLE |Trying production: [/\w[a-z0-9_]*/i] | | VARIABLE |Trying terminal: [/\w[a-z0-9_]*/i] | | VARIABLE |>>Matched terminal<< (return value: | | |[9]) | | VARIABLE | |" )" | VARIABLE |>>Matched production: [/\w[a-z0- | | |9_]*/i]<< | | VARIABLE |>>Matched rule<< (return value: [9]) | | VARIABLE |(consumed: [9]) | |expression|>>Matched subrule: [VARIABLE]<< | | |(return value: [9] | |expression|Trying subrule: [OP] | | OP |Trying rule: [OP] | | OP |Trying production: [m([-+*/%])] | | OP |Trying terminal: [m([-+*/%])] | | OP |<<Didn't match terminal>> | | OP | |")" | OP |<<Didn't match rule>> | |expression|<<Didn't match subrule: [OP]>> | |expression|Trying production: [INTEGER] | |expression| |"9 )" |expression|Trying subrule: [INTEGER] | | INTEGER |Trying rule: [INTEGER] | | INTEGER |Trying production: [/[-+]?\d+/] | | INTEGER |Trying terminal: [/[-+]?\d+/] | | INTEGER |>>Matched terminal<< (return value: | | |[9]) | | INTEGER | |" )" | INTEGER |>>Matched production: [/[-+]?\d+/]<< | | INTEGER |>>Matched rule<< (return value: [9]) | | INTEGER |(consumed: [9]) | |expression|>>Matched subrule: [INTEGER]<< (return| | |value: [9] | |expression|>>Matched production: [INTEGER]<< | |expression|>>Matched rule<< (return value: [9]) | |expression|(consumed: [9]) | |expression|>>Matched subrule: [expression]<< | | |(return value: [9] | |expression|Trying action | |myprint_in|>>Matched subrule: [expression]<< | | |(return value: [15] | |myprint_in| |" 6+9 )" |myprint_in|Trying terminal: [')'] | |myprint_in|<<Didn't match terminal>> | |myprint_in| |"6+9 )" |myprint_in|<<Didn't match rule>> |
So it slurps 'print(' ok, goes on to match everything up to ' )' as an expression, and then starts backtracking?? this baffles me...

In case you were wondering what !SCALASCRIPT looks like, here is a chunk (Parse::RecDescent might be overkill, but just barely ... I have other ways of parsing this, but none are this cool)

!ScalaScript EVENT Group: Config.SaveOpts(); Sequence: :"Slide.1" EVENT Group: Display(Wipe("PaintRoller", Direction(0)), Face(Pen(2)), View( +Size(800, 600), ColorModel(HiColor)), Margin(10, 10, 0, 0), Tabs(Expl +icit(80, 160, 240, 320, 400, 480, 560)), UserPalette(RGBPen(1, $0, $f +fffff, $999999, $555555, $712068, $df449c, $dc110e, $662200, $ff5a00, + $ff9c00, $ffee00, $8800, $dd00, $cccc, $66ff, $aa, $777777, $bbbbbb, + $dddddd)), Size(720, 540)); Pause(10); Clip(0, 0, "path/to/image.stream.jpg", Transparent(Off), Locke +d(On), Operation(On, TransparentRGB($8fe4c0, TransparentDelta(5)))); Sequence: Text(36, 141, "you are watching ", Wipe("Wipe", Direction(0)), + Outline(On), Locked(On), AntiAlias(On), Update(Normal), Font("Arial +(Western [])", 60), Italic(On), Wrap(On, Auto(545))); Text(420, 143, "...", Wipe("Wipe", Speed(1), Direction(0)), Ou +tline(On), Locked(On), AntiAlias(On), Update(Normal), Font("Arial (We +stern [])", 60), Italic(On), Wrap(Off, Auto(307))); Clip(189, 347, "abc/am.LOGO.jpg", Wipe("Wipe", Speed(6), Direc +tion(0)), Transparent(Off), Locked(On), Operation(On, TransparentRGB( +$8fe4c0, TransparentDelta(5)))); END :"Some other slide" EVENT Group: Picture("abc/supplemental.2.jpg", Wipe("PaintRoller", Directio +n(0)), Margin(10, 10, 0, 0), Tabs(Explicit(86, 174, 240, 320, 400, 48 +0, 608)), UserPalette(RGBPen(1, $0, $ffffe2), RGBPen(20, $ffffff), RG +BPen(3, $999999, $555555, $712068, $df449c, $dc110e, $662200, $ff5a00 +, $ff9c00, $ffee00, $8800, $dd00, $cccc, $66ff, $aa, $777777, $664e57 +, $664257), RGBPen(21, $52425e)), Operation(On, Dither(On))); Pause(10); Text(29, 107, "Some text:", Face(On, Pen(1)), Outline(On, Pen( +2), Thickness(2)), AntiAlias(On), Update(Normal), Font("Times New Rom +an (Western [])", 35), Bold(On), Italic(On), Wrap(On, Width(600))); Text(29, 152, "bla bla bla bla blablkja", Face(On, Pen(1)), Ou +tline(On, Pen(2), Thickness(2)), Locked(On), AntiAlias(On), Update(No +rmal), Font("Times New Roman (Western [])", 35), Bold(On), Italic(On) +, Leading(4), Wrap(On, Width(600))); Sequence: Text(-5, 30, "Saratoga Community Access TV Bulletin Board ", +Append(" ", Face(On, Pen(20)), Italic(Off)), Wipe("PaintRoller", Dire +ction(0)), Backdrop(On, Pen(21)), Transparent(Off), Locked(On), AntiA +lias(On), Update(Normal), Font("Times New Roman (Western [])", 40), I +talic(On)); END

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"