public Token(TokenType type, double nv, LState ls) { Type = type; StringValue = ""; NumberValue = nv; Row = ls.Row; Column = ls.Column; }
public Token(TokenType type, string sv, LState ls) { Type = type; StringValue = sv; NumberValue = 0d; Row = ls.Row; Column = ls.Column; }
static void Main(string[] args) { string source = File.ReadAllText("test.txt"); var sw = new Stopwatch(); sw.Start(); LState ls = new LState(source); Lexer lex = new Lexer(ls); while (lex.NotEnd()) { var tk = lex.NextToken(); Console.WriteLine(tk); } sw.Stop(); Console.WriteLine(sw.Elapsed.TotalSeconds); Console.ReadLine(); }
public Lexer(LState ls) { lState = ls; }