summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/ast.hh
blob: 1c3037c5543b09352141deda0b81e45459201aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
 ** \file ast/ast.hh
 ** \brief Declaration of ast::Ast.
 */

#pragma once

#include <ast/fwd.hh>
#include <ast/location.hh>

namespace ast
{
  /// Ast.
  class Ast
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /// Construct an Ast node.
    explicit Ast(const Location& location);
    Ast(const Ast&) = delete;
    Ast& operator=(const Ast&) = delete;
    /// Destroy an Ast node.
    virtual ~Ast() = default;
    /** \} */

    /// \name Visitors entry point.
    /// \{ */
    /// Accept a const visitor \a v.
    virtual void accept(ConstVisitor& v) const = 0;
    /// Accept a non-const visitor \a v.
    virtual void accept(Visitor& v) = 0;
    /// \}

    /** \name Accessors.
     ** \{ */
    /// Return scanner position information.
    const Location& location_get() const;
    /// Set scanner position information.
    void location_set(const Location&);
    /** \} */

  protected:
    /// Scanner position information.
    Location location_;
  };
} // namespace ast
#include <ast/ast.hxx>