Nesting in else clauses is sometimes parsed incorrectly
Closed this issue · 1 comments
mayshukla commented
The following is parsed incorrectly:
int main() {
int i = 0;
#ifdef A
i++;
#else
#ifdef B
i--;
#endif
i--;
#endif
}
It's parsed as:
int main() {
int i = 0;
#ifdef A {
i++;
} #else {
i--;
i--;
}
#endif
}
// In context: True
Note that #ifdef B
surrounding the first i--;
was ignored. This problem only occurs when #ifdef B
is the first statement in the else clause. Also, it is parsed correctly when it is in the then clause.
mayshukla commented
Update: I fixed this issue. Now when the parser encounters a split token at the beginning of a variant statement, it checks to see if it should split there (instead of t just skipping the split token).