-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathType.h
58 lines (50 loc) · 1.1 KB
/
Type.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "Token.h"
namespace lwscript
{
enum class TypeKind
{
I8,
U8,
I16,
U16,
I32,
U32,
I64,
U64,
F32,
F64,
BOOL,
CHAR,
STRING,
ANY,
UNDEFINED,
};
enum class TypeCategory
{
PRIMITIVE,
COMPOSITE
};
class Type
{
public:
Type() noexcept;
Type(STD_STRING_VIEW name, const SourceLocation &scl = {}) noexcept;
~Type() noexcept = default;
TypeKind GetKind() const noexcept;
bool Is(TypeCategory category) const noexcept;
bool IsNumeric() const noexcept;
bool IsInteger() const noexcept;
bool IsFloating() const noexcept;
bool IsBoolean() const noexcept;
bool IsString() const noexcept;
bool IsChar() const noexcept;
bool IsAny() const noexcept;
STD_STRING_VIEW GetName() const noexcept;
private:
STD_STRING_VIEW mName;
SourceLocation mSourceLocation;
TypeKind mKind;
TypeCategory mCategory;
};
};