@@ -3188,10 +3188,10 @@ static void linkBrackets(const Tokenizer * const tokenizer, std::stack<const Tok
31883188 } else if (token->str ()[0 ] == close) {
31893189 if (links.empty ()) {
31903190 // Error, { and } don't match.
3191- tokenizer->syntaxError (token, open );
3191+ tokenizer->unmatchedToken (token);
31923192 }
31933193 if (type.top ()->str ()[0 ] != open) {
3194- tokenizer->syntaxError (type.top (), type. top ()-> str ()[ 0 ] );
3194+ tokenizer->unmatchedToken (type.top ());
31953195 }
31963196 type.pop ();
31973197
@@ -3220,17 +3220,17 @@ void Tokenizer::createLinks()
32203220
32213221 if (!links1.empty ()) {
32223222 // Error, { and } don't match.
3223- syntaxError (links1.top (), ' { ' );
3223+ unmatchedToken (links1.top ());
32243224 }
32253225
32263226 if (!links2.empty ()) {
32273227 // Error, ( and ) don't match.
3228- syntaxError (links2.top (), ' ( ' );
3228+ unmatchedToken (links2.top ());
32293229 }
32303230
32313231 if (!links3.empty ()) {
32323232 // Error, [ and ] don't match.
3233- syntaxError (links3.top (), ' [ ' );
3233+ unmatchedToken (links3.top ());
32343234 }
32353235}
32363236
@@ -7930,17 +7930,12 @@ void Tokenizer::syntaxError(const Token *tok) const
79307930 throw InternalError (tok, " syntax error" , InternalError::SYNTAX);
79317931}
79327932
7933- void Tokenizer::syntaxError (const Token *tok, char c ) const
7933+ void Tokenizer::unmatchedToken (const Token *tok) const
79347934{
79357935 printDebugOutput (0 );
7936- if (mConfiguration .empty ())
7937- throw InternalError (tok,
7938- std::string (" Invalid number of character '" ) + c + " ' when no macros are defined." ,
7939- InternalError::SYNTAX);
7940- else
7941- throw InternalError (tok,
7942- std::string (" Invalid number of character '" ) + c + " ' when these macros are defined: '" + mConfiguration + " '." ,
7943- InternalError::SYNTAX);
7936+ throw InternalError (tok,
7937+ " Unmatched '" + tok->str () + " '. Configuration: '" + mConfiguration + " '." ,
7938+ InternalError::SYNTAX);
79447939}
79457940
79467941void Tokenizer::syntaxErrorC (const Token *tok, const std::string &what) const
0 commit comments