Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81709 / JSCompiler.Core / Token.cs
blob: efa2dd8b35303e6c29011baf62e2ba5bed1c9555 (plain) (blame)
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JSCompiler.Core
{
    public class Token : IEquatable<Token>
    {
        public Token(TokenType type)
        {
            Type = type;
        }

        public TokenType Type { get; private set; }

        public override bool Equals(object obj)
        {
            var item = obj as Token;

            if(item == null)
            {
                return false;
            }

            return Equals(item);
        }

        public bool Equals(Token other)
        {
            return Type == other.Type;
        }

        public override int GetHashCode()
        {
            return this.Type.GetHashCode();
        }

        public override string ToString()
        {
            return ((char)Type).ToString();
        }
    }



}