merged
This commit is contained in:
commit
73e2146ed5
|
@ -31,30 +31,24 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
||||||
IN_TAG_BEGIN,
|
IN_TAG_BEGIN,
|
||||||
IN_TAG_END,
|
IN_TAG_END,
|
||||||
IN_TAG_TABULARNEWLINE,
|
IN_TAG_TABULARNEWLINE,
|
||||||
IN_TABLE,
|
|
||||||
IN_TABLE_PARAMS, // column properties devided by '>'
|
|
||||||
IN_TABLE_TAG_HLINE,
|
|
||||||
IN_TABLE_TAG_MULTICOLUMN,
|
|
||||||
|
|
||||||
IN_TABLE_COMMENT,
|
|
||||||
IN_TABLE_TAG,
|
|
||||||
IN_TABLE_TAG_UNKNOWN,
|
|
||||||
IN_TABLE_SPACE,
|
|
||||||
IN_TABLE_TAGPARM,
|
|
||||||
IN_TABLE_TAG_CLINE,
|
|
||||||
|
|
||||||
IN_TABLE_TAG_ENDFOOT,
|
|
||||||
IN_TABLE_TAG_ENDHEAD,
|
|
||||||
IN_TABLE_TAG_HSPACE,
|
|
||||||
|
|
||||||
IN_TABLE_TAG_MULTIROW,
|
|
||||||
IN_FORMULA, // in $...$
|
IN_FORMULA, // in $...$
|
||||||
|
|
||||||
} where_stack[MAX_TEX_STACK_LEVEL] = {IN_UNDEF};
|
} where_stack[MAX_TEX_STACK_LEVEL] = {IN_UNDEF};
|
||||||
|
|
||||||
|
enum object_e {
|
||||||
|
OBJ_UNDEF = 0,
|
||||||
|
OBJ_TABLE,
|
||||||
|
OBJ_TABLE_PARAMS,
|
||||||
|
OBJ_TABLE_HEADER,
|
||||||
|
OBJ_TABLE_FOOTER,
|
||||||
|
OBJ_GRAPHICS
|
||||||
|
|
||||||
|
} object_stack[MAX_TEX_STACK_LEVEL] = {OBJ_UNDEF};
|
||||||
|
|
||||||
char *tag = NULL, *param = NULL;
|
char *tag = NULL, *param = NULL;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t tex_level = 0;
|
size_t tex_level = 0;
|
||||||
|
size_t obj_level = 0;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
|
|
||||||
|
@ -157,11 +151,10 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
||||||
|
|
||||||
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))
|
&& !strcmp(param, TEX_PARAM_TABLE))
|
||||||
where_stack[tex_level++] = IN_TABLE;
|
object_stack[++obj_level] = OBJ_TABLE;
|
||||||
|
else if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
|
||||||
if (tex_level && where_stack[tex_level - 1] == IN_TAG_END
|
|
||||||
&& !strcmp(param, TEX_PARAM_TABLE))
|
&& !strcmp(param, TEX_PARAM_TABLE))
|
||||||
where_stack[tex_level--] = IN_UNDEF;
|
object_stack[obj_level--] = OBJ_UNDEF;
|
||||||
|
|
||||||
where_stack[tex_level--] = IN_UNDEF;
|
where_stack[tex_level--] = IN_UNDEF;
|
||||||
|
|
||||||
|
@ -221,13 +214,6 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
||||||
|
|
||||||
case IN_FORMULA:
|
case IN_FORMULA:
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IN_TABLE:
|
|
||||||
*tex_struct = zalloc_append64(*tex_struct,
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -239,3 +225,4 @@ void tex_parse(const char *source, size_t len, struct tex_struct_s **tex_struct,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue