diff --git a/c/tex_parser/tex_parser.c b/c/tex_parser/tex_parser.c index cdddc4a..2660f57 100644 --- a/c/tex_parser/tex_parser.c +++ b/c/tex_parser/tex_parser.c @@ -79,7 +79,6 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct, zclear(&tag); where_stack[++tex_level] = IN_TAG; - } else if (isspace(c)) { where_stack[++tex_level] = IN_SPACE; @@ -155,11 +154,16 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct, if (param) printf("IN_TAGPARM: {%s}\n", param); #endif - where_stack[tex_level--] = IN_UNDEF; - /*if (tex_level && where_stack[tex_level - 1] == IN_TAG_BEGIN + if (tex_level && where_stack[tex_level - 1] == IN_TAG_BEGIN && !strcmp(param, TEX_PARAM_TABLE)) - where_stack[tex_level++] = IN_TABLE;*/ + where_stack[tex_level++] = IN_TABLE; + + if (tex_level && where_stack[tex_level - 1] == IN_TAG_END + && !strcmp(param, TEX_PARAM_TABLE)) + where_stack[tex_level--] = IN_UNDEF; + + where_stack[tex_level--] = IN_UNDEF; } else if (c == '\\') { // new tag zclear(&tag); @@ -217,6 +221,13 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct, case IN_FORMULA: + break; + + case IN_TABLE: + *tex_struct = zalloc_append64(*tex_struct, + + + break; default: