code fixes

fix negative signs
disable debug info
add requirement in zadanie.txt
This commit is contained in:
Wroclaw 2022-05-25 11:08:55 +02:00
parent 1edb0fa0ec
commit 2a83456d27
4 changed files with 10 additions and 11 deletions

2
.vscode/tasks.json vendored
View file

@ -12,7 +12,7 @@
"${workspaceFolder}\\build\\build.exe" "${workspaceFolder}\\build\\build.exe"
], ],
"options": { "options": {
"cwd": "${fileDirname}" "cwd": "${workspaceFolder}\\build\\"
}, },
"problemMatcher": [ "problemMatcher": [
"$gcc" "$gcc"

View file

@ -145,12 +145,11 @@ void correctNegativeSign(parseResult* _input) {
for (auto it = parsed->begin(); it != parsed->end(); it++) { for (auto it = parsed->begin(); it != parsed->end(); it++) {
auto jt = it + 1; //next element auto jt = it + 1; //next element
if (it->type == SymbolType::subract && jt != parsed->end() && jt->type == SymbolType::number) { if (it->type == SymbolType::subract && jt != parsed->end() && jt->type == SymbolType::number) {
it = parsed->erase(it); it->type = SymbolType::add;
it->value = it->value * (-1); jt->value = jt->value * (-1);
continue; continue;
} }
} }
parsed->shrink_to_fit();
} }
/** /**
@ -162,6 +161,8 @@ void correctNegativeSign(parseResult* _input) {
*/ */
bool validateParsation(const std::vector<Symbol>* _input) { bool validateParsation(const std::vector<Symbol>* _input) {
return true; return true;
// FIXME: It's broken somewhere
if (_input->size() == 0) return false; if (_input->size() == 0) return false;
for (auto it = _input->begin(); true /* Break argument 2 lines down */; it++) { for (auto it = _input->begin(); true /* Break argument 2 lines down */; it++) {
auto jt = it + 1; auto jt = it + 1;
@ -311,11 +312,8 @@ Symbol calculateUsingStack(std::vector<Symbol>& _stack) {
return toPut; return toPut;
} break; } break;
case SymbolType::subract: { case SymbolType::subract: {
Stack::take<Symbol>(_stack); //top symbol... //subtract is unnecessary because it's already converted to addition in previous step.
Symbol toPut; throw "impossible";
toPut.value = calculateUsingStack(_stack).value - calculateUsingStack(_stack).value;
Stack::put<Symbol>(_stack, toPut);
return toPut;
} break; } break;
case SymbolType::multiply: { case SymbolType::multiply: {
Stack::take<Symbol>(_stack); //top symbol... Stack::take<Symbol>(_stack); //top symbol...

View file

@ -139,7 +139,7 @@ int main() {
terminal::key_right(keys); terminal::key_right(keys);
break; break;
default: default:
debugKey(input, debugOffset); // debugKey(input, debugOffset);
break; break;
} }
continue; continue;
@ -176,7 +176,7 @@ int main() {
exit |= commands::loop(); exit |= commands::loop();
break; break;
default: default:
debugKey(input, debugOffset); // debugKey(input, debugOffset);
break; break;
}; };
} }

View file

@ -28,6 +28,7 @@ Poziom dokumentacji: 3 stopniowa (wymagania, instrukcja z zrzutami ekranu, kod p
Format instrukcji: A4 Format instrukcji: A4
Format zapisu instrukcji: PDF Format zapisu instrukcji: PDF
Format pliku do upload'u: ZIP (bez hasła) Format pliku do upload'u: ZIP (bez hasła)
Nazwa pliku zip: R1IS_Prog.CPP_projekt_<nazwisko><imie>.zip
Czcionka kodu programu: KONSOLOWA Czcionka kodu programu: KONSOLOWA
Wymagana wersja źródłowa kodu: TAK Wymagana wersja źródłowa kodu: TAK
Wymagana wersja wykonywalna kodu: TAK Wymagana wersja wykonywalna kodu: TAK