]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/mathml_editor/src/TPushParser.hh
* changed handling of ' (\primes) with a few patches in the stylesheets
[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(bool);
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   TNode PRIME(void);
35   bool isPrimes(const TNode&) const;
36   
37   bool do_begin(void);
38   bool do_end(void);
39   bool do_shift(void);
40   bool do_align(void);
41   bool do_eol(void);
42   bool do_parameter(const std::string&);
43   bool do_superscript(void);
44   bool do_subscript(void);
45   bool do_space(const std::string&);
46   bool do_letter(const std::string&);
47   bool do_digit(const std::string&);
48   bool do_other(const std::string&);
49   bool do_active(const std::string&);
50   bool do_comment(void);
51   bool do_control(const std::string&);
52
53   
54   std::string drop_prev_token(bool);
55   std::string drop_prev_script(bool);
56   std::string drop_prev_group(bool);
57   std::string drop_prev_macro(bool);
58   std::string drop_prev(bool);
59   void rgreplace_father(void);
60   std::string do_drop_script(bool);
61   std::string do_drop_macro(bool);
62   std::string do_drop_groupId(bool);
63   std::string do_drop_phantom_group(bool);
64   std::string do_drop(bool);
65
66   bool do_cr(void);
67   bool do_apostrophe(void);
68   void advance(const TNode&);
69   bool correctBrace(void);
70
71   bool 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   unsigned  hiddenCursor;
86   const class TDictionary& dictionary;
87 };
88
89 #endif // __TPushParser_hh__