]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parser.h
fix typo that put too many include paths for most people
[lyx.git] / src / mathed / math_parser.h
1 // -*- C++ -*-
2 /*
3  *  File:        math_parser.h
4  *  Purpose:     Declaration of parsing utilities for mathed
5  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
6  *  Created:     January 1996
7  *  Description: Parse LaTeX2e math mode code.
8  *
9  *  Dependencies: Xlib, XForms
10  *
11  *  Copyright: 1996, Alejandro Aguilar Sierra
12  *
13  *   Version: 0.8beta.
14  *
15  *   You are free to use and modify this code under the terms of
16  *   the GNU General Public Licence version 2 or later.
17  */
18
19 #ifndef MATH_PARSER_H
20 #define MATH_PARSER_H
21
22 #ifdef __GNUG__
23 #pragma interface
24 #endif
25
26 #include "LString.h"
27 #include "math_defs.h"
28
29 class MathAtom;
30 class MathArray;
31 class LyXLex;
32
33 ///
34 enum MathTokenEnum
35 {
36         ///
37         LM_TK_SYM = 256,
38         ///
39         LM_TK_BOX,
40         ///
41         LM_TK_CHOOSE,
42         ///
43         LM_TK_BINOM,
44         ///
45         LM_TK_ATOP,
46         ///
47         LM_TK_OVER,
48         ///
49         LM_TK_FRAC,
50         ///
51         LM_TK_SQRT,
52         ///
53         LM_TK_ROOT,
54         ///
55         LM_TK_LEFTEQN,
56         ///
57         LM_TK_BEGIN,
58         ///
59         LM_TK_END,
60         /// mathcal, mathrm...
61         LM_TK_OLDFONT,
62         /// cal,...
63         LM_TK_FONT,
64         ///
65         LM_TK_LEFT,
66         ///
67         LM_TK_RIGHT,
68         ///
69         LM_TK_DECORATION,
70         ///
71         LM_TK_FUNC,
72         ///
73         LM_TK_FUNCLIM,
74         ///
75         LM_TK_CMR,
76         ///
77         LM_TK_CMSY,
78         ///
79         LM_TK_CMM,
80         ///
81         LM_TK_CMEX,
82         ///
83         LM_TK_MSA,
84         ///
85         LM_TK_MSB,
86         ///
87         LM_TK_LABEL,
88         ///
89         LM_TK_NONUM,
90         ///
91         LM_TK_SPACE,
92         ///
93         LM_TK_DOTS,
94         ///
95         LM_TK_LIMIT,
96         ///
97         LM_TK_PROTECT,
98         ///
99         LM_TK_STY,
100         ///
101         LM_TK_SPECIAL,
102         ///
103         LM_TK_ARGUMENT,
104         ///
105         LM_TK_NEWCOMMAND,
106         ///
107         LM_TK_MATH,
108         ///
109         LM_TK_NOT,
110         ///
111         LM_TK_UNDERSET,
112         ///
113         LM_TK_STACK
114 };
115
116
117 ///
118 struct latexkeys {
119         /// name of the macro or primitive
120         string name;
121         /// one of the categories above
122         MathTokenEnum token;
123         /// an id within a category if needed (only for spaces?)
124         unsigned int id;
125         /// which font to use (optional)
126         unsigned int latex_font_id;
127         /// operator/...
128         string type;
129         /// how is this called as XML entity?
130         string xmlname;
131 };
132
133
134 /// check whether this is a well-known (La)TeX macro or primitive
135 latexkeys const * in_word_set(string const & str);
136
137 /// parse formula from a string
138 bool mathed_parse_normal(MathAtom &, string const &);
139 /// ... a stream
140 bool mathed_parse_normal(MathAtom &, std::istream &);
141 /// ... the LyX lexxer
142 bool mathed_parse_normal(MathAtom &, LyXLex &);
143
144 /// parse a macro definition from a string, enter it into the macro table
145 bool mathed_parse_macro(string &, string const &);
146 /// ... a stream
147 bool mathed_parse_macro(string &, std::istream &);
148 /// ... the LyX lexxer
149 bool mathed_parse_macro(string &, LyXLex &);
150
151 /// parse a single cell from a string
152 void mathed_parse_cell(MathArray & ar, string const &);
153 /// ... a stream
154 void mathed_parse_cell(MathArray & ar, std::istream &);
155
156 #endif