]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/src/TPushParser.hh
Bug fixed. In the previous version, all right open macros and all delimited arguments
[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   
34   
35   void do_begin(void);
36   void do_end(void);
37   void do_shift(void);
38   void do_align(void);
39   void do_eol(void);
40   void do_parameter(const std::string&);
41   void do_superscript(void);
42   void do_subscript(void);
43   void do_space(const std::string&);
44   void do_letter(const std::string&);
45   void do_digit(const std::string&);
46   void do_other(const std::string&);
47   void do_active(const std::string&);
48   void do_comment(void);
49   void do_control(const std::string&);
50
51   
52   void gdelete_prev_token(void);
53   void gdelete_prev_script(void);
54   void gdelete_prev_group(void);
55   void gdelete_prev_macro(void);
56   void gdelete_prev(void);
57   
58   void rgreplace_father(void);
59
60   void do_gdelete_script(void);
61   void do_gdelete_macro(void);
62   void do_gdelete_groupId(void);
63   void do_gdelete_phantom_group(void);
64   void do_gdelete(void);
65
66   void do_cr(void);
67   void do_apostrophe(void);
68   void advance(const TNode&);
69   bool correctBrace(void);
70
71   void process(const TToken&);
72
73   struct Frame
74   {
75     Frame(const TDictionary::Entry& e) : entry(e), pos(0) { };
76     Frame(const TDictionary::Entry&e, unsigned p) : entry(e), pos(p) { };
77     const TDictionary::Entry& entry;
78     unsigned pos;
79   };
80
81   std::stack<Frame> frames;
82   unsigned  nextId;
83   TDocument doc;
84   TNode     cursor;
85   const class TDictionary& dictionary;
86 };
87
88 #endif // __TPushParser_hh__