~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to languages/ada/AdaAST.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef ADAAST_HPP
2
 
#define ADAAST_HPP
3
 
 
4
 
#include <antlr/CommonAST.hpp>
5
 
 
6
 
class AdaAST;
7
 
typedef antlr::ASTRefCount<AdaAST> RefAdaAST;
8
 
 
9
 
class AdaAST : public antlr::CommonAST {
10
 
public:
11
 
    AdaAST() : m_line (0), m_column (0) {}
12
 
 
13
 
    ~AdaAST() {}
14
 
 
15
 
    int getLine () const { return m_line; }
16
 
    void setLine (int line) { m_line = line; }
17
 
 
18
 
    int getColumn () const { return m_column; }
19
 
    void setColumn (int column) { m_column = column; }
20
 
 
21
 
    void initialize (antlr::RefToken t) {
22
 
        antlr::CommonAST::initialize (t);
23
 
        m_line = t->getLine () - 1;
24
 
        m_column = t->getColumn () - 1;
25
 
    }
26
 
 
27
 
    void initialize (int t, const std::string& txt) {
28
 
        setType (t);
29
 
        setText (txt);
30
 
        m_line = 0;
31
 
        m_column = 0;
32
 
    }
33
 
 
34
 
    RefAdaAST duplicate (void) const {
35
 
        AdaAST *ast = new AdaAST (*this);
36
 
        return RefAdaAST (ast);
37
 
    }
38
 
 
39
 
    void set (int t, const std::string& txt) {
40
 
        setType (t);
41
 
        setText (txt);
42
 
    }
43
 
 
44
 
    void addChild (RefAdaAST c) {
45
 
        antlr::RefAST n( c.get() );
46
 
        antlr::BaseAST::addChild (n);
47
 
    }
48
 
 
49
 
    RefAdaAST down () const {
50
 
        return RefAdaAST (antlr::BaseAST::getFirstChild ());
51
 
    }
52
 
 
53
 
    RefAdaAST right () const {
54
 
        return RefAdaAST (antlr::BaseAST::getNextSibling ());
55
 
    }
56
 
 
57
 
    /* bool equals(RefAdaAST t) const {
58
 
        return ((antlr::BaseAST*)this)->equals (t);
59
 
    } */
60
 
 
61
 
    static antlr::RefAST factory (void) {
62
 
      RefAdaAST n( new AdaAST );
63
 
      return n.get();
64
 
    }
65
 
 
66
 
    static const RefAdaAST nullAdaAST;
67
 
 
68
 
private:
69
 
    int m_line;
70
 
    int m_column;
71
 
};
72
 
 
73
 
#define Set(n, t) (n)->set(t, #t)
74
 
// for Java compatibility:
75
 
#define boolean   bool
76
 
 
77
 
#endif