Skip to content

Commit

Permalink
fix(#26): Allow colon inside C++ angle bracket notation in the return…
Browse files Browse the repository at this point in the history
… type
  • Loading branch information
kkoomen committed Jul 20, 2019
1 parent 33b7a02 commit 83df9d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ftplugin/cpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ call add(b:doge_patterns, {
" template<typename T, typename... Args>
" static T* create(Args&& ... args) {}
call add(b:doge_patterns, {
\ 'match': '\m^\%(\%(template\s*<[[:alnum:][:space:]_<>.,]*>\|const\|inline\)\s\+\)\?\%(static\s\+\)\?\([[:alnum:]_:&*]\+\s*\%(<[[:alnum:][:space:]_<>.,]\+>\)\?\|[[:alnum:]_]\+(.\{-})\)\s\+\%([[:alnum:]_:]\+\)\s*(\(.\{-}\))\s*[;{]',
\ 'match': '\m^\%(\%(template\s*<[[:alnum:][:space:]_<>.,]*>\|const\|inline\)\s\+\)\?\%(static\s\+\)\?\([[:alnum:]_:&*]\+\s*\%(<[[:alnum:][:space:]_<>.,:]\+>\)\?\|[[:alnum:]_]\+(.\{-})\)\s\+\%([[:alnum:]_:]\+\)\s*(\(.\{-}\))\s*[;{]',
\ 'match_group_names': ['returnType', 'parameters'],
\ 'parameters': {
\ 'match': s:parameters_match_pattern,
Expand Down
2 changes: 2 additions & 0 deletions playground/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ void Emitter::append_token(const std::string& text, const AST_Node* node)
//
}

std::vector<std::string> someFunction();

/**
* TODO
*
Expand Down
14 changes: 12 additions & 2 deletions test/filetypes/cpp/function-declarations.vader
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ Given cpp (function declarations with parameters with advanced return types):

ASIO_SYNC_OP_VOID myFunc(verify_mode v, asio::error_code& ec);

std::string trimLine(const std::string &line);
std::string myFunc(const std::string &line);

std::vector<std::string> myFunc();

Do (trigger doge):
\<C-d>
:9\<CR>
\<C-d>
:18\<CR>
\<C-d>
:27\<CR>
\<C-d>

Expect cpp (generated comments with @param and @return tags):
/**
Expand All @@ -57,4 +61,10 @@ Expect cpp (generated comments with @param and @return tags):
* @param line TODO
* @return TODO
*/
std::string trimLine(const std::string &line);
std::string myFunc(const std::string &line);

/**
* TODO
* @return TODO
*/
std::vector<std::string> myFunc();

0 comments on commit 83df9d1

Please sign in to comment.