Skip to content

Commit 161467f

Browse files
committed
remove extra comments in expression
1 parent 9ab77d6 commit 161467f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

simplecpp.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,8 +2683,19 @@ static void simplifyNumbers(simplecpp::TokenList &expr)
26832683
}
26842684
}
26852685

2686+
static void simplifyComments(simplecpp::TokenList &expr)
2687+
{
2688+
for (simplecpp::Token *tok = expr.front(); tok;) {
2689+
simplecpp::Token *d = tok;
2690+
tok = tok->next;
2691+
if (d->comment)
2692+
expr.deleteToken(d);
2693+
}
2694+
}
2695+
26862696
static long long evaluate(simplecpp::TokenList &expr, const std::map<std::string, std::size_t> &sizeOfType)
26872697
{
2698+
simplifyComments(expr);
26882699
simplifySizeof(expr, sizeOfType);
26892700
simplifyName(expr);
26902701
simplifyNumbers(expr);

0 commit comments

Comments
 (0)