added "jalr" command

This commit is contained in:
black
2025-07-08 20:31:11 +02:00
parent 4fdaf3dafa
commit bc77fae7ee
6 changed files with 77 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ ProgramLoader *ProgramLoader::getInstance() {
}
[[nodiscard]] std::vector<std::string> ProgramLoader::parseLine(const std::string &input) {
if (input.empty()) return std::vector<std::string>{};
std::vector<std::string> output{};
/// Konvertiere den Input String in einen IStringStream, damit dieser bei Leerzeichen gesplittet werden kann
std::istringstream iss(input);
@@ -40,6 +41,7 @@ void ProgramLoader::indexFile(std::ifstream &m_programFile) {
/// Parse Zeile für Zeile
while (std::getline(m_programFile, line)) {
auto lineVector = parseLine(line);
if (lineVector.empty()) continue;
/// Sobald ein Label gefunden wurde, speichere die Position des Streams
if (const auto first = lineVector.begin(); first->at(first->length() - 1) == ':') {
m_labels[first->substr(0, first->length() - 1)] = m_programFile.tellg();