-
Notifications
You must be signed in to change notification settings - Fork 0
/
sli_nametype.cpp
43 lines (36 loc) · 1001 Bytes
/
sli_nametype.cpp
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
#include "sli_nametype.h"
#include "sli_name.h"
#include "sli_token.h"
#include "sli_interpreter.h"
namespace sli3
{
void NameType::execute(Token &t)
{
sli_->EStack().top()=sli_->lookup(Name(t.data_.long_val));
}
bool LiteralType::compare(const Token&t1, const Token&t2) const
{
if(t1.type_ != t2.type_)
return false;
return t1.data_.name_val == t2.data_.name_val;
}
std::ostream & NameType::print(std::ostream& out, const Token &t) const
{
Name myname(t.data_.name_val);
return out << myname.toString();
}
std::ostream & MarkType::print(std::ostream& out, const Token &) const
{
return out << "mark";
}
std::ostream & LiteralType::print(std::ostream& out, const Token &t) const
{
Name myname(t.data_.name_val);
return out << '/'<< myname.toString();
}
std::ostream & SymbolType::print(std::ostream& out, const Token &t) const
{
Name myname(t.data_.name_val);
return out << "//"<< myname.toString();
}
}