-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproc.h
40 lines (35 loc) · 995 Bytes
/
proc.h
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
#line 703 "1_fn-gen.md"
#pragma once
#include "lex.h"
#include "mod.h"
#include "scope.h"
#include "type.h"
#include <iostream>
class Procedure: public Scoping {
public:
using Ptr = std::shared_ptr<Procedure>;
private:
bool exported_;
Type::Ptr return_type_;
Procedure(
std::string name, bool exported,
Type::Ptr return_type, Declaration::Ptr parent
);
static void parse_statements(Lexer &l, Procedure::Ptr p);
static void return_integer_value(Procedure::Ptr p, int value);
protected:
static Procedure::Ptr create(
std::string name, bool exported, Type::Ptr return_type,
Declaration::Ptr parent
);
public:
static Procedure::Ptr parse(Lexer &l, Declaration::Ptr parent);
static Procedure::Ptr parse_init(
Lexer &l, Declaration::Ptr parent
);
auto exported() const { return exported_; }
auto return_type() const { return return_type_; }
};
inline std::string quote(Procedure::Ptr proc) {
return "PROCEDURE " + quote(Declaration::name(proc));
}