Library: formatting of simplified types adjusted

Need to be more careful when eating trailing spaces after a std::string.
Because the full-blown type is a template, sometimes the compiler adds a spurious
additional space behind the closing angle bracket, due to the now obsolete
"maximum munch rule" of C++98 -- to prevent closing angle brackets to become '>>'.
But in other cases, some type adornments or other language identifiers follow the
string type, like e.g. 'const'. In those cases, the trailing space must be retained.

We solve this by a look-ahead assertion in the regular expression:
consume the trailing space _only_ if a non-word character follows (like '>').
This commit is contained in:
Fischlurch 2018-09-08 16:33:21 +02:00
parent 433543a2c7
commit 99e3eeca9f

View file

@ -205,7 +205,7 @@ apologies for that."
"|lumiera::"
, regex::ECMAScript | regex::optimize};
static regex stdString {"(__cxx11::)?basic_string<char, char_traits<char>, allocator<char>\\s*>\\s*"
static regex stdString {"(__cxx11::)?basic_string<char, char_traits<char>, allocator<char>\\s*>(\\s+\\B)?"
, regex::ECMAScript | regex::optimize};
static regex stdAllocator {"(\\w+<(" TYP_EXP ")), allocator<\\2>\\s*"