go-lexer icon indicating copy to clipboard operation
go-lexer copied to clipboard

err without context of L

Open longxueyuu opened this issue 4 years ago • 3 comments

when the lexer starts to analyze the source string, if err occurs, L does not provider any interface to expose 'start', 'position' info of source string to bind to the error; the error is printed without this context info, so it is kind of difficult to locate the error in source string.

longxueyuu avatar May 19 '21 08:05 longxueyuu

Sorry for seeing this so late, I think that's a good point. I suppose the solution will be to add that information to the error being thrown so that it can show this information in its message.

I'd be happy to merge a PR with these changes.

bbuck avatar May 12 '22 14:05 bbuck

@longxueyuu @bbuck If you're interested in my solution I can make a merge request :-)

tvanriel avatar Jun 04 '22 09:06 tvanriel

Sure let me take a look this weekend.

bbuck avatar Jun 05 '22 02:06 bbuck