Пример #1
0
        public TokenBuffer(Lexer lexer, int size)
        {
            this.lexer = lexer;
            tokenQueue = new List<Token>();

            // init queue
            for (int i = 0; i < size; i++)
            {
                Token token = NextToken();
                if (token == null)
                {
                    break;
                }
                tokenQueue.Add(token);
            }
        }
Пример #2
0
 public Parser(Lexer lexer)
 {
     lookAheadBuffer = new TokenBuffer(lexer, 3);
 }
Пример #3
0
        /**
         * Evaluate script
         *
         * @param stream The stream that contains the script
         * @return The exit status
         * @throws IOException
         */
        public JavaScriptObject Execute(Stream stream)
        {
            foreach (Function customFunction in CustomFunctions)
            {
                this.scope.SetFunction(customFunction);
            }

            Lexer lexer = new Lexer(stream);
            Parser parser = new Parser(lexer);
            ScriptExecutable executable = parser.Parse();
            return executable.Run(scope);
        }
Пример #4
0
 public Parser(Lexer lexer)
 {
     lookAheadBuffer = new TokenBuffer(lexer, 3);
 }