1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
* File: math_parser.h
|
|
|
|
* Purpose: Declaration of parsing utilities for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: January 1996
|
|
|
|
* Description: Parse LaTeX2e math mode code.
|
|
|
|
*
|
|
|
|
* Dependencies: Xlib, XForms
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* Version: 0.8beta.
|
|
|
|
*
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
#ifndef MATH_PARSER_H
|
|
|
|
#define MATH_PARSER_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
2001-07-26 10:21:18 +00:00
|
|
|
#include "math_defs.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "symbol_def.h"
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
class MathArray;
|
2001-08-03 09:54:48 +00:00
|
|
|
class MathMatrixInset;
|
|
|
|
class MathMacroTemplate;
|
2001-06-25 00:06:33 +00:00
|
|
|
class LyXLex;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
enum MathTokenEnum
|
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
///
|
|
|
|
LM_TK_BOP = 256,
|
|
|
|
///
|
|
|
|
LM_TK_ALPHA,
|
|
|
|
///
|
|
|
|
LM_TK_STR,
|
|
|
|
///
|
|
|
|
LM_TK_SYM,
|
|
|
|
///
|
|
|
|
LM_TK_FRAC,
|
|
|
|
///
|
|
|
|
LM_TK_SQRT,
|
|
|
|
///
|
|
|
|
LM_TK_BEGIN,
|
|
|
|
///
|
|
|
|
LM_TK_END,
|
|
|
|
///
|
|
|
|
LM_TK_NEWLINE,
|
|
|
|
///
|
|
|
|
LM_TK_UNDEF,
|
|
|
|
///
|
|
|
|
LM_TK_FONT,
|
|
|
|
///
|
|
|
|
LM_TK_LEFT,
|
|
|
|
///
|
|
|
|
LM_TK_RIGHT,
|
|
|
|
///
|
2001-07-13 07:55:55 +00:00
|
|
|
LM_TK_DECORATION,
|
2001-02-16 09:25:43 +00:00
|
|
|
///
|
|
|
|
LM_TK_FUNC,
|
|
|
|
///
|
|
|
|
LM_TK_FUNCLIM,
|
|
|
|
///
|
|
|
|
LM_TK_BIGSYM,
|
|
|
|
///
|
|
|
|
LM_TK_LABEL,
|
|
|
|
///
|
|
|
|
LM_TK_NONUM,
|
|
|
|
///
|
|
|
|
LM_TK_SPACE,
|
|
|
|
///
|
|
|
|
LM_TK_DOTS,
|
|
|
|
///
|
|
|
|
LM_TK_LIMIT,
|
|
|
|
///
|
2001-07-26 16:56:23 +00:00
|
|
|
LM_TK_PROTECT,
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
LM_TK_STY,
|
|
|
|
///
|
|
|
|
LM_TK_MACRO,
|
|
|
|
///
|
|
|
|
LM_TK_SPECIAL,
|
|
|
|
///
|
|
|
|
LM_TK_ARGUMENT,
|
|
|
|
///
|
|
|
|
LM_TK_NEWCOMMAND,
|
|
|
|
///
|
2001-07-26 16:56:23 +00:00
|
|
|
LM_TK_MATH,
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
LM_TK_STACK
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
1999-12-13 21:59:26 +00:00
|
|
|
struct latexkeys {
|
2001-02-16 09:25:43 +00:00
|
|
|
///
|
|
|
|
char const * name;
|
|
|
|
///
|
|
|
|
short token;
|
|
|
|
///
|
2001-06-27 14:10:35 +00:00
|
|
|
unsigned int id;
|
2001-07-26 10:21:18 +00:00
|
|
|
///
|
|
|
|
MathBinaryTypes bin;
|
1999-12-13 21:59:26 +00:00
|
|
|
};
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
latexkeys const * in_word_set(string const & str);
|
2000-09-14 17:53:12 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-06-27 14:10:35 +00:00
|
|
|
latexkeys const * lm_get_key_by_id(unsigned int id, short tc);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
MathMatrixInset * mathed_parse_normal(string const &);
|
|
|
|
MathMatrixInset * mathed_parse_normal(std::istream &);
|
|
|
|
MathMatrixInset * mathed_parse_normal(LyXLex &);
|
|
|
|
|
|
|
|
MathMacroTemplate * mathed_parse_macro(string const &);
|
|
|
|
MathMacroTemplate * mathed_parse_macro(std::istream &);
|
|
|
|
MathMacroTemplate * mathed_parse_macro(LyXLex &);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|