Closed amery closed 3 years ago
I would recommend reading and saving symbols from the stream until you find the END token for whatever you are processing and then feeding the accumulated text into peg. Because peg is a backtracking parser, parsing a stream directly doesn't make much sense because the text from a stream must be buffered anyways.
as the stream doesn't necessarily have an END I need to be able to identify and process complete messages and postpone the incomplete one until more data is collected... without having to wait until the end of times to start the work, and without having to write a separated parser manually to pre-split the stream...
This is the downside of having a parser that can backtrack. It can backtrack to the beginning of time, so finding the chunks of input is left up to the user of the parser.
thanks, I understand now
hi, could you explain how to use peg generated code against text coming from a stream? if not supported, could you outline how you would want this implemented?