Skip to content

ЛР2. Коваленко Артем гр.5093 - #1937

Open
ZeroTangans wants to merge 11 commits into
Dovgalyuk:masterfrom
ZeroTangans:master
Open

ZeroTangans wants to merge 11 commits into
Dovgalyuk:masterfrom
ZeroTangans:master

Conversation

@ZeroTangans

Copy link
Copy Markdown

No description provided.

Comment thread Lab2CPP/RPN.cpp Outdated
@@ -0,0 +1,127 @@
#include "Lab2CPP.h"
#include "../LibraryCPP/stack.h"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пути нужно прописывать с CMakeLists.txt

Comment thread Lab2CPP/Lab2CPP.cpp Outdated

static bool check(const vector<string>& tokens) {
bool token = false;
int bracketCount = 0;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это бесполезно здесь проверять, лучше это делать при разборе выражения.

Comment thread Lab2CPP/Lab2CPP.cpp Outdated
return token && bracketCount == 0;
}

vector<string>* tokens_create_and_read(ifstream& input)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоит сделать typedef.

Comment thread Lab2CPP/Lab2CPP.cpp Outdated
else if (c == ')') {
if (!token) return nullptr;
bracketCount--;
if (bracketCount < 0) return nullptr;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скобки считать бесполезно, а не функцию проверки делать.

Comment thread Lab2CPP/RPN.cpp Outdated
aux.push_back(t);
}
else if (t == "+" || t == "-" || t == "*" || t == "/") {
if (!pri) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В этой ветке смысла нет.

Comment thread Lab2CPP/CMakeLists.txt

add_test(NAME RPN_Test20
COMMAND RPN ${CMAKE_CURRENT_SOURCE_DIR}/Tests/Test2_10.txt)
set_property(TEST RPN_Test20 PROPERTY PASS_REGULAR_EXPRESSION "Invalid expression") No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не все ошибочные ситуации проверяются.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants