From ec86e13f144d4d8de6a93b8b04117ea5028893d1 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Wed, 15 Apr 2015 20:01:17 -0300 Subject: added template grammar --- src/template-grammar.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/template-grammar.h (limited to 'src/template-grammar.h') diff --git a/src/template-grammar.h b/src/template-grammar.h new file mode 100644 index 0000000..e95fa46 --- /dev/null +++ b/src/template-grammar.h @@ -0,0 +1,32 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2015 Rafael G. Martins + * + * This program can be distributed under the terms of the LGPL-2 License. + * See the file COPYING. + */ + +#ifndef _TEMPLATE_GRAMMAR_H +#define _TEMPLATE_GRAMMAR_H + +#include "utils/utils.h" + +typedef enum { + BLOGC_TEMPLATE_IF_STMT, + BLOGC_TEMPLATE_ELSE_STMT, + 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 *tmpl); +void blogc_template_free_stmts(b_slist_t *stmts); + +#endif /* _TEMPLATE_GRAMMAR_H */ -- cgit v1.2.3-18-g5258