Procházet zdrojové kódy

Fix another couple bugs regarding template contexts and verify_safe().

tags/v0.2
Ben Kurtovic před 12 roky
rodič
revize
4a725b7ac5
2 změnil soubory, kde provedl 16 přidání a 3 odebrání
  1. +15
    -3
      mwparserfromhell/parser/tokenizer.c
  2. +1
    -0
      mwparserfromhell/parser/tokenizer.h

+ 15
- 3
mwparserfromhell/parser/tokenizer.c Zobrazit soubor

@@ -1153,18 +1153,30 @@ Tokenizer_verify_safe(Tokenizer* self, int context, Py_UNICODE data)
self->topstack->context |= LC_FAIL_NEXT;
return;
}
if (data == *"|") {
if (context & LC_FAIL_ON_TEXT) {
self->topstack->context ^= LC_FAIL_ON_TEXT;
return;
}
}
}
else if (context & (LC_TEMPLATE_PARAM_KEY | LC_ARGUMENT_NAME)) {
if (context & LC_FAIL_ON_LBRACE) {
if (data == *"{") {
if (context & LC_FAIL_ON_EQUALS) {
if (data == *"=") {
self->topstack->context |= LC_FAIL_NEXT;
return;
}
}
else if (context & LC_FAIL_ON_LBRACE) {
if (data == *"{") {
self->topstack->context |= (context & LC_TEMPLATE) ? LC_FAIL_ON_EQUALS : LC_FAIL_NEXT;
return;
}
self->topstack->context ^= LC_FAIL_ON_LBRACE;
}
else if (context & LC_FAIL_ON_RBRACE) {
if (data == *"}") {
self->topstack->context |= LC_FAIL_NEXT;
self->topstack->context |= (context & LC_TEMPLATE) ? LC_FAIL_ON_EQUALS : LC_FAIL_NEXT;
return;
}
self->topstack->context ^= LC_FAIL_ON_RBRACE;


+ 1
- 0
mwparserfromhell/parser/tokenizer.h Zobrazit soubor

@@ -119,6 +119,7 @@ static PyObject* TagCloseClose;
#define LC_FAIL_NEXT 0x10000
#define LC_FAIL_ON_LBRACE 0x20000
#define LC_FAIL_ON_RBRACE 0x40000
#define LC_FAIL_ON_EQUALS 0x80000

/* Global contexts: */



Načítá se…
Zrušit
Uložit