Skip to content

Commit c5357db

Browse files
authored
Remove std:: prefix from variadic template arguments (#254)
1 parent 0f11849 commit c5357db

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

wpiformat/wpiformat/stdlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def __init__(self, name, func_names=None, type_regexes=None, add_prefix=True):
6161

6262
type_names = regex_prefix + r"(" + r"|".join(type_regexes) + r")"
6363

64-
# Followed by optional spaces and ">", ")", ",", ";", or pointer
65-
# asterisks
66-
lookahead = r"(?=(\s*(\>|\)|,|;|\*+))|\s)"
64+
# Followed by optional spaces and ">", ")", ",", ";", pointer
65+
# asterisks, or ellipses
66+
lookahead = r"(?=(\s*(\>|\)|,|;|\*+|\.\.\.))|\s)"
6767

6868
self.type_regex = regex.compile(lookbehind + type_names + lookahead)
6969
else:

wpiformat/wpiformat/test/test_stdlib.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,16 @@ def test_stdlib():
173173
test.add_input("./Main.cpp", "typedef integer std::uint8_t;")
174174
test.add_output("typedef integer uint8_t;", True)
175175

176+
# Remove "std::" from variadic template argument
177+
test.add_input(
178+
"./Class.cpp",
179+
"template <typename Char, typename Traits, std::size_t N1, std::size_t... N>"
180+
+ os.linesep,
181+
)
182+
test.add_output(
183+
"template <typename Char, typename Traits, size_t N1, size_t... N>"
184+
+ os.linesep,
185+
True,
186+
)
187+
176188
test.run(OutputType.FILE)

0 commit comments

Comments
 (0)