весь документ прошли

This commit is contained in:
Kolan Sh 2011-06-27 17:07:52 +04:00
parent 40c572711b
commit 49e1eca45d
1 changed files with 64 additions and 19 deletions

View File

@ -88,7 +88,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
if (isalnum(c)) { if (isalnum(c)) {
tag = zalloc_append8_str(tag, c); tag = zalloc_append8_str(tag, c);
} else if (!tag && (c == '\\' || c == ',')) { // newline tag or \, } else if (!tag && (c == '\\' || c == ',' || c == '%')) { // newline tag or \,
where_stack[tex_level--] = IN_UNDEF; where_stack[tex_level--] = IN_UNDEF;
} else if (!tag) { } else if (!tag) {
@ -299,22 +299,6 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
break; break;
case IN_TAG_CLINE: case IN_TAG_CLINE:
break;
case IN_TAG_END:
break;
case IN_TAG_ENDFOOT:
break;
case IN_TAG_ENDHEAD:
break;
case IN_TAG_HLINE:
if (c == '{' || c == '[') { // tag params if (c == '{' || c == '[') { // tag params
where_stack[++tex_level] = IN_TAGPARM; where_stack[++tex_level] = IN_TAGPARM;
@ -331,15 +315,54 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
} else if (c == '}') { } else if (c == '}') {
where_stack[tex_level--] = IN_UNDEF; where_stack[tex_level--] = IN_UNDEF;
} else if (isalnum(c) || c == '#') { } else if (isgraph(c) || c < 0) {
} else { } else {
error->code = (int)i; error->code = (int)i;
error->message = "unexpected symbol (IN_TAG_HLINE)"; error->message = "unexpected symbol (IN_TAG_UNKNOWN)";
return error->code; return error->code;
} }
break; break;
case IN_TAG_END:
if (c == '{' || c == '[') { // tag params
where_stack[++tex_level] = IN_TAGPARM;
} else if (c == '\\') { // new tag
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG;
} else if (c == '%') {
where_stack[++tex_level] = IN_COMMENT;
} else if (isspace(c)) {
where_stack[++tex_level] = IN_SPACE;
} else if (c == '}') {
where_stack[tex_level--] = IN_UNDEF;
} else if (isgraph(c) || c < 0) {
} else {
error->code = (int)i;
error->message = "unexpected symbol (IN_TAG_UNKNOWN)";
return error->code;
}
break;
case IN_TAG_ENDFOOT:
break;
case IN_TAG_ENDHEAD:
break;
case IN_TAG_HLINE:
where_stack[tex_level--] = IN_UNDEF;
break;
case IN_TAG_HSPACE: case IN_TAG_HSPACE:
break; break;
@ -371,7 +394,29 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
break; break;
case IN_TAG_MULTIROW: case IN_TAG_MULTIROW:
if (c == '{' || c == '[') { // tag params
where_stack[++tex_level] = IN_TAGPARM;
} else if (c == '\\') { // new tag
tag = zfree_null(tag);
where_stack[tex_level] = IN_TAG;
} else if (c == '%') {
where_stack[++tex_level] = IN_COMMENT;
} else if (isspace(c)) {
where_stack[++tex_level] = IN_SPACE;
} else if (c == '}') {
where_stack[tex_level--] = IN_UNDEF;
} else if (isgraph(c) || c < 0) {
} else {
error->code = (int)i;
error->message = "unexpected symbol (IN_TAG_MULTIROW)";
return error->code;
}
break; break;
case IN_TAG_TABULARNEWLINE: case IN_TAG_TABULARNEWLINE: