You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was noticing that the ParserDispatcher can not complete cleanly, it gets no signal that the buffer has ended and you need to check it at the end. You can see it here in the example.
having some irritation with checking and cleaning up state at the end, like shown here with the str != ""
It would be nice to add a nil terminating Sequence item to the sequence to allow the ParserDispatcher a chance to clean any state.
We would need to small change in the parser.Parse function to something like this.
// Parse parses the given dispatcher and byte buffer.func (p*Parser) Parse(dispatcherParserDispatcher, b []byte) {
fori:=0; i<len(b); i++ {
p.Advance(dispatcher, b[i], i<len(b)-1)
}
dispatcher(SequenceEnd(0)) /// <-- added line
}
Thanks
Tom
The text was updated successfully, but these errors were encountered:
I was noticing that the
ParserDispatcher
can not complete cleanly, it gets no signal that the buffer has ended and you need to check it at the end. You can see it here in the example.examples/parserlog/main.go
having some irritation with checking and cleaning up state at the end, like shown here with the
str != ""
It would be nice to add a nil terminating
Sequence
item to the sequence to allow theParserDispatcher
a chance to clean any state.We would need to small change in the
parser.Parse
function to something like this.Thanks
Tom
The text was updated successfully, but these errors were encountered: