Пример #1
0
 public Token(TokenType type, double nv, LState ls)
 {
     Type        = type;
     StringValue = "";
     NumberValue = nv;
     Row         = ls.Row;
     Column      = ls.Column;
 }
Пример #2
0
 public Token(TokenType type, string sv, LState ls)
 {
     Type        = type;
     StringValue = sv;
     NumberValue = 0d;
     Row         = ls.Row;
     Column      = ls.Column;
 }
Пример #3
0
        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();
        }
Пример #4
0
 public Lexer(LState ls)
 {
     lState = ls;
 }