Skip to content

Commit

Permalink
CXX: More complete support for $ in C/C++ identifiers
Browse files Browse the repository at this point in the history
Merge pull request #1971 from pskocik/master
More complete support for $ in C/C++ identifiers
  • Loading branch information
pragmaware committed Jan 11, 2019
2 parents b60a7b9 + 8228c5f commit a20bb99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions parsers/cpreprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,15 +1565,15 @@ static void saveMacro(const char * macro)
return;
}

if(!(isalpha(*c) || (*c == '_')))
if(!(isalpha(*c) || (*c == '_' || (*c == '$') )))
{
CXX_DEBUG_LEAVE_TEXT("Macro does not start with an alphanumeric character");
return; // must be a sequence of letters and digits
}

const char * identifierBegin = c;

while(*c && (isalnum(*c) || (*c == '_')))
while(*c && (isalnum(*c) || (*c == '_') || (*c == '$') ))
c++;

const char * identifierEnd = c;
Expand Down
2 changes: 1 addition & 1 deletion parsers/cxx/cxx_parser_tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static CXXCharTypeData g_aCharTable[128] =
},
// 036 (0x24) '$'
{
0,
CXXCharTypeStartOfIdentifier | CXXCharTypePartOfIdentifier,
0,
0
},
Expand Down

1 comment on commit a20bb99

@masatake
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add a test case for this change.

Please sign in to comment.