1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file MathParser.h
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* \author Alejandro Aguilar Sierra
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#ifndef MATH_PARSER_H
|
|
|
|
|
#define MATH_PARSER_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-21 11:15:37 +00:00
|
|
|
|
#include "support/types.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "support/docstring.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-21 11:15:37 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
class MathAtom;
|
|
|
|
|
class MathArray;
|
2006-09-16 18:11:38 +00:00
|
|
|
|
class InsetMathGrid;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class LyXLex;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class latexkeys {
|
|
|
|
|
public:
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// name of the macro or primitive
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring name;
|
2002-05-30 07:09:54 +00:00
|
|
|
|
/// name of a inset that handles that macro
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring inset;
|
2006-11-07 20:46:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring draw;
|
2002-05-30 07:09:54 +00:00
|
|
|
|
/// operator/..., fontname e
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring extra;
|
2006-11-07 20:46:38 +00:00
|
|
|
|
/// how is this called as XML entity in MathML?
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring xmlname;
|
2005-06-07 17:21:51 +00:00
|
|
|
|
/// required LaTeXFeatures
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring requires;
|
1999-12-13 21:59:26 +00:00
|
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// check whether this is a well-known (La)TeX macro or primitive
|
2006-10-22 10:15:23 +00:00
|
|
|
|
latexkeys const * in_word_set(docstring const & str);
|
2000-09-14 17:53:12 +00:00
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// parse formula from a string
|
2006-10-22 10:15:23 +00:00
|
|
|
|
bool mathed_parse_normal(MathAtom &, docstring const &);
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// ... a stream
|
2001-10-12 12:02:49 +00:00
|
|
|
|
bool mathed_parse_normal(MathAtom &, std::istream &);
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// ... the LyX lexxer
|
2001-10-12 12:02:49 +00:00
|
|
|
|
bool mathed_parse_normal(MathAtom &, LyXLex &);
|
2002-08-14 16:11:55 +00:00
|
|
|
|
/// ... the LyX lexxer
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void mathed_parse_normal(InsetMathGrid &, docstring const &);
|
2001-08-03 09:54:48 +00:00
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// parse a single cell from a string
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void mathed_parse_cell(MathArray & ar, docstring const &);
|
2002-01-08 11:03:34 +00:00
|
|
|
|
/// ... a stream
|
|
|
|
|
void mathed_parse_cell(MathArray & ar, std::istream &);
|
2001-10-18 13:21:21 +00:00
|
|
|
|
|
2004-04-13 06:27:29 +00:00
|
|
|
|
void initParser();
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|