домой выгоняют

This commit is contained in:
Kolan Sh 2011-06-21 19:13:25 +04:00
parent 7e29364c79
commit 186fc07303
3 changed files with 41 additions and 35 deletions

View File

@ -1,6 +1,5 @@
%% LyX 1.6.8 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\\
\documentclass[english,russian]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9,koi8-r]{inputenc}

View File

@ -11,7 +11,14 @@
#define MAX_TEX_STACK_LEVEL 128
char * const PARSING_ERROR = "Error parsing";
enum tex_parse_err {
PARSE_ERROR_UNDEF = 0,
PARSE_ERROR,
PARSE_ERROR_STACKOVERFLOW
};
char * const TEX_PARSING_ERROR = "Error parsing";
char * const TEX_PARSING_ERROR_STACKOVERFLOW = "Error parsing";
int parse_table(const char *table_source, size_t len, struct table_s *table, struct xerror_s *error)
{
@ -43,7 +50,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
/* stack checking */
if (tex_level + 1 == MAX_TEX_STACK_LEVEL) {
error->code = -1;
error->message = PARSING_ERROR;
error->message = TEX_PARSING_ERROR_STACKOVERFLOW;
return -1;
}
@ -62,7 +69,7 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
} else {
error->code = -1;
error->message = PARSING_ERROR;
error->message = TEX_PARSING_ERROR;
return -1;
}
@ -75,13 +82,13 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
break;
case IN_TAG:
if (islower(c) || isdigit(c) || !tag && c == '\\') {
if (islower(c) || isdigit(c) || (!tag && c == '\\')) {
tag = zalloc_append8_str(tag, c);
} else {
if (!tag) {
error->code = -1;
error->message = PARSING_ERROR;
error->message = TEX_PARSING_ERROR;
return -1;
} else if (!strcmp(tag, TEX_TAG_BEGIN)) {
@ -111,38 +118,38 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
}
break;
//~ case IN_TAG_BEGIN:
//~ if (c == '{') {
//~ where_stack[++tex_level] = IN_TAGPARM;
//~
//~ } else if (isspace(c)) {
//~
//~ } else {
//~ error->code = -1;
//~ error->message = PARSING_ERROR;
//~ return -1;
//~ }
//~ break;
case IN_TAG_BEGIN:
if (c == '{') {
where_stack[++tex_level] = IN_TAGPARM;
//~ case IN_TAGPARM:
//~ if (c == '}') {
//~ where_stack[tex_level--] = IN_UNDEF;
//~
//~ } else if (isgraph(c)) {
//~ brpar = zalloc_append8_str(brpar, c);
//~
//~ } else if (isspace(c)) {
//~
//~ } else {
//~ error->code = -1;
//~ error->message = PARSING_ERROR;
//~ return -1;
//~ }
//~ break;
} else if (isspace(c)) {
} else {
error->code = -1;
error->message = TEX_PARSING_ERROR;
return -1;
}
break;
case IN_TAGPARM:
if (c == '}') {
where_stack[tex_level--] = IN_UNDEF;
} else if (isgraph(c)) {
brpar = zalloc_append8_str(brpar, c);
} else if (isspace(c)) {
} else {
error->code = -1;
error->message = TEX_PARSING_ERROR;
return -1;
}
break;
default:
error->code = -1;
error->message = PARSING_ERROR;
error->message = TEX_PARSING_ERROR;
return -1;
break;
}

View File

@ -18,7 +18,7 @@ long_line_column=72
[files]
current_page=1
FILE_NAME_0=709;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table_test.c;0
FILE_NAME_1=2380;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table.c;0
FILE_NAME_1=523;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table.c;0
FILE_NAME_2=1762;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.h;0
FILE_NAME_3=2350;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table.h;0
FILE_NAME_4=634;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table_tags.h;0