8000 feat(BEAM): Add support for Erlang, Elixir, and Gleam comments by kikofernandez · Pull Request #1117 · fsfe/reuse-tool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(BEAM): Add support for Erlang, Elixir, and Gleam comments #1117

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

Merged
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,4 @@ Contributors
- Linnea Gräf <nea@nea.moe>
- Raphael Schlarb <info@raphael.schlarb.one>
- Matthias Schoettle <opensource@mattsch.com>
- Kiko Fernandez-Reyes <kiko@erlang.org>
3 changes: 3 additions & 0 deletions changelog.d/added/erlang-elixir-gleam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Added comment support for Erlang (`.erl` and `.hrl`), Erlang's leex and yecc
lexer and parser generators (`.xrl` and `.yrl`), Elixir (`.ex` and `.exs`),
and Gleam (`.gleam`). (#1117)
21 changes: 19 additions & 2 deletions src/reuse/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# SPDX-FileCopyrightText: 2024 Rivos Inc.
# SPDX-FileCopyrightText: 2024 Anthony Loiseau <anthony.loiseau@allcircuits.com>
# SPDX-FileCopyrightText: 2025 Raphael Schlarb <info@raphael.schlarb.one>
# SPDX-FileCopyrightText: 2025 Kiko Fernandez-Reyes <kiko@erlang.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -357,6 +358,7 @@ class CppSingleCommentStyle(CommentStyle):

SINGLE_LINE = "//"
INDENT_AFTER_SINGLE = " "
SHEBANGS = ["#!"] # Gleam


class EmptyCommentStyle(CommentStyle):
Expand Down Expand Up @@ -393,6 +395,16 @@ class ModernFortranCommentStyle(CommentStyle):
INDENT_AFTER_SINGLE = " "


class ErlangCommentStyle(CommentStyle):
"""Erlang comment style."""

SHORTHAND = "erlang"

SINGLE_LINE = "%"
INDENT_AFTER_SINGLE = " "
SHEBANGS = ["#!"]


class FtlCommentStyle(CommentStyle):
"""FreeMarker Template Language comment style."""

Expand Down Expand Up @@ -633,7 +645,9 @@ class XQueryCommentStyle(CommentStyle):
".dts": CppCommentStyle,
".dtsi": CppCommentStyle,
".el": LispCommentStyle,
".erl": TexCommentStyle,
".erl": ErlangCommentStyle,
".escript": ErlangCommentStyle,
".es": ErlangCommentStyle,
".ex": PythonCommentStyle,
".exs": PythonCommentStyle,
".f": FortranCommentStyle,
Expand All @@ -654,6 +668,7 @@ class XQueryCommentStyle(CommentStyle):
".fsx": CppCommentStyle,
".ftl": FtlCommentStyle,
".gemspec": PythonCommentStyle,
".gleam": CppSingleCommentStyle,
".go": CppCommentStyle,
".gperf": CppCommentStyle,
".gradle": CppCommentStyle,
Expand All @@ -668,7 +683,7 @@ class XQueryCommentStyle(CommentStyle):
".hh": CppCommentStyle,
".hjson": CppCommentStyle,
".hpp": CppCommentStyle,
".hrl": TexCommentStyle,
".hrl": ErlangCommentStyle,
".hs": HaskellCommentStyle,
".html": HtmlCommentStyle,
".hx": CppCommentStyle,
Expand Down Expand Up @@ -826,11 +841,13 @@ class XQueryCommentStyle(CommentStyle):
".xqm": XQueryCommentStyle,
".xqy": XQueryCommentStyle,
".xquery": XQueryCommentStyle,
".xrl": ErlangCommentStyle,
".xsd": HtmlCommentStyle,
".xsh": PythonCommentStyle,
".xsl": HtmlCommentStyle,
".yaml": PythonCommentStyle,
".yml": PythonCommentStyle,
".yrl": ErlangCommentStyle,
".zig": CppSingleCommentStyle,
".zsh": PythonCommentStyle,
}
Expand Down
0