Esempio n. 1
0
        static IListSource <Token> Lex(string str)
        {
            var b = new CalculatorLexer(str).Buffered();
            var _ = b.Count;                    // force immediate lexing

            return(b);
        }
Esempio n. 2
0
        static IListSource <Token> Lex(string str)
        {
            var b = new CalculatorLexer(str).Buffered();
            var _ = b.Count;

            return(b);
        }
Esempio n. 3
0
        public static double Calculate(string input)
        {
            var   lexer  = new CalculatorLexer(input);
            Token EOF    = new Token((int)TT.EOF, input.Length, 0);
            var   parser = new Calculator {
                Src = new ParserSource <Token>(lexer, EOF, lexer.SourceFile)
            };

            return(parser.Expr());
        }