Skip to content

Commit

Permalink
c-based: Fix adding non-ASCII when collecting a signature
Browse files Browse the repository at this point in the history
`cppGetc()` can return `CHAR_SYMBOL` and `STRING_SYMBOL` which need to
be properly handled when trying to represent as character.
  • Loading branch information
b4n committed May 15, 2023
1 parent 913aefc commit 2cab33c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion parsers/c-based.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,22 @@ static void skipToMatch (const char *const pair)
while (matchLevel > 0 && (c = skipToNonWhite ()) != EOF)
{
if (CollectingSignature)
vStringPut (Signature, c);
{
if (c <= 0xff)
vStringPut (Signature, c);
else
{
switch (c)
{
case CHAR_SYMBOL:
case STRING_SYMBOL:
vStringCat (Signature, cppGetLastCharOrStringContents ());
break;
default:
AssertNotReached();
}
}
}
if (c == begin)
{
++matchLevel;
Expand Down

0 comments on commit 2cab33c

Please sign in to comment.