]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/src/TPushParser.hh
* this is a large commit
[helm.git] / helm / DEVEL / mathml_editor / src / TPushParser.hh
1
2 #ifndef __TPushParser_hh__
3 #define __TPushParser_hh__
4
5 #include <list>
6 #include <stack>
7 #include "TToken.hh"
8 #include "APushParser.hh"
9 #include "TDictionary.hh"
10 #include "TDocument.hh"
11 #include "TNode.hh"
12
13 class TPushParser : public APushParser
14 {
15 public:
16   TPushParser(class ALogger&, const class TDictionary&);
17   TPushParser(class ALogger&, class AMathMLFactory&, const class TDictionary&);
18   virtual ~TPushParser();
19
20   virtual void reset(void);
21   virtual void push(const TToken&);
22   virtual std::string drop(void);
23   virtual void setCursorHint(const std::string&);
24
25   virtual bool thaw(void);
26
27   DOM::Document document(void) const { return doc.document().cloneNode(true); }
28
29 private:
30   std::string PRIME(void) const;
31   bool isPrimes(const TNode&) const;
32   
33   void do_begin(void);
34   void do_end(void);
35   void do_shift(void);
36   void do_align(void);
37   void do_eol(void);
38   void do_parameter(const std::string&);
39   void do_superscript(void);
40   void do_subscript(void);
41   void do_space(const std::string&);
42   void do_letter(const std::string&);
43   void do_digit(const std::string&);
44   void do_other(const std::string&);
45   void do_active(const std::string&);
46   void do_comment(void);
47   void do_control(const std::string&);
48
49   
50   void gdelete_prev_token(void);
51   void gdelete_prev_script(void);
52   void gdelete_prev_group(void);
53   void gdelete_prev_macro(void);
54   void gdelete_prev(void);
55   
56   void rgreplace_father(void);
57
58   void do_gdelete_script(void);
59   void do_gdelete_macro(void);
60   void do_gdelete_groupId(void);
61   void do_gdelete_phantom_group(void);
62   void do_gdelete(void);
63
64   void do_cr(void);
65   void do_apostrophe(void);
66   void advance(const TNode&);
67
68   void process(const TToken&);
69
70   struct Frame
71   {
72     Frame(const TDictionary::Entry& e) : entry(e), pos(0) { };
73     Frame(const TDictionary::Entry&e, unsigned p) : entry(e), pos(p) { };
74     const TDictionary::Entry& entry;
75     unsigned pos;
76   };
77
78   std::stack<Frame> frames;
79   unsigned  nextId;
80   TDocument doc;
81   TNode     cursor;
82   const class TDictionary& dictionary;
83 };
84
85 #endif // __TPushParser_hh__