Skip to content

Commit 039da9d

Browse files
donbarbossrittau
andauthored
Apply suggestions from code review
add comments to regex Co-authored-by: Sebastian Rittau <sebastian.rittau@zfutura.de>
1 parent d347d29 commit 039da9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/ts_utils/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type:
3030

3131
_REMOVE_COMMENT_RE = re.compile(
3232
r"""
33-
(\"(?:\\.|[^\\\"])*?\")
33+
(\"(?:\\.|[^\\\"])*?\") # matches literal strings
3434
|
35-
(\/\*.*?\*\/ | \/\/[^\r\n]*?(?:[\r\n]))
35+
(\/\*.*?\*\/ | \/\/[^\r\n]*?(?:[\r\n])) # matches single- and multi-line comments
3636
""",
3737
re.DOTALL | re.VERBOSE,
3838
)
3939
_REMOVE_TRAILING_COMMA_RE = re.compile(
4040
r"""
41-
(\"(?:\\.|[^\\\"])*?\")
41+
(\"(?:\\.|[^\\\"])*?\") # matches literal strings
4242
|
43-
,\s*([\]}])
43+
,\s*([\]}]) # matches commas before '}' or ']'
4444
""",
4545
re.DOTALL | re.VERBOSE,
4646
)

0 commit comments

Comments
 (0)