From 2b446728736257b91a8752287efaff08f9ba81e8 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 25 Mar 2024 14:10:12 -0400 Subject: [PATCH] Rename a few variables --- include/asm/lexer.hpp | 2 +- src/asm/lexer.cpp | 9 ++++----- src/gfx/main.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/asm/lexer.hpp b/include/asm/lexer.hpp index f97a8135..8e1ff5b4 100644 --- a/include/asm/lexer.hpp +++ b/include/asm/lexer.hpp @@ -97,7 +97,7 @@ struct LexerState { void setAsCurrentState(); bool setFileAsNextState(std::string const &filePath, bool updateStateNow); - void setViewAsNextState(char const *filePath, char const *buf, size_t size, uint32_t lineNo_); + void setViewAsNextState(char const *name, char const *buf, size_t size, uint32_t lineNo_); void clear(uint32_t lineNo_); }; diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index cf2437f3..cfae5604 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -450,9 +450,9 @@ bool LexerState::setFileAsNextState(std::string const &filePath, bool updateStat } void LexerState::setViewAsNextState( - char const *filePath, char const *buf, size_t size, uint32_t lineNo_ + char const *name, char const *buf, size_t size, uint32_t lineNo_ ) { - path = filePath; // Used to report read errors in `peekInternal` + path = name; // Used to report read errors in `peekInternal` content = ViewedLexerState{.ptr = buf, .size = size, .offset = 0}; clear(lineNo_); lexerStateEOL = this; @@ -1498,9 +1498,8 @@ static void appendStringLiteral(std::string &yylval, bool raw) { // We'll be exiting the string scope, so re-enable expansions // (Not interpolations, since they're handled by the function itself...) lexerState->disableMacroArgs = false; - auto str = readInterpolation(0); - if (str) { - appendEscapedSubstring(yylval, *str); + if (auto interpolation = readInterpolation(0); interpolation) { + appendEscapedSubstring(yylval, *interpolation); } lexerState->disableMacroArgs = true; continue; // Do not copy an additional character diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 64c2f377..60f8e5b6 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -776,7 +776,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "\tTrim the last %" PRIu64 " tiles\n", options.trim); fprintf(stderr, "\tMaximum %" PRIu8 " palettes\n", options.nbPalettes); fprintf(stderr, "\tPalettes contain %" PRIu8 " colors\n", options.nbColorsPerPal); - fprintf(stderr, "\t%s palette spec\n", []() { + fprintf(stderr, "\t%s palette spec\n", [] { switch (options.palSpecType) { case Options::NO_SPEC: return "No";