]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/src/TPushParser.hh
* added show/hide cursro methods
[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   virtual bool hideCursor(void);
25   virtual bool showCursor(void);
26
27   virtual bool thaw(void);
28
29   DOM::Document document(void) const { return doc.document().cloneNode(true); }
30
31 private:
32   void init(void);
33
34   std::string PRIME(void) const;
35   bool isPrimes(const TNode&) const;
36
37   
38   
39   void do_begin(void);
40   void do_end(void);
41   void do_shift(void);
42   void do_align(void);
43   void do_eol(void);
44   void do_parameter(const std::string&);
45   void do_superscript(void);
46   void do_subscript(void);
47   void do_space(const std::string&);
48   void do_letter(const std::string&);
49   void do_digit(const std::string&);
50   void do_other(const std::string&);
51   void do_active(const std::string&);
52   void do_comment(void);
53   void do_control(const std::string&);
54
55   
56   void gdelete_prev_token(void);
57   void gdelete_prev_script(void);
58   void gdelete_prev_group(void);
59   void gdelete_prev_macro(void);
60   void gdelete_prev(void);
61   
62   void rgreplace_father(void);
63
64   void do_gdelete_script(void);
65   void do_gdelete_macro(void);
66   void do_gdelete_groupId(void);
67   void do_gdelete_phantom_group(void);
68   void do_gdelete(void);
69
70   void do_cr(void);
71   void do_apostrophe(void);
72   void advance(const TNode&);
73   bool correctBrace(void);
74
75   void process(const TToken&);
76
77   struct Frame
78   {
79     Frame(const TDictionary::Entry& e) : entry(e), pos(0) { };
80     Frame(const TDictionary::Entry&e, unsigned p) : entry(e), pos(p) { };
81     const TDictionary::Entry& entry;
82     unsigned pos;
83   };
84
85   std::stack<Frame> frames;
86   unsigned  nextId;
87   TDocument doc;
88   TNode     cursor;
89   unsigned  hiddenCursor;
90   const class TDictionary& dictionary;
91 };
92
93 #endif // __TPushParser_hh__