------art_3956_21428442.1202087128591
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Feb 3, 2008 6:39 PM, Clifford Heath <no / spam.please.net> wrote:

> Eric Mahurin wrote:
> > I was expecting this to work as a proxy to the Treetop parser:
> >
> > class JSONParser
> >     def initialize
> >         @parser  sonParser.new
> >     end
> >     def parse(s)
> >         @parser.parse(StringIO.new(s)).value
> >     end
> > end
>
> You need to pass the string directly, not as a StringIO.
> Treetop parses a String, not an IO.


I guess my eyes missed the ".read" after the STDIN .  The "STDIN" jumped out
and I thought it took an IO-like object.  I was able to just remove a couple
lines of Steve's code and rename the class to get it to work with the tests
(unit and random performance benchmark).  It mismatches in both the unit
tests and the performance benchmark, but I if I remove the self-checking I
was able to run the performance benchmark.  It was only about 6800
chars/second which is near the bottom of the heap.  Not sure how valid that
is since the parser has problems though.

Eric

------art_3956_21428442.1202087128591--