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

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/. %% 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. %% Do not edit unless you really know what you are doing.
\\
\documentclass[english,russian]{article} \documentclass[english,russian]{article}
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[latin9,koi8-r]{inputenc} \usepackage[latin9,koi8-r]{inputenc}

View File

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

View File

@ -18,7 +18,7 @@ long_line_column=72
[files] [files]
current_page=1 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_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_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_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 FILE_NAME_4=634;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table_tags.h;0