\\ symbol now interpreted as tag
This commit is contained in:
parent
c1638e027d
commit
7e29364c79
|
@ -1,5 +1,6 @@
|
|||
%% 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}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "zalloc_ext.h"
|
||||
#include "zalloc.h"
|
||||
|
||||
/* unnecessary includes */
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_TEX_STACK_LEVEL 128
|
||||
|
||||
char * const PARSING_ERROR = "Error parsing";
|
||||
|
@ -44,9 +47,10 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* read one charecter from input stream */
|
||||
/* read one character from input stream */
|
||||
char c = table_source[i];
|
||||
|
||||
/* looking at where_stack and encountered character */
|
||||
switch (where_stack[tex_level]) {
|
||||
case IN_UNDEF:
|
||||
if (c == '\\') {
|
||||
|
@ -71,11 +75,14 @@ int parse_table(const char *table_source, size_t len, struct table_s *table, str
|
|||
break;
|
||||
|
||||
case IN_TAG:
|
||||
if (islower(c) || isdigit(c)) {
|
||||
zalloc_append8_str(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;
|
||||
return -1;
|
||||
|
||||
} else if (!strcmp(tag, TEX_TAG_BEGIN)) {
|
||||
where_stack[tex_level++] = IN_TAG_BEGIN;
|
||||
|
@ -104,34 +111,34 @@ 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;
|
||||
//~ 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;
|
||||
|
||||
} else if (isspace(c)) {
|
||||
|
||||
} else {
|
||||
error->code = -1;
|
||||
error->message = PARSING_ERROR;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case IN_TAGPARM:
|
||||
if (c == '}') {
|
||||
where_stack[tex_level--] = IN_UNDEF;
|
||||
|
||||
} else if (isgraph(c)) {
|
||||
zalloc_append8_str(brpar, c);
|
||||
|
||||
} else if (isspace(c)) {
|
||||
|
||||
} else {
|
||||
error->code = -1;
|
||||
error->message = 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 = PARSING_ERROR;
|
||||
//~ return -1;
|
||||
//~ }
|
||||
//~ break;
|
||||
|
||||
default:
|
||||
error->code = -1;
|
||||
|
|
|
@ -17,11 +17,12 @@ long_line_column=72
|
|||
|
||||
[files]
|
||||
current_page=1
|
||||
FILE_NAME_0=216;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table_test.c;0
|
||||
FILE_NAME_1=480;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table.c;0
|
||||
FILE_NAME_2=549;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table.h;0
|
||||
FILE_NAME_3=612;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_table_tags.h;0
|
||||
FILE_NAME_4=1740;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;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_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
|
||||
FILE_NAME_5=1488;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0
|
||||
|
||||
[build-menu]
|
||||
NF_00_LB=_Сделать
|
||||
|
@ -44,5 +45,5 @@ CFT_02_CM=
|
|||
CFT_02_WD=%p
|
||||
filetypes=C;
|
||||
EX_00_LB=_Выполнить
|
||||
EX_00_CM="./%e" tables4.tex
|
||||
EX_00_CM=./tex_table_test tables4.tex
|
||||
EX_00_WD=%p
|
||||
|
|
Loading…
Reference in New Issue