по сути работало неверно, изменил алгоритм входа в теги

This commit is contained in:
Kolan Sh 2011-06-28 12:23:33 +04:00
parent b3ed9f553c
commit 624e1322a2
1 changed files with 9 additions and 21 deletions

View File

@ -59,7 +59,9 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
/* read one character from input stream */
char c = table_source[i];
printf("tex_level = %lu, c = %c\n", tex_level, c);
#ifdef __TEX_TABLE_DEBUG
printf("tex_level = %lu, c = %c\n", tex_level, c);
#endif
/* looking at where_stack and encountered character */
switch (where_stack[tex_level]) {
case IN_UNDEF:
@ -178,39 +180,25 @@ printf("tex_level = %lu, c = %c\n", tex_level, c);
#endif
tag = zfree_null(tag);
} else if (c == '%') {
} else {
#ifdef __TEX_TABLE_DEBUG
printf("\\%s\n", tag);
#endif
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG_UNKNOWN;
where_stack[++tex_level] = IN_COMMENT;
} else if (c == '{' || c == '[') {
#ifdef __TEX_TABLE_DEBUG
printf("\\%s\n", tag);
#endif
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG_UNKNOWN;
where_stack[++tex_level] = IN_TAGPARM;
}
} else if (isspace(c)) { // \tag { for example
if (isspace(c)) { // \tag { for example
#ifdef __TEX_TABLE_DEBUG
printf("\\%s\n", tag);
#endif
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG_UNKNOWN;
where_stack[++tex_level] = IN_SPACE;
} else { // unknown tag
#ifdef __TEX_TABLE_DEBUG
printf("\\%s\n", tag);
#endif
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG_UNKNOWN;
}
if (c == '\\' || c == '}' || c == ']')
} else if (c == '\\' || c == '}'
|| c == ']' || c == '{'
|| c == '[' || c == '%')
i--;
}
break;