A bit more re-organization.
[lyx.git] / src / mathed / MathParser.h
blobc4ae6f89949bf3bb93e1b6edd82531a79743b805
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.
7 * \author Alejandro Aguilar Sierra
8 * \author André Pönitz
10 * Full author contact details are available in file CREDITS.
13 #ifndef MATH_PARSER_H
14 #define MATH_PARSER_H
16 #include "MathParser_flags.h"
18 #include "support/types.h"
19 #include "support/docstring.h"
22 namespace lyx {
24 class Buffer;
25 class MathAtom;
26 class MathData;
27 class InsetMathGrid;
28 class Lexer;
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.
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;
61 /// check whether this is a well-known (La)TeX macro or primitive
62 latexkeys const * in_word_set(docstring const & str);
64 /// parse formula from a string
65 bool mathed_parse_normal(Buffer * buf, MathAtom &, docstring const &,
66 Parse::flags f = Parse::NORMAL);
68 /// parse formula from the LyX lexxer
69 bool mathed_parse_normal(Buffer * buf, MathAtom &, Lexer &,
70 Parse::flags f = Parse::NORMAL);
72 /// parse formula from a string into a grid
73 bool mathed_parse_normal(InsetMathGrid &, docstring const &,
74 Parse::flags f = Parse::NORMAL);
76 /// parse a single cell from a string
77 bool mathed_parse_cell(MathData & ar, docstring const &,
78 Parse::flags f = Parse::NORMAL);
80 /// parse a single cell from a stream. Only use this for reading from .lyx
81 /// file format, for the reason see Parser::tokenize(std::istream &).
82 bool mathed_parse_cell(MathData & ar, std::istream &,
83 Parse::flags f = Parse::NORMAL);
85 void initParser();
88 } // namespace lyx
90 #endif