From b900f8442032313cc8c4453b13927780675fd3fa Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 18 Jul 2013 17:18:06 -0400 Subject: [PATCH] Implement Tokenizer_handle_tag_open_close() --- mwparserfromhell/parser/tokenizer.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mwparserfromhell/parser/tokenizer.c b/mwparserfromhell/parser/tokenizer.c index b6842b0..cb2ecc1 100644 --- a/mwparserfromhell/parser/tokenizer.c +++ b/mwparserfromhell/parser/tokenizer.c @@ -1237,8 +1237,10 @@ Tokenizer_really_parse_tag(Tokenizer* self) Py_UNICODE this, next; int can_exit; - if (!data) + if (!data) { + PyErr_NoMemory(); return NULL; + } data->pad_first = Textbuffer_new(); data->pad_before_eq = Textbuffer_new(); data->pad_after_eq = Textbuffer_new(); @@ -1605,6 +1607,19 @@ Tokenizer_handle_tag_close_open(Tokenizer* self, TagOpenData* data, static int Tokenizer_handle_tag_open_close(Tokenizer* self) { + PyObject* token; + + token = PyObject_CallObject(TagOpenClose, NULL); + if (!token) + return -1; + if (Tokenizer_emit(self, token)) { + Py_DECREF(token); + return -1; + } + Py_DECREF(token); + if (Tokenizer_push(self, LC_TAG_CLOSE)) + return -1; + self->head++; return 0; }