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
Hey Christophe,
first of all thanks for the great library. My attempt to follow Russ Cox implementation sadly isn't as elegant as good as yours. I was wondering if you are planning or thinking of implementing a failure object as a return value instead of 'nil'.
This goes in the lines of 'instaparse' where if the input doesn't match the parser description then a failure object is returned indicating at which point did the match process fail and what was expected.
Something like:
parse failed with input 'hello-word'
^^^^
Expected any of:
- chao
- return
I would also be willing to work on this in case you are quite busy. I have some basic understanding of how the algorithm works but I have yet to understand your full implementation, some guidance tips would be very helpfull.
So far I guess that the change should be done in these lines:
I can't tell for sure I would make such behavior the default but as an option it could be ok.
run consumes several items until either an accept or failed state is reached. longest-match calls run until either the input is consumed or a failed state is attained. The last accept state is returned (which by definition is the accept state of the longest match).
Currently I'm working on lookaheads (negative lookahead is done and works but I'm not happy with the impl – I want to try a stack of vm instead).
One other thing I'd like to explore is turning instructions into a fn (with combinators not with macros).
Hey Christophe,
first of all thanks for the great library. My attempt to follow Russ Cox implementation sadly isn't as elegant as good as yours. I was wondering if you are planning or thinking of implementing a failure object as a return value instead of 'nil'.
This goes in the lines of 'instaparse' where if the input doesn't match the parser description then a failure object is returned indicating at which point did the match process fail and what was expected.
Something like:
I would also be willing to work on this in case you are quite busy. I have some basic understanding of how the algorithm works but I have yet to understand your full implementation, some guidance tips would be very helpfull.
So far I guess that the change should be done in these lines:
But I'm confused about your use of the 'run' function in the loop for the longest match :/
The text was updated successfully, but these errors were encountered: