]> git.lyx.org Git - lyx.git/blob - src/mathed/MathParser.h
document docstring abuse for symbol font code points
[lyx.git] / src / mathed / MathParser.h
1 // -*- C++ -*-
2 /**
3  * \file MathParser.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author André Pönitz
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef MATH_PARSER_H
14 #define MATH_PARSER_H
15
16 #include "support/types.h"
17 #include "support/docstring.h"
18
19 #include <string>
20 #include <vector>
21
22 namespace lyx {
23
24
25 class MathAtom;
26 class MathArray;
27 class InsetMathGrid;
28 class LyXLex;
29
30
31 ///
32 class latexkeys {
33 public:
34         /// name of the macro or primitive
35         docstring name;
36         /// name of a inset that handles that macro
37         docstring inset;
38         /**
39          * The string or symbol to draw.
40          * This is a string of length 1 if \p name is a known symbol, and
41          * the corresponding font is available. In this case it is
42          * NO UCS4 STRING! The only "character" of the string simply denotes
43          * the code point of the symbol in the font. Therefore you have to
44          * be very careful if you pass \c draw to any function that takes a
45          * docstring argument.
46          * If \p name is a known symbol, but the corresponding font is not
47          * available, or if it is a function name, then \c draw contains a
48          * regular UCS4 string (actuallay \c draw == \c name) that is painted
49          * on screen.
50          */
51         docstring draw;
52         /// operator/..., fontname e
53         docstring extra;
54         /// how is this called as XML entity in MathML?
55         docstring xmlname;
56         /// required LaTeXFeatures
57         docstring requires;
58 };
59
60
61 /// check whether this is a well-known (La)TeX macro or primitive
62 latexkeys const * in_word_set(docstring const & str);
63
64 /// parse formula from a string
65 bool mathed_parse_normal(MathAtom &, docstring const &);
66 /// ... a stream
67 bool mathed_parse_normal(MathAtom &, std::istream &);
68 /// ... the LyX lexxer
69 bool mathed_parse_normal(MathAtom &, LyXLex &);
70 /// ... the LyX lexxer
71 void mathed_parse_normal(InsetMathGrid &, docstring const &);
72
73 /// parse a single cell from a string
74 void mathed_parse_cell(MathArray & ar, docstring const &);
75 /// ... a stream
76 void mathed_parse_cell(MathArray & ar, std::istream &);
77
78 void initParser();
79
80
81 } // namespace lyx
82
83 #endif