Run clang-format on some Bison .y file contents

This commit is contained in:
Rangi42
2025-01-27 19:06:27 -05:00
committed by Rangi
parent 9c8e327ae2
commit 192fc808c8
2 changed files with 15 additions and 15 deletions

View File

@@ -9,14 +9,14 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "either.hpp"
#include "linkdefs.hpp"
#include "asm/lexer.hpp" #include "asm/lexer.hpp"
#include "asm/macro.hpp" #include "asm/macro.hpp"
#include "asm/rpn.hpp" #include "asm/rpn.hpp"
#include "asm/section.hpp" #include "asm/section.hpp"
#include "either.hpp"
#include "linkdefs.hpp"
struct AlignmentSpec { struct AlignmentSpec {
uint8_t alignment; uint8_t alignment;
uint16_t alignOfs; uint16_t alignOfs;
@@ -42,6 +42,7 @@
StrFmtArgList &operator=(StrFmtArgList &&) = default; StrFmtArgList &operator=(StrFmtArgList &&) = default;
}; };
} }
%code { %code {
#include <algorithm> #include <algorithm>
#include <ctype.h> #include <ctype.h>
@@ -51,6 +52,9 @@
#include <string.h> #include <string.h>
#include <string_view> #include <string_view>
#include "extern/utf8decoder.hpp"
#include "helpers.hpp"
#include "asm/charmap.hpp" #include "asm/charmap.hpp"
#include "asm/fixpoint.hpp" #include "asm/fixpoint.hpp"
#include "asm/format.hpp" #include "asm/format.hpp"
@@ -62,10 +66,6 @@
#include "asm/symbol.hpp" #include "asm/symbol.hpp"
#include "asm/warning.hpp" #include "asm/warning.hpp"
#include "extern/utf8decoder.hpp"
#include "helpers.hpp"
using namespace std::literals; using namespace std::literals;
yy::parser::symbol_type yylex(); // Provided by lexer.cpp yy::parser::symbol_type yylex(); // Provided by lexer.cpp
@@ -77,9 +77,7 @@
static size_t charlenUTF8(std::string const &str); static size_t charlenUTF8(std::string const &str);
static std::string charsubUTF8(std::string const &str, uint32_t pos); static std::string charsubUTF8(std::string const &str, uint32_t pos);
static uint32_t adjustNegativePos(int32_t pos, size_t len, char const *functionName); static uint32_t adjustNegativePos(int32_t pos, size_t len, char const *functionName);
static std::string strrpl( static std::string strrpl(std::string_view str, std::string const &old, std::string const &rep);
std::string_view str, std::string const &old, std::string const &rep
);
static std::string strfmt( static std::string strfmt(
std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args
); );
@@ -2650,9 +2648,8 @@ static std::string strrpl(std::string_view str, std::string const &old, std::str
return rpl; return rpl;
} }
static std::string strfmt( static std::string
std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args strfmt(std::string const &spec, std::vector<Either<uint32_t, std::string>> const &args) {
) {
std::string str; std::string str;
size_t argIndex = 0; size_t argIndex = 0;

View File

@@ -12,6 +12,7 @@
void script_ProcessScript(char const *path); void script_ProcessScript(char const *path);
} }
%code { %code {
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@@ -394,7 +395,8 @@ static void setActiveTypeAndIdx(SectionType type, uint32_t idx) {
static void setFloatingSectionType(SectionType type) { static void setFloatingSectionType(SectionType type) {
if (nbbanks(type) == 1) { if (nbbanks(type) == 1) {
setActiveTypeAndIdx(type, 0); // There is only a single bank anyway, so just set the index to 0. // There is only a single bank anyway, so just set the index to 0.
setActiveTypeAndIdx(type, 0);
} else { } else {
activeType = type; activeType = type;
activeBankIdx = UINT32_MAX; activeBankIdx = UINT32_MAX;
@@ -634,7 +636,8 @@ static void placeSection(std::string const &name, bool isOptional) {
typeInfo.name.c_str() typeInfo.name.c_str()
); );
} else { } else {
// SDCC areas don't have a type assigned yet, so the linker script is used to give them one. // SDCC areas don't have a type assigned yet, so the linker script is used to give them
// one.
for (Section *fragment = section; fragment; fragment = fragment->nextu.get()) { for (Section *fragment = section; fragment; fragment = fragment->nextu.get()) {
fragment->type = activeType; fragment->type = activeType;
} }