Skip to content

Commit

Permalink
[Parser] Prints error when a pair start is missing its pair end
Browse files Browse the repository at this point in the history
  • Loading branch information
dmed256 committed Jan 31, 2019
1 parent 7517881 commit 44d6900
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lang/tokenContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ namespace occa {
// Store pairs
pairs[pairIndex] = i;
}
// Make sure all pair openers have a close
if (pairStack.size()) {
const int pairIndex = pairStack.back();
pairStack.pop_back();
pairOperator_t &pairStartOp =
*((pairOperator_t*) tokens[pairIndex]->to<operatorToken>().op);

std::stringstream ss;
ss << "Could not find a closing '"
<< pairStartOp.pairStr
<< '\'';
tokens[pairIndex]->printError(ss.str());
hasError = true;
}
}

void tokenContext::findSemicolons() {
Expand Down

0 comments on commit 44d6900

Please sign in to comment.