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); } }
public Parser(Lexer lexer) { lookAheadBuffer = new TokenBuffer(lexer, 3); }
/** * 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); }