This repository was archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathparam.hpp
92 lines (67 loc) · 2.03 KB
/
param.hpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef SRC_AST_PARAM_HPP_
#define SRC_AST_PARAM_HPP_
#include <iostream>
#include <string>
#include <vector>
#include "../base/common.hpp"
#include "../location.hpp"
#include "expr.hpp"
#include "identifier.hpp"
#include "node.hpp"
#include "type.hpp"
class Param : public Node {
public:
explicit Param(const yy::location& loc) : Node{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "parameter";
};
class Params : public Nodes {
public:
explicit Params(const yy::location& loc) : Nodes{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "parameter list";
};
class FormalParam : public Param {
public:
explicit FormalParam(
const yy::location& loc, SPtr<Ids> p_ids, SPtr<Type> p_type)
: Param{loc}, p_ids_{p_ids}, p_type_{p_type} {}
void UpdateDepth(int depth) override;
void Print(std::ostream& os) const override;
std::string name() const override { return name_; }
private:
const std::string name_ = "formal parameter";
SPtr<Ids> p_ids_;
SPtr<Type> p_type_;
};
class FormalParams : public Params {
public:
explicit FormalParams(const yy::location& loc) : Params{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "formal parameter list";
};
class ActualParams : public Exprs {
public:
explicit ActualParams(const yy::location& loc) : Exprs{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "actual parameter list";
};
class ReadParams : public Lvalues {
public:
explicit ReadParams(const yy::location& loc) : Lvalues{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "read parameter list";
};
class WriteParams : public WriteExprs {
public:
explicit WriteParams(const yy::location& loc) : WriteExprs{loc} {}
std::string name() const override { return name_; }
private:
const std::string name_ = "write parameter list";
};
#endif // SRC_AST_PARAM_HPP_