1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#pragma once
#include <string.h>
#include "ltx2mathmlexceptions.h"
enum command_id {
ci_unknown, ci_msub, ci_msup, ci_msubsup, ci_munder, ci_mover, ci_munderover,
ci_mi, ci_mn, ci_mo, ci_text, ci_cfrac, ci_mfrac, ci_frac, ci_mathfont, ci_sqrt, ci_begin, ci_end,
ci_array, ci_eqnarray, ci_cases, ci_matrix, ci_bmatrix, ci_Bmatrix, ci_pmatrix, ci_vmatrix,
ci_Vmatrix, ci_mathop, ci_accent, ci_ext_arrows,
ci_func, ci_binom, ci_stack, ci_stackrel, ci_hfill, ci_limits, ci_nolimits,
ci_menclose, ci_strut, ci_phantom, ci_left, ci_right, ci_underoverbrace,
ci_mathstring, ci_lsub, ci_lsup, ci_lsubsup, ci_eqno, ci_leqno, ci_mathord, ci_mathbin, ci_mathrel
};
enum math_type { mt_unknown, mt_ident, mt_digit, mt_ord,
mt_bin, mt_unary, mt_bin_unary, mt_rel,
mt_left_fence, mt_right_fence, mt_fence,
mt_mov_limits, mt_limits, mt_func, mt_func_limits,
mt_text, mt_punct };
enum param_type { pt_unknown, pt_none, pt_plain, pt_one, pt_two, pt_three, pt_table, pt_others,
pt_especial };
enum token_type {
token_eof = -1,
token_unknown = 0,
token_alpha,
token_digit,
token_symbol,
token_white_space,
token_left_brace,
token_right_brace,
token_right_sq_bracket,
token_superscript,
token_subscript,
token_column_sep,
token_row_sep,
token_control_symbol,
token_control_name,
token_control_command,
token_control_entity,
token_control_function,
token_inline_math,
token_prime
};
struct SymbolTable {
union {
char const *tagOn;
char const*key;
char const*name;
//exception code;
};
union {
char const*tagOff;
char const*value;
math_type mathType;
//char *errorMsg;
};
};
struct ErrorTable {
ex_exception code;
char const *msg;
};
struct EntityStruct {
char const *name;
unsigned int code;
math_type mathType;
};
struct FunctionStruct {
char const *name;
char const *output;
math_type mathType;
};
struct FenceStruct {
EntityStruct *entity;
char output[20];
};
struct CommandStruct {
char const *name;
command_id id;
param_type param;
char const *tagOn;
char const *tagOff;
};
struct EnvironmentStruct {
char const *name;
command_id id;
char const *tagOn;
char const*tagOff;
};
struct SymbolStruct {
char const* name;
char const* literal;
char const* element;
math_type mathType;
};
struct ControlStruct {
CommandStruct *command;
token_type token;
char *start;
union {
EntityStruct *entity;
FunctionStruct *function;
};
};
token_type getControlType(const char *name, ControlStruct &control );
const char *getErrorMsg( ex_exception code );
const char *getMathVariant(const char *attrib );
bool getFenceType(const char *name, FenceStruct &fence );
EnvironmentStruct *getEnvironmentType(const char *name );
SymbolStruct *getSymbol(const char *name );
|