From bf42a95568f5efffcc87a9b5a7683b7b270a098f Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 17 Apr 2015 23:49:55 -0300 Subject: replaced leg-based parser with handmade parser for templates yay! no leg parser needed anymore. parsers still needs some work and error handling, though. --- src/template-parser.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/template-parser.h (limited to 'src/template-parser.h') diff --git a/src/template-parser.h b/src/template-parser.h new file mode 100644 index 0000000..1f43fe8 --- /dev/null +++ b/src/template-parser.h @@ -0,0 +1,31 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2015 Rafael G. Martins + * + * This program can be distributed under the terms of the BSD License. + * See the file COPYING. + */ + +#ifndef _TEMPLATE_PARSER_H +#define _TEMPLATE_PARSER_H + +#include "utils/utils.h" + +typedef enum { + BLOGC_TEMPLATE_IF_STMT = 1, + BLOGC_TEMPLATE_ENDIF_STMT, + BLOGC_TEMPLATE_BLOCK_STMT, + BLOGC_TEMPLATE_ENDBLOCK_STMT, + BLOGC_TEMPLATE_VARIABLE_STMT, + BLOGC_TEMPLATE_CONTENT_STMT, +} blogc_template_stmt_type_t; + +typedef struct { + blogc_template_stmt_type_t type; + char *value; +} blogc_template_stmt_t; + +b_slist_t* blogc_template_parse(const char *src, size_t src_len); +void blogc_template_free_stmts(b_slist_t *stmts); + +#endif /* _TEMPLATE_GRAMMAR_H */ -- cgit v1.2.3-18-g5258