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
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pö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
|
|
|
|
2008-10-18 12:25:03 +00:00
|
|
|
#include "MathParser_flags.h"
|
2008-10-17 21:40:11 +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 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-06 15:18:48 +00:00
|
|
|
class Buffer;
|
2001-10-12 12:02:49 +00:00
|
|
|
class MathAtom;
|
2007-04-26 16:05:57 +00:00
|
|
|
class MathData;
|
2006-09-16 18:11:38 +00:00
|
|
|
class InsetMathGrid;
|
2007-04-26 11:30:54 +00:00
|
|
|
class Lexer;
|
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
|
2009-11-08 11:45:46 +00:00
|
|
|
bool mathed_parse_normal(Buffer * buf, MathAtom &, docstring const &,
|
|
|
|
Parse::flags f = Parse::NORMAL);
|
2009-11-06 15:18:48 +00:00
|
|
|
|
|
|
|
/// parse formula from the LyX lexxer
|
2009-11-08 11:45:46 +00:00
|
|
|
bool mathed_parse_normal(Buffer * buf, MathAtom &, Lexer &,
|
|
|
|
Parse::flags f = Parse::NORMAL);
|
2009-11-06 15:18:48 +00:00
|
|
|
|
2006-12-19 14:24:25 +00:00
|
|
|
/// parse formula from a string into a grid
|
2009-11-06 15:18:48 +00:00
|
|
|
bool mathed_parse_normal(InsetMathGrid &, docstring const &,
|
2009-11-08 11:45:46 +00:00
|
|
|
Parse::flags f = Parse::NORMAL);
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
/// parse a single cell from a string
|
2009-11-06 15:18:48 +00:00
|
|
|
bool mathed_parse_cell(MathData & ar, docstring const &,
|
2009-11-08 11:45:46 +00:00
|
|
|
Parse::flags f = Parse::NORMAL);
|
2009-11-06 15:18:48 +00:00
|
|
|
|
2006-12-19 14:24:25 +00:00
|
|
|
/// parse a single cell from a stream. Only use this for reading from .lyx
|
|
|
|
/// file format, for the reason see Parser::tokenize(std::istream &).
|
2009-11-06 15:18:48 +00:00
|
|
|
bool mathed_parse_cell(MathData & ar, std::istream &,
|
2009-11-08 11:45:46 +00:00
|
|
|
Parse::flags f = Parse::NORMAL);
|
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
|