kursjan / petitparser2

A high-performance top-down parser
MIT License
41 stars 17 forks source link

Alternatives to `readLimit` in `PP2InMemoryContext` #29

Closed kursjan closed 5 years ago

kursjan commented 5 years ago

Several methods (PP2InMemoryContext->'adoptString:', PP2InMemoryContext->'next:', PP2InMemoryContext->'nextFor:', PP2InMemoryContext->'readLimit', PP2InMemoryContext->'stream:', PP2InMemoryContext->'upTo:', PP2RecordingContext->'stream:') reference readLimit that doesn't exist in GemStone. Would there be another way to test this using message sends?

kursjan commented 5 years ago

@jgfoster: honestly, I would prefer to avoid any extra message sends in these methods. On the other hand, using PP2InMemoryCotnext#readLimit, which is a simple getter in Pharo implementation should't have negative effect on the performance.

But I wonder how is readLimit obtained in Gemstone? Maybe we can get inspired by PetitParser port to Gemstone (if there is one). How is PPStream#next: implemented in Gemstone?

jgfoster commented 5 years ago

@kursjan: I should have looked at the PPStream implementation in GemStone more carefully (I did the port a few years ago!). We already have a ReadStreamPortable class and I just need to change the superclass for things that inherit from ReadStream to ReadStreamPortable.

This issue may be closed.