From 30e5e6890682d4759e6dcdfc833a666e0ab3f7a2 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 19 Apr 2015 00:06:56 -0300 Subject: added renderer, without tests --- src/template-parser.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/template-parser.c') diff --git a/src/template-parser.c b/src/template-parser.c index 1038190..d176288 100644 --- a/src/template-parser.c +++ b/src/template-parser.c @@ -53,8 +53,6 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err) size_t start = 0; size_t end = 0; - char *tmp = NULL; - unsigned int if_count = 0; b_slist_t *stmts = NULL; @@ -340,6 +338,15 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err) current++; } + if (*err == NULL) { + if (if_count != 0) + *err = blogc_error_new_printf(BLOGC_ERROR_TEMPLATE_PARSER, + "%d 'if' statements were not closed!", if_count); + else if (block_state != BLOCK_CLOSED) + *err = blogc_error_new(BLOGC_ERROR_TEMPLATE_PARSER, + "A block was not closed!"); + } + if (*err != NULL) { if (stmt != NULL) { free(stmt->value); -- cgit v1.2.3-18-g5258