arr-ai / wbnf

ωBNF implementation
Apache License 2.0
7 stars 4 forks source link

Support stream inputs #72

Open marcelocantos opened 4 years ago

marcelocantos commented 4 years ago

Currently, wbnf requires the entire input to be passed as a string, which means the entire source needs to be available before parsing can start.

Add the ability to pass in some kind of streaming source, such as an io.Reader.

io.RuneReader seems like a good candidate, since regexp can use it directly. However, there is a caveat that the related regexp functions and methods might consume more characters than end up matching. Some effort would have to go into implementing a wind-back mechanism.