indexFile() now saves the stream position not line number
This commit is contained in:
@@ -37,14 +37,12 @@ void ProgramLoader::indexFile(std::ifstream &m_programFile) {
|
||||
m_programFile.clear();
|
||||
m_programFile.seekg(0);
|
||||
std::string line;
|
||||
int lineNumber = 1;
|
||||
/// Parse Zeile für Zeile
|
||||
while (std::getline(m_programFile, line)) {
|
||||
auto lineVector = parseLine(line);
|
||||
/// Sobald ein Label gefunden wurde, speichere die Zeile
|
||||
if (const auto first = lineVector.begin(); first->at(first->length() - 1) == ':') {
|
||||
m_labels[first->substr(0, first->length() - 1)] = lineNumber;
|
||||
m_labels[first->substr(0, first->length() - 1)] = m_programFile.tellg();
|
||||
}
|
||||
lineNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ private:
|
||||
*/
|
||||
explicit ProgramLoader() = default;
|
||||
|
||||
std::map<std::string, int> m_labels;
|
||||
std::map<std::string, std::streampos> m_labels;
|
||||
|
||||
public:
|
||||
/// Singleton Logik
|
||||
|
||||
Reference in New Issue
Block a user