-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't add comments to AST #393
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea! I want to run a couple tests but this looks good at first glance
Forgot to explain the rationale for this change: Adding comments to the AST actually adds a final |
BTW do you think we could do this in the lexer itself? So that we can ignore comments and there would be no reasons to even bring them down to the parser. I think one of the downsides is that you might end up losing the commented blocks in error lines, but it might be that we currently don't support that either because of: // We don't really have to do anything when comments
// come in, we can simply ignore them
func (p *Parser) parseComment() ast.Expression {
return nil
} |
Yeah, that might actually work even better. Let me see how best to do it.
I dunno about you, but when I see:
the trailing comment is just noise. |
Yeah, I don't think I would be complaining if we didn't have the comments
in stacktraces etc :)
…On Wed, Aug 5, 2020, 1:42 PM Adrian Ho ***@***.***> wrote:
BTW do you think we could do this in the lexer itself? So that we can
ignore comments and there would be no reasons to even bring them down to
the parser.
Yeah, that might actually work even better. Let me see how best to do it.
I think one of the downsides is that you might end up losing the commented
blocks in error lines
I dunno about you, but when I see:
ERROR: identifier not found: nil
[2:7] 1 + nil # This should return 1
the trailing comment is just noise.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#393 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQFZDDDSUSXSPYWF63T43R7ESOXANCNFSM4PRKG3TQ>
.
|
Alternate solution to abs-lang#388 (previous solution at abs-lang#393). This one skips over comments entirely, so no comment tokens are passed to callers.
Just submitted #394 that eliminates comments at the lexer level. These two PRs are mutually incompatible, so you can choose whichever you prefer, and close the other. |
Alternate solution to abs-lang#388 (previous solution at abs-lang#393). This one skips over comments entirely, so no comment tokens are passed to callers.
7015eb1
to
d36e9aa
Compare
Alternate solution to abs-lang#388 (previous solution at abs-lang#393). This one skips over comments entirely, so no comment tokens are passed to callers.
Since #394 seems to be the preferred approach, I'm closing this PR. |
It just confuses the REPL into printing nothing, even when it should.
Closes #388.