tlang-interperter-cs/tlanglib/LexToken.cs

31 lines
804 B
C#

namespace tlang
{
public 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;}
}
}