@@ -96,7 +96,7 @@ void simplecpp::Location::adjust(const std::string &str) {
9696 return ;
9797 }
9898
99- for (unsigned int i = 0U ; i < str.size (); ++i) {
99+ for (std:: size_t i = 0U ; i < str.size (); ++i) {
100100 col++;
101101 if (str[i] == ' \n ' || str[i] == ' \r ' ) {
102102 col = 0 ;
@@ -288,6 +288,10 @@ static unsigned short getAndSkipBOM(std::istream &istr) {
288288 return 0 ;
289289}
290290
291+ bool isNameChar (unsigned char ch) {
292+ return std::isalnum (ch) || ch == ' _' || ch == ' $' ;
293+ }
294+
291295void simplecpp::TokenList::readfile (std::istream &istr, const std::string &filename, OutputList *outputList)
292296{
293297 std::stack<simplecpp::Location> loc;
@@ -344,8 +348,8 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
344348 TokenString currentToken;
345349
346350 // number or name
347- if (std::isalnum (ch) || ch == ' _ ' ) {
348- while (istr.good () && ( std::isalnum (ch) || ch == ' _ ' )) {
351+ if (isNameChar (ch)) {
352+ while (istr.good () && isNameChar (ch )) {
349353 currentToken += ch;
350354 ch = readChar (istr,bom);
351355 }
@@ -1440,7 +1444,7 @@ bool hasFile(const std::map<std::string, simplecpp::TokenList *> &filedata, cons
14401444}
14411445}
14421446
1443- std::map<std::string, simplecpp::TokenList*> simplecpp::load (const simplecpp::TokenList &rawtokens, std::vector<std::string> &fileNumbers, const struct simplecpp ::DUI &dui, simplecpp::OutputList *outputList)
1447+ std::map<std::string, simplecpp::TokenList*> simplecpp::load (const simplecpp::TokenList &rawtokens, std::vector<std::string> &fileNumbers, const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
14441448{
14451449 std::map<std::string, simplecpp::TokenList*> ret;
14461450
@@ -1487,7 +1491,7 @@ std::map<std::string, simplecpp::TokenList*> simplecpp::load(const simplecpp::To
14871491 return ret;
14881492}
14891493
1490- void simplecpp::preprocess (simplecpp::TokenList &output, const simplecpp::TokenList &rawtokens, std::vector<std::string> &files, const std::map<std::string, simplecpp::TokenList *> &filedata, const struct simplecpp ::DUI &dui, simplecpp::OutputList *outputList, std::list<struct simplecpp ::MacroUsage> *macroUsage)
1494+ void simplecpp::preprocess (simplecpp::TokenList &output, const simplecpp::TokenList &rawtokens, std::vector<std::string> &files, const std::map<std::string, simplecpp::TokenList *> &filedata, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, std::list<simplecpp::MacroUsage> *macroUsage)
14911495{
14921496 std::map<std::string, std::size_t > sizeOfType (rawtokens.sizeOfType );
14931497 sizeOfType.insert (std::pair<std::string, std::size_t >(std::string (" char" ), sizeof (char )));
@@ -1562,7 +1566,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
15621566 err.type = rawtok->str == ERROR ? Output::ERROR : Output::WARNING;
15631567 err.location = rawtok->location ;
15641568 for (const Token *tok = rawtok->next ; tok && sameline (rawtok,tok); tok = tok->next ) {
1565- if (!err.msg .empty () && std::isalnum (( unsigned char ) tok->str [0 ]))
1569+ if (!err.msg .empty () && isNameChar ( tok->str [0 ]))
15661570 err.msg += ' ' ;
15671571 err.msg += tok->str ;
15681572 }
@@ -1765,7 +1769,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
17651769 const Macro ¯o = macroIt->second ;
17661770 const std::list<Location> &usage = macro.usage ();
17671771 for (std::list<Location>::const_iterator usageIt = usage.begin (); usageIt != usage.end (); ++usageIt) {
1768- struct MacroUsage mu (usageIt->files);
1772+ MacroUsage mu (usageIt->files );
17691773 mu.macroName = macro.name ();
17701774 mu.macroLocation = macro.defineLocation ();
17711775 mu.useLocation = *usageIt;
0 commit comments