Rename print to printChar

This clarifies its usage, for printing a single character
in error messages.
This commit is contained in:
Rangi
2021-04-09 14:24:25 -04:00
committed by Eldred Habert
parent ab79e6bede
commit a2f52867ad
3 changed files with 7 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
#include <stdint.h> #include <stdint.h>
uint32_t calchash(const char *s); uint32_t calchash(const char *s);
char const *print(int c); char const *printChar(int c);
/* /*
* @return The number of bytes read, or 0 if invalid data was found * @return The number of bytes read, or 0 if invalid data was found
*/ */

View File

@@ -1173,7 +1173,7 @@ static void readLineContinuation(void)
discardComment(); discardComment();
} else { } else {
error("Begun line continuation, but encountered character %s\n", error("Begun line continuation, but encountered character %s\n",
print(c)); printChar(c));
return; return;
} }
} }
@@ -1631,7 +1631,7 @@ static void readString(void)
break; break;
default: default:
error("Illegal character escape %s\n", print(c)); error("Illegal character escape %s\n", printChar(c));
shiftChars(1); shiftChars(1);
break; break;
} }
@@ -1781,7 +1781,7 @@ static size_t appendStringLiteral(size_t i)
break; break;
default: default:
error("Illegal character escape %s\n", print(c)); error("Illegal character escape %s\n", printChar(c));
shiftChars(1); shiftChars(1);
break; break;
} }
@@ -2069,7 +2069,7 @@ static int yylex_NORMAL(void)
/* Do not report weird characters when capturing, it'll be done later */ /* Do not report weird characters when capturing, it'll be done later */
if (!lexerState->capturing) { if (!lexerState->capturing) {
/* TODO: try to group reportings */ /* TODO: try to group reportings */
error("Unknown character %s\n", print(c)); error("Unknown character %s\n", printChar(c));
} }
} }
lexerState->atLineStart = false; lexerState->atLineStart = false;
@@ -2157,7 +2157,7 @@ static int yylex_RAW(void)
*/ */
default: default:
error("Illegal character escape %s\n", print(c)); error("Illegal character escape %s\n", printChar(c));
break; break;
} }
/* fallthrough */ /* fallthrough */

View File

@@ -30,7 +30,7 @@ uint32_t calchash(const char *s)
return hash; return hash;
} }
char const *print(int c) char const *printChar(int c)
{ {
// "'A'" + '\0': 4 bytes // "'A'" + '\0': 4 bytes
// "'\\n'" + '\0': 5 bytes // "'\\n'" + '\0': 5 bytes