Split RGBASM parser action functions into their own file

This commit is contained in:
Rangi42
2025-07-26 15:35:48 -04:00
parent 3bc8b1ff7c
commit f3cbfcecf4
7 changed files with 559 additions and 523 deletions

42
include/asm/actions.hpp Normal file
View File

@@ -0,0 +1,42 @@
// SPDX-License-Identifier: MIT
#ifndef RGBDS_ASM_ACTIONS_HPP
#define RGBDS_ASM_ACTIONS_HPP
#include <optional>
#include <stdint.h>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include "asm/output.hpp" // AssertionType
#include "asm/rpn.hpp" // RPNCommand
std::optional<std::string> act_ReadFile(std::string const &name, uint32_t maxLen);
uint32_t act_StringToNum(std::vector<int32_t> const &str);
size_t act_StringLen(std::string const &str, bool printErrors);
std::string act_StringSlice(std::string const &str, uint32_t start, uint32_t stop);
std::string act_StringSub(std::string const &str, uint32_t pos, uint32_t len);
size_t act_CharLen(std::string const &str);
std::string act_StringChar(std::string const &str, uint32_t idx);
std::string act_CharSub(std::string const &str, uint32_t pos);
int32_t act_CharCmp(std::string_view str1, std::string_view str2);
uint32_t act_AdjustNegativeIndex(int32_t idx, size_t len, char const *functionName);
uint32_t act_AdjustNegativePos(int32_t pos, size_t len, char const *functionName);
std::string act_StringReplace(std::string_view str, std::string const &old, std::string const &rep);
std::string act_StringFormat(
std::string const &spec, std::vector<std::variant<uint32_t, std::string>> const &args
);
void act_CompoundAssignment(std::string const &symName, RPNCommand op, int32_t constValue);
void act_FailAssert(AssertionType type);
void act_FailAssertMsg(AssertionType type, std::string const &message);
#endif // RGBDS_ASM_ACTIONS_HPP

View File

@@ -84,9 +84,9 @@ void sect_EndUnion();
void sect_CheckUnionClosed();
void sect_ConstByte(uint8_t byte);
void sect_ByteString(std::vector<int32_t> const &string);
void sect_WordString(std::vector<int32_t> const &string);
void sect_LongString(std::vector<int32_t> const &string);
void sect_ByteString(std::vector<int32_t> const &str);
void sect_WordString(std::vector<int32_t> const &str);
void sect_LongString(std::vector<int32_t> const &str);
void sect_Skip(uint32_t skip, bool ds);
void sect_RelByte(Expression const &expr, uint32_t pcShift);
void sect_RelBytes(uint32_t n, std::vector<Expression> const &exprs);