lyx_mirror/src/mathed/MathParser.h
Georg Baum 1ca55d1c8f Fix bug 3034
* src/mathed/InsetMathGrid.C: Don't declare mathed_parse_normal,
	include MathParser.h instead
	(InsetMathGrid::doDispatch): remove to_utf8, mathed_parse_normal
	takes now a docstring

	* src/mathed/MathMacroTemplate.C
	(MathMacroTemplate::read): restore the version of 1.4.x, since
	the new one did only work for macros without whitespace

	* src/mathed/MathParser.[Ch]
	(Parser): Add constructor from a docstring
	(mathed_parse_cell): Create the parser directly from the string,
	since the istream variant of tokenize() does only work if reading
	from the .lyx file
	(mathed_parse_normal): ditto
	(mathed_parse_normal): Delete the istream variant (unused)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16334 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-19 14:24:25 +00:00

83 lines
2.2 KiB
C++

// -*- C++ -*-
/**
* \file MathParser.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#ifndef MATH_PARSER_H
#define MATH_PARSER_H
#include "support/types.h"
#include "support/docstring.h"
#include <string>
#include <vector>
namespace lyx {
class MathAtom;
class MathArray;
class InsetMathGrid;
class LyXLex;
///
class latexkeys {
public:
/// name of the macro or primitive
docstring name;
/// name of a inset that handles that macro
docstring inset;
/**
* 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
docstring extra;
/// how is this called as XML entity in MathML?
docstring xmlname;
/// required LaTeXFeatures
docstring requires;
};
/// check whether this is a well-known (La)TeX macro or primitive
latexkeys const * in_word_set(docstring const & str);
/// parse formula from a string
bool mathed_parse_normal(MathAtom &, docstring const &);
/// ... the LyX lexxer
bool mathed_parse_normal(MathAtom &, LyXLex &);
/// parse formula from a string into a grid
void mathed_parse_normal(InsetMathGrid &, docstring const &);
/// parse a single cell from a string
void mathed_parse_cell(MathArray & ar, docstring const &);
/// parse a single cell from a stream. Only use this for reading from .lyx
/// file format, for the reason see Parser::tokenize(std::istream &).
void mathed_parse_cell(MathArray & ar, std::istream &);
void initParser();
} // namespace lyx
#endif