Skip to content

Commit

Permalink
fixed #12715 - made Visual Studio conditions work again
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed May 15, 2024
1 parent 014fb25 commit fe47d6f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <iostream>
#include <iterator>
#include <sstream>
#include <stack>
#include <unordered_set>
#include <utility>

Expand Down Expand Up @@ -567,6 +568,22 @@ namespace {
TokenList tokenlist(&s);
std::istringstream istr(c);
tokenlist.createTokens(istr, Standards::Language::C); // TODO: check result
// TODO: put in a helper
// generate links
{
std::stack<Token*> lpar;
for (Token* tok2 = tokenlist.front(); tok2; tok2 = tok2->next()) {
if (tok2->str() == "(")
lpar.push(tok2);
else if (tok2->str() == ")") {
if (lpar.empty())
break;
Token::createMutualLinks(lpar.top(), tok2);
lpar.pop();
}
}
}
tokenlist.createAst();
for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) {
if (tok->str() == "(" && tok->astOperand1() && tok->astOperand2()) {
// TODO: this is wrong - it is Contains() not Equals()
Expand Down

0 comments on commit fe47d6f

Please sign in to comment.