Browse Source

Process contexts in Tokenizer_handle_template_param() correctly.

tags/v0.2
Ben Kurtovic 12 years ago
parent
commit
1bfd364a4a
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      mwparserfromhell/parser/tokenizer.c

+ 7
- 4
mwparserfromhell/parser/tokenizer.c View File

@@ -680,11 +680,13 @@ Tokenizer_handle_template_param(Tokenizer* self)
if (Tokenizer_verify_safe(self, unsafes)) if (Tokenizer_verify_safe(self, unsafes))
return -1; return -1;
if (BAD_ROUTE) return -1; if (BAD_ROUTE) return -1;
if (Tokenizer_set_context(self, context ^ LC_TEMPLATE_NAME))
context ^= LC_TEMPLATE_NAME;
if (Tokenizer_set_context(self, context))
return -1; return -1;
} }
else if (context & LC_TEMPLATE_PARAM_VALUE) { else if (context & LC_TEMPLATE_PARAM_VALUE) {
if (Tokenizer_set_context(self, context ^ LC_TEMPLATE_PARAM_VALUE))
context ^= LC_TEMPLATE_PARAM_VALUE;
if (Tokenizer_set_context(self, context))
return -1; return -1;
} }


@@ -698,7 +700,8 @@ Tokenizer_handle_template_param(Tokenizer* self)
Py_DECREF(stack); Py_DECREF(stack);
} }
else { else {
if (Tokenizer_set_context(self, context | LC_TEMPLATE_PARAM_KEY))
context |= LC_TEMPLATE_PARAM_KEY;
if (Tokenizer_set_context(self, context))
return -1; return -1;
} }


@@ -714,7 +717,7 @@ Tokenizer_handle_template_param(Tokenizer* self)
} }
Py_DECREF(token); Py_DECREF(token);


Tokenizer_push(self, Tokenizer_CONTEXT_VAL(self));
Tokenizer_push(self, context);
return 0; return 0;
} }




Loading…
Cancel
Save