Skip to content

Commit c444a41

Browse files
BUG FX:
- Fix line comment removal in C-style languages - Support for Swift, Kotlin, Rust, and Dart
1 parent 1243723 commit c444a41

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/python/ccp.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,28 @@ def __init__(self, pattern: str, is_block: bool = False, is_doc: bool = False,
123123
'block': CommentPattern(r'/\*[\s\S]*?\*/', is_block=True, description="Java block comment"),
124124
'doc': CommentPattern(r'/\*\*[\s\S]*?\*/', is_block=True, is_doc=True,
125125
description="Java doc comment"),
126+
},
127+
'swift': {
128+
'line': CommentPattern(r'//.*$', description="Swift line comment"),
129+
'block': CommentPattern(r'/\*[\s\S]*?\*/', is_block=True, description="Swift block comment"),
130+
'doc': CommentPattern(r'/\*\*[\s\S]*?\*/', is_block=True, is_doc=True,
131+
description="Swift documentation comment"),
132+
},
133+
'kotlin': {
134+
'line': CommentPattern(r'//.*$', description="Kotlin line comment"),
135+
'block': CommentPattern(r'/\*[\s\S]*?\*/', is_block=True, description="Kotlin block comment"),
136+
'doc': CommentPattern(r'/\*\*[\s\S]*?\*/', is_block=True, is_doc=True,
137+
description="Kotlin documentation comment"),
138+
},
139+
'rust': {
140+
'line': CommentPattern(r'//.*$', description="Rust line comment"),
141+
'block': CommentPattern(r'/\*[\s\S]*?\*/', is_block=True, description="Rust block comment"),
142+
'doc': CommentPattern(r'///.*$', is_doc=True, description="Rust documentation line comment"),
143+
},
144+
'dart': {
145+
'line': CommentPattern(r'//.*$', description="Dart line comment"),
146+
'block': CommentPattern(r'/\*[\s\S]*?\*/', is_block=True, description="Dart block comment"),
147+
'doc': CommentPattern(r'///.*$', is_doc=True, description="Dart documentation line comment"),
126148
}
127149
}
128150

0 commit comments

Comments
 (0)