Skip to content

Commit 252d619

Browse files
authored
Merge pull request #889 from perillo/add-zig-support
Add support for Zig and fix Hare comment style
2 parents cbca4a7 + 4e8e0c5 commit 252d619

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ CLI command and its behaviour. There are no guarantees of stability for the
5555
- ShellCheck configuration (`.shellcheckrc`) (#862)
5656
- Pylint in-project configuration (`pylintrc`) (#862)
5757
- Lisp schemes (`.sld`, `.sls`, `.sps`) (#875)
58+
- Added comment styles:
59+
- `csingle` for Zig (`.zig`) and Hare (`.ha`) (#889)
5860
- Display recommendations for steps to fix found issues during a lint. (#698)
5961
- Add support for Pijul VCS. Pijul support is not added to the Docker image.
6062
(#858)

src/reuse/comment.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,15 @@ class XQueryCommentStyle(CommentStyle):
524524
INDENT_BEFORE_END = " "
525525

526526

527+
class CSingleCommentStyle(CommentStyle):
528+
"""C single-only comment style."""
529+
530+
SHORTHAND = "csingle"
531+
532+
SINGLE_LINE = "//"
533+
INDENT_AFTER_SINGLE = " "
534+
535+
527536
#: A map of (common) file extensions against comment types.
528537
EXTENSION_COMMENT_STYLE_MAP = {
529538
".adb": HaskellCommentStyle,
@@ -600,7 +609,7 @@ class XQueryCommentStyle(CommentStyle):
600609
".graphql": PythonCommentStyle,
601610
".groovy": CCommentStyle,
602611
".h": CCommentStyle,
603-
".ha": CCommentStyle,
612+
".ha": CSingleCommentStyle,
604613
".hbs": HandlebarsCommentStyle,
605614
".hcl": PythonCommentStyle,
606615
".hh": CCommentStyle,
@@ -712,11 +721,11 @@ class XQueryCommentStyle(CommentStyle):
712721
# SuperCollider synth definition (binary)
713722
".scsyndef": UncommentableCommentStyle,
714723
".sh": PythonCommentStyle,
715-
".sld": LispCommentStyle, # Scheme Library Definition (R7RS)
716-
".sls": LispCommentStyle, # Scheme Library Source (R6RS)
724+
".sld": LispCommentStyle, # Scheme Library Definition (R7RS)
725+
".sls": LispCommentStyle, # Scheme Library Source (R6RS)
717726
".sml": MlCommentStyle,
718727
".soy": CCommentStyle,
719-
".sps": LispCommentStyle, # Scheme Program Source (R6RS)
728+
".sps": LispCommentStyle, # Scheme Program Source (R6RS)
720729
".sql": HaskellCommentStyle,
721730
".sty": TexCommentStyle,
722731
".svg": UncommentableCommentStyle,
@@ -756,6 +765,7 @@ class XQueryCommentStyle(CommentStyle):
756765
".xsl": HtmlCommentStyle,
757766
".yaml": PythonCommentStyle,
758767
".yml": PythonCommentStyle,
768+
".zig": CSingleCommentStyle,
759769
".zsh": PythonCommentStyle,
760770
}
761771

0 commit comments

Comments
 (0)