summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-24 14:06:08 -0400
committerTavian Barnes <tavianator@gmail.com>2010-03-24 14:06:08 -0400
commit2c7ecf9d50d11f66b41605b3347c9b4d932853c1 (patch)
tree7b0cdd4c3bc1908b29b504ec935fa225a4c7c66d
parentfb32b2955d735a98cae976b30e079386647703d5 (diff)
downloaddimension-2c7ecf9d50d11f66b41605b3347c9b4d932853c1.tar.xz
Fix parsing of #include files containing #if.
-rw-r--r--dimension/tokenize.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/dimension/tokenize.c b/dimension/tokenize.c
index 6a811bf..f20f394 100644
--- a/dimension/tokenize.c
+++ b/dimension/tokenize.c
@@ -789,27 +789,27 @@ dmnsn_yylex_wrapper(dmnsn_parse_item *lvalp, dmnsn_parse_location *llocp,
{
dmnsn_token_buffer *tbuffer = dmnsn_yyget_extra(yyscanner);
- if (tbuffer && tbuffer->type != DMNSN_T_INCLUDE) {
- while (tbuffer && tbuffer->i >= dmnsn_array_size(tbuffer->buffered)) {
- if (tbuffer->type == DMNSN_T_WHILE) {
- tbuffer->i = 0;
- } else {
- if (dmnsn_array_size(tbuffer->buffered) == 0
- && tbuffer->prev && tbuffer->prev->type == DMNSN_T_WHILE)
- {
- dmnsn_yyset_extra(tbuffer->prev, yyscanner);
- dmnsn_delete_token_buffer(tbuffer);
- tbuffer = dmnsn_yyget_extra(yyscanner);
- }
-
+ while (tbuffer && tbuffer->type != DMNSN_T_INCLUDE
+ && tbuffer->i >= dmnsn_array_size(tbuffer->buffered))
+ {
+ if (tbuffer->type == DMNSN_T_WHILE) {
+ tbuffer->i = 0;
+ } else {
+ if (dmnsn_array_size(tbuffer->buffered) == 0
+ && tbuffer->prev && tbuffer->prev->type == DMNSN_T_WHILE)
+ {
dmnsn_yyset_extra(tbuffer->prev, yyscanner);
- if (tbuffer->type == DMNSN_T_MACRO) {
- dmnsn_pop_scope(symtable);
- } else {
- dmnsn_delete_token_buffer(tbuffer);
- }
+ dmnsn_delete_token_buffer(tbuffer);
tbuffer = dmnsn_yyget_extra(yyscanner);
}
+
+ dmnsn_yyset_extra(tbuffer->prev, yyscanner);
+ if (tbuffer->type == DMNSN_T_MACRO) {
+ dmnsn_pop_scope(symtable);
+ } else {
+ dmnsn_delete_token_buffer(tbuffer);
+ }
+ tbuffer = dmnsn_yyget_extra(yyscanner);
}
}