tlang-interperter-cs/LexToken.cs

31 lines
806 B
C#

namespace tlang
{
internal class LexToken
{
private LexToken(string text)
{
Text = text;
}
public static LexToken FromGeneralToken(int c)
{
return new LexToken(((char)c).ToString());
}
public static LexToken FromGeneralToken(string text)
{
return new LexToken(text);
}
public static LexToken FromString(string text)
{
return new LexToken(text){IsString = true};
}
public static LexToken FromChar(string text)
{
return new LexToken(text){IsChar = true};
}
public bool IsString {get;private set;}=false;
public bool IsChar {get;private set;}=false;
public string Text {get;private set;}
}
}