-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsli_integertype.cpp
44 lines (35 loc) · 1003 Bytes
/
sli_integertype.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
44
#include "sli_integertype.h"
#include <iostream>
namespace sli3
{
bool IntegerType::compare(const Token&t1, const Token&t2) const
{
if(t1.type_ != t2.type_)
return false;
return t1.data_.long_val == t2.data_.long_val;
}
std::ostream & IntegerType::print(std::ostream&out, const Token &t) const
{
return out << t.data_.long_val;
}
bool DoubleType::compare(const Token&t1, const Token&t2) const
{
if(t1.type_ != t2.type_)
return false;
return t1.data_.double_val == t2.data_.double_val;
}
std::ostream & DoubleType::print(std::ostream&out, const Token &t) const
{
return out << t.data_.double_val;
}
bool BoolType::compare(const Token&t1, const Token&t2) const
{
if(t1.type_ != t2.type_)
return false;
return t1.data_.bool_val == t2.data_.bool_val;
}
std::ostream & BoolType::print(std::ostream&out, const Token &t) const
{
return (out <<( t.data_.bool_val ? "true":"false" ));
}
}