tlang-interperter-cs/tlanglib/LexToken.cs

31 lines
804 B
C#
Raw Permalink Normal View History

2023-03-09 19:40:14 +00:00
namespace tlang
{
2023-03-10 04:33:58 +00:00
public class LexToken
2023-03-09 19:40:14 +00:00
{
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;}
}
}