]> git.lyx.org Git - lyx.git/blob - src/mathed/MathParser.h
c92a8cfb883463525aea84e1e4b79695d09eefd5
[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 "MathParser_flags.h"
17
18 #include "support/docstring.h"
19
20
21 namespace lyx {
22
23 class Buffer;
24 class MathAtom;
25 class MathData;
26 class InsetMathGrid;
27 class Lexer;
28
29
30 ///
31 class latexkeys {
32 public:
33         ///
34         char const * MathMLtype() const;
35         /// name of the macro or primitive
36         docstring name;
37         /// name of a inset that handles that macro
38         std::string inset;
39         /**
40          * The string or symbol to draw.
41          * This is a string of length 1 if \p name is a known symbol, and
42          * the corresponding font is available. In this case it is
43          * NO UCS4 STRING! The only "character" of the string simply denotes
44          * the code point of the symbol in the font. Therefore you have to
45          * be very careful if you pass \c draw to any function that takes a
46          * docstring argument.
47          * If \p name is a known symbol, but the corresponding font is not
48          * available, or if it is a function name, then \c draw contains a
49          * regular UCS4 string (actuallay \c draw == \c name) that is painted
50          * on screen.
51          */
52         docstring draw;
53         /// operator/..., fontname e
54         docstring extra;
55         /// how is this called as XML entity in MathML?
56         docstring xmlname;
57         /// required LaTeXFeatures
58         std::string requires;
59 };
60
61
62 /// check whether this is a well-known (La)TeX macro or primitive
63 latexkeys const * in_word_set(docstring const & str);
64
65 /// parse formula from a string
66 bool mathed_parse_normal(Buffer * buf, MathAtom &, docstring const &,
67                 Parse::flags f = Parse::NORMAL);
68
69 /// parse formula from the LyX lexxer
70 bool mathed_parse_normal(Buffer * buf, MathAtom &, Lexer &,
71                 Parse::flags f = Parse::NORMAL);
72
73 /// parse formula from a string into a grid
74 bool mathed_parse_normal(InsetMathGrid &, docstring const &,
75                 Parse::flags f = Parse::NORMAL);
76
77 /// parse a single cell from a string
78 bool mathed_parse_cell(MathData & ar, docstring const &,
79                 Parse::flags f = Parse::NORMAL);
80
81 /// parse a single cell from a stream. Only use this for reading from .lyx
82 /// file format, for the reason see Parser::tokenize(std::istream &).
83 bool mathed_parse_cell(MathData & ar, std::istream &,
84                 Parse::flags f = Parse::NORMAL);
85
86 void initParser();
87
88
89 } // namespace lyx
90
91 #endif