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

internal: Add comments to the lexer #4105

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

max-sixty
Copy link
Member

This doesn't impact any external interfaces atm — it adds comments to the lexer and filters them out before they hit the parser.

While we're still iterating on how comments (+ other significant whitespace) will be part of the formatter, we'll need comments in the lexer.

This doesn't impact any external interfaces atm — it adds comments to the lexer and filters them out before they hit the parser.

While we're still iterating on how comments (+ other significant whitespace) will be part of the formatter, we'll need comments in the lexer.
@max-sixty max-sixty requested a review from aljazerzen January 18, 2024 05:03
@vanillajonathan
Copy link
Collaborator

It would useful to have docblock comments in the AST so it could be used for documentation generation.

@max-sixty
Copy link
Member Author

It would useful to have docblock comments in the AST so it could be used for documentation generation.

Yes v good point

@max-sixty max-sixty merged commit 4ee6203 into PRQL:main Jan 18, 2024
36 checks passed
@max-sixty max-sixty deleted the comment-lexer branch January 18, 2024 17:50
max-sixty added a commit to max-sixty/prql that referenced this pull request Jan 18, 2024
@vanillajonathan
Copy link
Collaborator

The lexer now creates a token for DocComment which is good but it is not available in PL. It would be good if the PL also contained that.

@max-sixty
Copy link
Member Author

The lexer now creates a token for DocComment which is good but it is not available in PL. It would be good if the PL also contained that.

I agree but it might require some invasive work on the parser (check out the recent discussion about adding comments). Possibly we put this on the Statement struct and limit them doc comments to those...

@aljazerzen
Copy link
Member

Possibly we put this on the Statement struct and limit them doc comments to those...

This seems reasonable - this would cover docs for variables (including functions), types, and modules. Is there anything else, we'd want to cover>?

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.

3 participants