diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 69a451e..893e657 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,7 @@ "${workspaceFolder}\\build\\build.exe" ], "options": { - "cwd": "${fileDirname}" + "cwd": "${workspaceFolder}\\build\\" }, "problemMatcher": [ "$gcc" diff --git a/src/calculator.cpp b/src/calculator.cpp index c7cda3c..cc435d8 100644 --- a/src/calculator.cpp +++ b/src/calculator.cpp @@ -145,12 +145,11 @@ void correctNegativeSign(parseResult* _input) { for (auto it = parsed->begin(); it != parsed->end(); it++) { auto jt = it + 1; //next element if (it->type == SymbolType::subract && jt != parsed->end() && jt->type == SymbolType::number) { - it = parsed->erase(it); - it->value = it->value * (-1); + it->type = SymbolType::add; + jt->value = jt->value * (-1); continue; } } - parsed->shrink_to_fit(); } /** @@ -162,6 +161,8 @@ void correctNegativeSign(parseResult* _input) { */ bool validateParsation(const std::vector* _input) { return true; + + // FIXME: It's broken somewhere if (_input->size() == 0) return false; for (auto it = _input->begin(); true /* Break argument 2 lines down */; it++) { auto jt = it + 1; @@ -311,11 +312,8 @@ Symbol calculateUsingStack(std::vector& _stack) { return toPut; } break; case SymbolType::subract: { - Stack::take(_stack); //top symbol... - Symbol toPut; - toPut.value = calculateUsingStack(_stack).value - calculateUsingStack(_stack).value; - Stack::put(_stack, toPut); - return toPut; + //subtract is unnecessary because it's already converted to addition in previous step. + throw "impossible"; } break; case SymbolType::multiply: { Stack::take(_stack); //top symbol... diff --git a/src/main.cpp b/src/main.cpp index 19be4e4..ca17c19 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,7 +139,7 @@ int main() { terminal::key_right(keys); break; default: - debugKey(input, debugOffset); + // debugKey(input, debugOffset); break; } continue; @@ -176,7 +176,7 @@ int main() { exit |= commands::loop(); break; default: - debugKey(input, debugOffset); + // debugKey(input, debugOffset); break; }; } diff --git a/zadanie.txt b/zadanie.txt index 15b585a..7004a2f 100644 --- a/zadanie.txt +++ b/zadanie.txt @@ -28,6 +28,7 @@ Poziom dokumentacji: 3 stopniowa (wymagania, instrukcja z zrzutami ekranu, kod p Format instrukcji: A4 Format zapisu instrukcji: PDF Format pliku do upload'u: ZIP (bez hasła) +Nazwa pliku zip: R1IS_Prog.CPP_projekt_.zip Czcionka kodu programu: KONSOLOWA Wymagana wersja źródłowa kodu: TAK Wymagana wersja wykonywalna kodu: TAK