1 /* Copyright (C) 2002-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
2 * 2003, Paolo Marinelli <pmarinel@cs.unibo.it>.
4 * This file is part of EdiTeX, an editor of mathematical
5 * expressions based on TeX syntax
7 * EdiTeX is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * EdiTeX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with EdiTeX; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * For details, see the EdiTeX World-Wide-Web page,
22 * http://helm.cs.unibo.it/editex, or send a mail to
23 * <luca.padovani@cs.unibo.it>
26 #ifndef __TPushParser_hh__
27 #define __TPushParser_hh__
32 #include "APushParser.hh"
33 #include "TDictionary.hh"
34 #include "TDocument.hh"
37 class TPushParser : public APushParser
40 TPushParser(class ALogger&, const class TDictionary&);
41 TPushParser(class ALogger&, class AMathMLFactory&, const class TDictionary&);
42 virtual ~TPushParser();
44 virtual void reset(void);
45 virtual void push(const TToken&);
46 virtual std::string drop(bool);
47 virtual void setCursorHint(const std::string&);
48 virtual bool hideCursor(void);
49 virtual bool showCursor(void);
51 virtual bool thaw(void);
53 DOM::Document document(void) const { return doc.document().cloneNode(true); }
59 bool isPrimes(const TNode&) const;
66 bool do_parameter(const std::string&);
67 bool do_superscript(void);
68 bool do_subscript(void);
69 bool do_space(const std::string&);
70 bool do_letter(const std::string&);
71 bool do_digit(const std::string&);
72 bool do_other(const std::string&);
73 bool do_active(const std::string&);
74 bool do_comment(void);
75 bool do_control(const std::string&);
78 std::string drop_prev_token(bool);
79 std::string drop_prev_script(bool);
80 std::string drop_prev_group(bool);
81 std::string drop_prev_macro(bool);
82 std::string drop_prev(bool);
83 void rgreplace_father(void);
84 std::string do_drop_script(bool);
85 std::string do_drop_macro(bool);
86 std::string do_drop_groupId(bool);
87 std::string do_drop_phantom_group(bool);
88 std::string do_drop(bool);
91 bool do_apostrophe(void);
92 void advance(const TNode&);
93 bool correctBrace(void);
95 bool process(const TToken&);
99 Frame(const TDictionary::Entry& e) : entry(e), pos(0) { };
100 Frame(const TDictionary::Entry&e, unsigned p) : entry(e), pos(p) { };
101 const TDictionary::Entry& entry;
105 std::stack<Frame> frames;
109 unsigned hiddenCursor;
110 const class TDictionary& dictionary;
113 #endif // __TPushParser_hh__