/
xverizex
/
ximas
Обзор
Документация
Войти
/
xverizex
/
ximas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/Error.cpp
52 строки
1 KB
Dmitry
init
14 июл 2026, 01:11
14 июл 2026, 01:11
67983e5
Код
Авторство
О чём код?
#include <sstream> #include <string> #include <iostream> #include "Error.h" #include "Token.h" void setErrorDeep (std::vector<Token *> &token, size_t startIndex, size_t indx, ximas::PosError posError, std::vector<std::string> &error) { std::stringstream str; str << "Error: missing brackets" << std::endl; str << token[startIndex]->line () << ": "; size_t lenLine = token[startIndex]->buf ().size (); lenLine += 3; size_t szToken = token.size (); size_t curPos = 0; bool isSet = false; size_t startEquation = startIndex + 2; while ((startIndex < szToken) && (token[startIndex]->type () != ximas::TokenType::END)) { str << token[startIndex]->buf () << " "; if ((posError == ximas::PosError::END) && (startIndex == indx)) { curPos = lenLine; } else if ((posError == ximas::PosError::START) && (startIndex == startEquation)) { curPos = lenLine; } lenLine += token[startIndex]->buf ().size () + 1; startIndex++; } str << std::endl; if (curPos == 0) { if ((posError == ximas::PosError::END) && (startIndex == indx)) { curPos = lenLine; } else if ((posError == ximas::PosError::START) && (startIndex == startEquation)) { curPos = lenLine; } } std::string bufPointer; bufPointer.resize (lenLine, ' '); curPos--; bufPointer[curPos] = '^'; str << bufPointer << std::endl; error.push_back (str.str ()); }