X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathParser.h;h=9ff6db1a91a2cb9f0f48932a99dfcda0972dc76d;hb=2de30c62f8d671a8c8d4d52a6a7310e2c5ca84de;hp=30b274133eca89bec0e7a802384c26719edf514a;hpb=d12c1f4b225859b36550c82a67fbda19f1ed82b5;p=lyx.git diff --git a/src/mathed/MathParser.h b/src/mathed/MathParser.h index 30b274133e..9ff6db1a91 100644 --- a/src/mathed/MathParser.h +++ b/src/mathed/MathParser.h @@ -5,7 +5,7 @@ * Licence details can be found in the file COPYING. * * \author Alejandro Aguilar Sierra - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -13,54 +13,80 @@ #ifndef MATH_PARSER_H #define MATH_PARSER_H -#include "support/types.h" +#include "MathParser_flags.h" -#include -#include +#include "support/docstring.h" -namespace lyx { +namespace lyx { +class Buffer; class MathAtom; -class MathArray; +class MathData; class InsetMathGrid; -class LyXLex; +class Lexer; /// class latexkeys { public: + /// + latexkeys() : hidden(false) {} + /// + char const * MathMLtype() const; /// name of the macro or primitive - std::string name; + docstring name; /// name of a inset that handles that macro std::string inset; - /// position of the ting in a font - std::vector draw; + /** + * The string or symbol to draw. + * This is a string of length 1 if \p name is a known symbol, and + * the corresponding font is available. In this case it is + * NO UCS4 STRING! The only "character" of the string simply denotes + * the code point of the symbol in the font. Therefore you have to + * be very careful if you pass \c draw to any function that takes a + * docstring argument. + * If \p name is a known symbol, but the corresponding font is not + * available, or if it is a function name, then \c draw contains a + * regular UCS4 string (actuallay \c draw == \c name) that is painted + * on screen. + */ + docstring draw; /// operator/..., fontname e - std::string extra; - /// how is this called as XML entity? - std::string xmlname; + docstring extra; + /// how is this called as XML entity in MathML? + docstring xmlname; /// required LaTeXFeatures std::string requires; + /// Should this macro be hidden from autocompletion (since it requires + /// user preamble code)? + bool hidden; }; /// check whether this is a well-known (La)TeX macro or primitive -latexkeys const * in_word_set(std::string const & str); +latexkeys const * in_word_set(docstring const & str); /// parse formula from a string -bool mathed_parse_normal(MathAtom &, std::string const &); -/// ... a stream -bool mathed_parse_normal(MathAtom &, std::istream &); -/// ... the LyX lexxer -bool mathed_parse_normal(MathAtom &, LyXLex &); -/// ... the LyX lexxer -void mathed_parse_normal(InsetMathGrid &, std::string const &); +bool mathed_parse_normal(Buffer * buf, MathAtom &, docstring const &, + Parse::flags f = Parse::NORMAL); + +/// parse formula from the LyX lexxer +bool mathed_parse_normal(Buffer * buf, MathAtom &, Lexer &, + Parse::flags f = Parse::NORMAL); + +/// parse formula from a string into a grid +bool mathed_parse_normal(InsetMathGrid &, docstring const &, + Parse::flags f = Parse::NORMAL); /// parse a single cell from a string -void mathed_parse_cell(MathArray & ar, std::string const &); -/// ... a stream -void mathed_parse_cell(MathArray & ar, std::istream &); +bool mathed_parse_cell(MathData & ar, docstring const &, + Parse::flags f = Parse::NORMAL); + +/// parse a single cell from a stream. Only use this for reading from .lyx +/// file format, for the reason see Parser::tokenize(std::istream &). +bool mathed_parse_cell(MathData & ar, std::istream &, + Parse::flags f = Parse::NORMAL); void initParser();