Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle parameter packs T... #62

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sphinxcontrib/doxylink/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def normalise_templates(toks):
input_type('input_type').setParseAction(' '.join) + \
Opt(pointer_or_reference, default='')("pointer_or_reference1") + \
Opt('const')('const_pointer_or_reference') + \
Opt(pointer_or_reference, default='')("pointer_or_reference2")
Opt(pointer_or_reference, default='')("pointer_or_reference2") +\
Opt('...')("parameter_pack")

# Argument + variable name + default
argument = Group(argument_type('argument_type') + Opt(input_name) + Opt(default_value))
Expand Down Expand Up @@ -142,6 +143,9 @@ def normalise(symbol: str) -> Tuple[str, str]:
# And combine them into a single normalised string and add them to the argument list
argument_string_list.extend(const_pointer_ref_list)

# Add template parameter pack
argument_string_list.append(arg.parameter_pack)

# Finally we join our argument string and add it to our list
normalised_arg_list.append(''.join(argument_string_list))

Expand Down
1 change: 1 addition & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
]

varargs = [
('(Args&& ... args)', ('', '(Args&&...)')),
('(int nb=0,...)', ('', '(int, ...)')),
('printf( const char* format, ... )', ('printf', '(const char*, ...)')),
('fprintf( std::FILE* stream, const char* format, ... )', ('fprintf', '(std::FILE*, const char*, ...)')),
Expand Down
Loading