go-datemath
go-datemath copied to clipboard
scanner internal error
I got this panic in using the library: scanner internal error
. It looks like it is coming from here:
https://github.com/vectordotdev/go-datemath/blob/master/datemath.l.go#L341
It seems to be caused by passing in an invalid expression like "no" instead of "now" into the parser function. In my opinion, this should be caught earlier and be a regular error message instead of flat-out panicking. Besides, the comment above the panic in code says how this should never happen - and yet it does.
Thanks for reporting this @kolaente !
I was able to verify this panic. The code you are reference is generated code. The fix should go in the source lex file: https://github.com/vectordotdev/go-datemath/blob/master/datemath.l