Closed aahamed closed 8 years ago
Your code looks good, the problem is with how lexer works right now. Next
should return error
, but some refactoring in parser.go is required first. Without it, we would need to check for error every time nextToken
is called, which I want to avoid.
As a temporary solution, I'd either ignore it or panic, but add a (skipped) test for it, so that it doesn't get forgotten. I think the refactoring should be ready in a few weeks at worst (I'm working on variadic functions right now, which will get Have closer to Go interop).
BTW. See how errors from scanGoToken
are swallowed - it's the same problem.
Thanks!
Really cool project! I would love to contribute. I saw that you were interested in providing support for multiline comments in have and I thought I'd try adding the functionality myself. The commit below details my current approach. Note that this commit is still a work in progress so I do not expect it to merge. The main purpose was to get some feedback and verify that my proposed solution makes sense. Please let me know if you have any comments. Thanks :)
Testing: I added 2 testcases in lexer_test.go/TestComments and they both pass. I currently do not handle the case where a multiline comment is not closed.