From 59a6e12d6b98f5489584dbdf0832e5066c407cc2 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Tue, 20 Apr 2021 12:59:00 -0400 Subject: [PATCH] fix(cpp): Allow declaring multiple functions and parenthetical initializers Fix #3148 --- src/languages/cpp.js | 2 +- test/markup/cpp/function-declarations.expect.txt | 2 ++ test/markup/cpp/function-declarations.txt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/languages/cpp.js b/src/languages/cpp.js index edfbf1cd51..970f584bb3 100644 --- a/src/languages/cpp.js +++ b/src/languages/cpp.js @@ -302,7 +302,7 @@ export default function(hljs) { end: /[{;=]/, excludeEnd: true, keywords: CPP_KEYWORDS, - illegal: /[^\w\s\*&:<>.]/, + illegal: /[^\w\s\*&:<>.,]/, contains: [ { // to prevent it from being confused as the function title begin: DECLTYPE_AUTO_RE, diff --git a/test/markup/cpp/function-declarations.expect.txt b/test/markup/cpp/function-declarations.expect.txt index fc7cea4c16..b04c01e87f 100644 --- a/test/markup/cpp/function-declarations.expect.txt +++ b/test/markup/cpp/function-declarations.expect.txt @@ -21,3 +21,5 @@ void A(): a(10) {} explicit A(): a(10) {} + +extern void f(int), g(char); diff --git a/test/markup/cpp/function-declarations.txt b/test/markup/cpp/function-declarations.txt index ced198b2c7..c78ffc21a7 100644 --- a/test/markup/cpp/function-declarations.txt +++ b/test/markup/cpp/function-declarations.txt @@ -21,3 +21,5 @@ test(); void A(): a(10) {} explicit A(): a(10) {} + +extern void f(int), g(char);