parser: Decrement ifx_depth in parse_skip_to_endif()
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -58,7 +58,7 @@ static const char *toktab[] = {
|
||||
[TT_DEFINE] = qtok("#define"),
|
||||
[TT_IFDEF] = qtok("#ifdef"),
|
||||
[TT_IFNDEF] = qtok("#ifndef"),
|
||||
[TT_ENDIF] = qtok("#endif")
|
||||
[TT_ENDIF] = qtok("#endif")
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -174,13 +174,16 @@ parse_skip_to_endif(struct rifle_state *state, struct token *tok)
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (tok->type != TT_ENDIF) {
|
||||
if (parse_scan(state, tok) < 0) {
|
||||
ueof(state);
|
||||
return -1;
|
||||
while (parse_scan(state, tok) == 0) {
|
||||
if (tok->type == TT_ENDIF) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tok->type == TT_ENDIF) {
|
||||
--state->ifx_depth;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user