-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToken.cs
40 lines (36 loc) · 810 Bytes
/
Token.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Compiler
{
public record Token
{
public int Line { get; }
public TokenType Type { get; }
public string? TokenValue { get; }
public Token(string? tokenValue, TokenType type)
{
TokenValue = tokenValue ?? "NULL";
Type = type;
}
public override string ToString()
{
return $"Token '{TokenValue}' is a {Type}.";
}
}
public enum TokenType
{
Integer=1,
Float=2,
Identifier=3,
Operator=4,
Keyword=5,
Attributor=6,
TypeDeclaration=7,
Symbol=8,
Semicolon=9,
Relational=10
}
}