After further analysis, it seems that the problem comes from asPetitStream in PositionnableStream. This method checks if the attribute collection is nil and uses the collection if it is not nil. In our case, the collection is not nil but does not contain our file data, it only contains whitespaces. The problem is about the behavior of our FileStream where before reading, collection is not nil.
The question: does anyone have seen a similar problem with PP.
thanx
On Mon, Feb 13, 2012 at 1:40 PM, Lukas Renggli renggli@gmail.com wrote:
I do not understand what you are saying or asking.
Normally #asPetitStream should convert any non-memory stream to an efficient in-memory representation. Maybe this does not work properly in the Pharo version you are using? Or maybe your file is too big to be loaded into memory?
While it is technically possible to use PetitParser on an external stream (such as a file or socket stream) it is not advisable. PetitParser requires highly efficient random access to the parsed data and anything else than an indexed in-memory collection slows down the parsing by magnitudes.
Lukas
On 13 February 2012 13:11, Usman Bhatti usman.bhatti@gmail.com wrote:
Hello all,
We are using petitParser with a Stream by the parse method on a PPParser. This parse method calls asPetitStream on our stream which is supposed to return a stream with a valid format for PPParser. The problem is that
this
stream do not represent our test file but a lot of white spaces. this
code:
(StandardFileStream fileNamed: '/some/path/to/file/atextfile.txt' ) asPetitStream proves that.
Did someone else have a similar problem with petit parser?
thanx,
Usman & Guillaume
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev