diff --git a/wpiformat/wpiformat/stdlib.py b/wpiformat/wpiformat/stdlib.py index d7d7305..abd3fbd 100644 --- a/wpiformat/wpiformat/stdlib.py +++ b/wpiformat/wpiformat/stdlib.py @@ -61,9 +61,9 @@ def __init__(self, name, func_names=None, type_regexes=None, add_prefix=True): type_names = regex_prefix + r"(" + r"|".join(type_regexes) + r")" - # Followed by optional spaces and ">", ")", ",", ";", or pointer - # asterisks - lookahead = r"(?=(\s*(\>|\)|,|;|\*+))|\s)" + # Followed by optional spaces and ">", ")", ",", ";", pointer + # asterisks, or ellipses + lookahead = r"(?=(\s*(\>|\)|,|;|\*+|\.\.\.))|\s)" self.type_regex = regex.compile(lookbehind + type_names + lookahead) else: diff --git a/wpiformat/wpiformat/test/test_stdlib.py b/wpiformat/wpiformat/test/test_stdlib.py index 8be4780..9416083 100644 --- a/wpiformat/wpiformat/test/test_stdlib.py +++ b/wpiformat/wpiformat/test/test_stdlib.py @@ -173,4 +173,16 @@ def test_stdlib(): test.add_input("./Main.cpp", "typedef integer std::uint8_t;") test.add_output("typedef integer uint8_t;", True) + # Remove "std::" from variadic template argument + test.add_input( + "./Class.cpp", + "template " + + os.linesep, + ) + test.add_output( + "template " + + os.linesep, + True, + ) + test.run(OutputType.FILE)