Search in sources :

Example 6 with Parser

use of com.github.anba.es6draft.parser.Parser in project es6draft by anba.

the class ScriptLoader method asyncGenerator.

/**
 * Parses and compiles the javascript async generator.
 *
 * @param source
 *            the script source descriptor
 * @param formals
 *            the formal parameters
 * @param bodyText
 *            the async generator body
 * @return the compiled async generator
 * @throws ParserException
 *             if the source contains any syntax errors
 * @throws CompilationException
 *             if the parsed source could not be compiled
 */
public CompiledFunction asyncGenerator(Source source, String formals, String bodyText) throws ParserException, CompilationException {
    Parser parser = new Parser(context, source);
    AsyncGeneratorDefinition asyncDef = parser.parseAsyncGenerator(formals, bodyText);
    return compile(asyncDef, nextFunctionName());
}
Also used : AsyncGeneratorDefinition(com.github.anba.es6draft.ast.AsyncGeneratorDefinition) Parser(com.github.anba.es6draft.parser.Parser)

Aggregations

Parser (com.github.anba.es6draft.parser.Parser)6 AsyncFunctionDefinition (com.github.anba.es6draft.ast.AsyncFunctionDefinition)2 AsyncGeneratorDefinition (com.github.anba.es6draft.ast.AsyncGeneratorDefinition)2 Script (com.github.anba.es6draft.Script)1 FunctionDefinition (com.github.anba.es6draft.ast.FunctionDefinition)1 GeneratorDefinition (com.github.anba.es6draft.ast.GeneratorDefinition)1 Realm (com.github.anba.es6draft.runtime.Realm)1 ScriptLoader (com.github.anba.es6draft.runtime.internal.ScriptLoader)1 Source (com.github.anba.es6draft.runtime.internal.Source)1 ModuleSource (com.github.anba.es6draft.runtime.modules.ModuleSource)1 StringModuleSource (com.github.anba.es6draft.runtime.modules.loader.StringModuleSource)1