case PP_IF:
push_state();
expr_token = null;
if (isParentActive()) {
FeatureExpr localFeatureExpr = parse_featureExpr();
state.putLocalFeature(localFeatureExpr, macros);
tok = expr_token(true); /* unget */
if (tok.getType() != NL)
source_skipline(isParentActive());
} else {
state.putLocalFeature(FeatureExprLib.False(), macros);
source_skipline(false);
}
return ifdefPrinter.startIf(tok, isParentActive(), state);
// break;
case PP_ELIF:
if (state.sawElse()) {
error(tok, "#elif after #" + "else");
return source_skipline(false);
} else {
expr_token = null;
// parse with parents state to allow macro expansion
State oldState = state;
state = state.parent;
FeatureExpr localFeaturExpr = isActive() ? parse_featureExpr() : FeatureExprLib.False();
state = oldState;
state.processElIf();
state.putLocalFeature(localFeaturExpr, macros);
tok = expr_token(true); /* unget */
if (tok.getType() != NL)
source_skipline(isParentActive());
return ifdefPrinter.startElIf(tok, isParentActive(),
state);
}
// break;
case PP_ELSE:
if (state.sawElse()) {
error(tok, "#" + "else after #" + "else");
return source_skipline(false);
} else {
state.setSawElse();
source_skipline(warnings.contains(Warning.ENDIF_LABELS));
return ifdefPrinter.startElIf(tok, isParentActive(),
state);
}
// break;
case PP_IFDEF:
push_state();
tok = source_token_nonwhite();
// System.out.println("ifdef " + tok);
if (tok.getType() != IDENTIFIER) {
error(tok, "Expected identifier, not " + tok.getText());
return source_skipline(false);
} else {
FeatureExpr localFeatureExpr2 = parse_ifdefExpr(tok
.getText());
state.putLocalFeature(
isParentActive() ? localFeatureExpr2
: FeatureExprLib.False(), macros);
// return
if (tok.getType() != NL)
source_skipline(isParentActive());
return ifdefPrinter.startIf(tok, isParentActive(),
state);
}
// break;
case PP_IFNDEF:
push_state();
tok = source_token_nonwhite();
if (tok.getType() != IDENTIFIER) {
error(tok, "Expected identifier, not " + tok.getText());
return source_skipline(false);
} else {
FeatureExpr localFeatureExpr3 = parse_ifndefExpr(tok
.getText());
state.putLocalFeature(
isParentActive() ? localFeatureExpr3
: FeatureExprLib.False(), macros);
if (tok.getType() != NL)