Skip to content

Commit

Permalink
Remove std:: prefix from variadic template arguments (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Jun 20, 2023
1 parent 0f11849 commit c5357db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wpiformat/wpiformat/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions wpiformat/wpiformat/test/test_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename Char, typename Traits, std::size_t N1, std::size_t... N>"
+ os.linesep,
)
test.add_output(
"template <typename Char, typename Traits, size_t N1, size_t... N>"
+ os.linesep,
True,
)

test.run(OutputType.FILE)

0 comments on commit c5357db

Please sign in to comment.