Implemented lexer
This commit is contained in:
parent
cb809bfd29
commit
ea26acce4a
34 changed files with 641 additions and 0 deletions
28
Compiler/Token.cs
Normal file
28
Compiler/Token.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
public class Token
|
||||
{
|
||||
public TokenType TokenType { get; set; }
|
||||
public String Value { get; set; }
|
||||
public int Length { get; set; }
|
||||
|
||||
public Token(TokenType pTokenType)
|
||||
{
|
||||
this.TokenType = pTokenType;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (Value == null)
|
||||
{
|
||||
return TokenType.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return TokenType.ToString() + ":" + Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue