Skip to content

removed printing extra transition arrow #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ Token* Tree::handleAssignment(Token* head) {
}

// Convert infix to postfix
for (Token* token : infixToPostfix(equationAsVec)) {
std::string tokenValue = token->getValue();
//std::cout << "tokenVal = " << tokenValue << std::endl; // debug method *****
std::vector<Token*> postFix = infixToPostfix(equationAsVec);
//std::cout << "Size<: " << postFix.size() << std::endl;
for (int i = 0; i < postFix.size(); i++) {
std::string tokenValue = postFix.at(i)->getValue();
// std::cout << "\ncurr token = " << tokenValue << " next token = " << postFix.at(i+1) << std::endl;

// Print token value directly and mark that a space is needed
if (!tokenValue.empty()) {
std::cout << tokenValue;
std::cout << " ----> ";
if (i != postFix.size() - 1) {
std::cout << " ----> ";
}
}
}

Expand Down