mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Simplify appendCharInLiteral
This commit is contained in:
@@ -1452,14 +1452,11 @@ static void appendExpandedString(std::string &str, std::string const &expanded)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void appendCharInLiteral(std::string &str, int c, bool rawString) {
|
static void appendCharInLiteral(std::string &str, int c) {
|
||||||
bool rawMode = lexerState->mode == LEXER_RAW;
|
bool rawMode = lexerState->mode == LEXER_RAW;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\\': // Character escape or macro arg
|
case '\\': // Character escape or macro arg
|
||||||
if (rawString) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
c = peek();
|
c = peek();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
// Character escape
|
// Character escape
|
||||||
@@ -1545,9 +1542,6 @@ static void appendCharInLiteral(std::string &str, int c, bool rawString) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '{': // Symbol interpolation
|
case '{': // Symbol interpolation
|
||||||
if (rawString) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// We'll be exiting the string scope, so re-enable expansions
|
// We'll be exiting the string scope, so re-enable expansions
|
||||||
// (Not interpolations, since they're handled by the function itself...)
|
// (Not interpolations, since they're handled by the function itself...)
|
||||||
lexerState->disableMacroArgs = false;
|
lexerState->disableMacroArgs = false;
|
||||||
@@ -1637,7 +1631,11 @@ static void readString(std::string &str, bool rawString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Append the character or handle special ones
|
// Append the character or handle special ones
|
||||||
appendCharInLiteral(str, c, rawString);
|
if (rawString) {
|
||||||
|
str += c;
|
||||||
|
} else {
|
||||||
|
appendCharInLiteral(str, c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user