Skip to content
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

Add single-line comments #87

Closed
wants to merge 5 commits into from

Conversation

stefan991
Copy link
Contributor

@stefan991 stefan991 commented Apr 6, 2020

Based on your answer on #79 I thought i would give it a try, at least single-line comments for now.

SingleLineComments

This PR implements single-line comments which are saved as SingeLineCommentTriva in the SyntaxTokens. WhitespaceToken got changed to WhitespaceTrivia and EndOfLineTrivia as well.

I choose // for the syntax, because I was interested how this interacts with the SlashToken.

Multiline comments themself are not that hard, but it needs some changes to the way the REPL handles syntax coloring (each line is parsed separately). I have tried something, but that's not yet ready for a pull request. 😅

Thanks a lot for this series. 👍

PS: No worries if you don't merge this, I know it might not fit with your roadmap.

Lex whitespace and line endings as SyntaxTrivia.
The submission is not complete if there are no members in the CompilationUnitSyntax. This triggers if there is whitespace in the submission.
If you type comments into the Repl they get associated with the EndOfFileToken. To display them the Repl needs access to the EndOfFileToken. Adds some color as well.
@terrajobst
Copy link
Owner

Thanks, but I'll do this on the stream (#100, #101)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants