-
Notifications
You must be signed in to change notification settings - Fork 156
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
feat(BEAM): Add support for Erlang, Elixir, and Gleam comments #1117
base: main
Are you sure you want to change the base?
feat(BEAM): Add support for Erlang, Elixir, and Gleam comments #1117
Conversation
Thanks @maennchen for reminding me of Erlang's lexer and parser generators, which are now included in the PR :) |
6489b9c
to
977d112
Compare
SHEBANGS = ["#!"] | ||
|
||
|
||
class ElixirCommentStyle(CommentStyle): |
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.
This looks identical to PythonCommentStyle
. Do you see any differences or do you think they styles will diverge in the future?
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.
I do not see any differences, but I thought that maybe one does not want to conflate comment styles for different languages, in case in a few years one comment style changes a bit, while the other should not.
Happy to be wrong and I can fix to use Python style, if you think this is more maintainable 😃
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.
I mean I'm just getting back into the codebase, but from what I can see, many languages use the same code style definition and it wouldn't be an issue to add another one should they diverge in the future.
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.
Ok, can you confirm that I understand that the preference is to follow PythonCommentStyle
?
Just to confirm that I understood correctly that I should modify this
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.
Yes, that's what I prefer, but let's wait with changes until we have the confirmation that I'm not just missing something.
@@ -400,6 +421,16 @@ class FtlCommentStyle(CommentStyle): | |||
MULTI_LINE = MultiLineSegments("<#--", "", "-->") | |||
|
|||
|
|||
class GleamCommentStyle(CommentStyle): |
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.
I think CppCommentStyle
will serve the same purpose here, won't it?
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.
I am not sure it would work, as Gleam does not have multiline as CPP
-- copy-pasted CppCommentStyle snippet
MULTI_LINE = MultiLineSegments("/*", "*", "*/")
and the CppCommentStyle also uses some php SHEBANG which I do not think work on Gleam
-- copy-pasted CppCommentStyle snippet
SHEBANGS = [
"#!", # V-Lang
"<?php", # PHP
]
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.
If I'm not completely off, using CppCommentStyle
would only cause a problem if there was a chance for something that looks like a multiline comment in Gleam, but isn't one. The same should also be true for the shebang. @carmenbianca can you confirm?
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.
To be honest, I do not think it is an issue in Gleam, but I have not written much Gleam myself.
I mention this as to separate concerns :)
Please let me know what the preferred way would be :)
977d112
to
e034c08
Compare
Adds support for comments for the most used BEAM languages:
Erlang
Elixir
Gleam
Added a change log entry in
changelog.d/<directory>/
.Added self to copyright blurb of touched files.
Added self to
AUTHORS.rst
.My changes do not contradict
the current specification.
I agree to license my contribution under the licenses indicated in the
changed files.