Examples of CompilerEnvirons


Examples of org.mozilla.javascript.CompilerEnvirons

        return script;
    }

    private AstRoot parseAsReader(String string) throws IOException {
        CompilerEnvirons environment = new CompilerEnvirons();

        TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
        environment.setErrorReporter(testErrorReporter);

        environment.setRecordingComments(true);
        environment.setRecordingLocalJsDocComments(true);

        Parser p = new Parser(environment, testErrorReporter);
        AstRoot script = p.parse(new StringReader(string), null, 0);

        assertTrue(testErrorReporter.hasEncounteredAllErrors());
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

   * @throws EvaluatorException - Fatal exception thrown while
   * parsing JavaScript source
   */
  protected void parse() throws EvaluatorException {
    // Parse script source
    CompilerEnvirons ce = new CompilerEnvirons();
    ScriptParserErrorReporter errorReporter = new ScriptParserErrorReporter();
   
    ce.setGenerateDebugInfo(true);   
    ce.initFromContext(ContextFactory.getGlobal().enterContext());
    ce.setErrorReporter(errorReporter);
   
    Parser p = new Parser(ce, errorReporter);
    ScriptOrFnNode ast = p.parse(this.scriptSource, "script", 0);
   
    searchAstForNodes(ast);
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

public class ArrayLiteralTest {
 
  private static ArrayLiteral getLiteralNode(String literalStr) throws InvalidLiteralNode {
    String scriptSource = "var lit = " + literalStr;
   
    CompilerEnvirons ce = new CompilerEnvirons();
    ScriptParserErrorReporter errorReporter = new ScriptParserErrorReporter();
   
    ce.setGenerateDebugInfo(true);   
    ce.initFromContext(ContextFactory.getGlobal().enterContext());
    ce.setErrorReporter(errorReporter);
   
    Parser p = new Parser(ce, errorReporter);
    ScriptOrFnNode ast = p.parse(scriptSource, "script", 0);
   
    return new ArrayLiteral(ast.getFirstChild().getFirstChild().getFirstChild());
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

  }
 
 
  protected void parse() throws EvaluatorException {
    // Parse script source
    CompilerEnvirons ce = new CompilerEnvirons();
    ScriptParserErrorReporter errorReporter = new ScriptParserErrorReporter();
   
    ce.setGenerateDebugInfo(true);   
    ce.initFromContext(ContextFactory.getGlobal().enterContext());
    ce.setErrorReporter(errorReporter);
   
    Parser p = new Parser(ce, errorReporter);
    ScriptOrFnNode ast = p.parse(this.scriptSource, "script", 0);
   
    recursiveParse(ast);
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

public class ObjectLiteralTest {
 
  private static ObjectLiteral getLiteralNode(String literalStr) throws InvalidLiteralNode {
    String scriptSource = "var lit = " + literalStr;
   
    CompilerEnvirons ce = new CompilerEnvirons();
    ScriptParserErrorReporter errorReporter = new ScriptParserErrorReporter();
   
    ce.setGenerateDebugInfo(true);   
    ce.initFromContext(ContextFactory.getGlobal().enterContext());
    ce.setErrorReporter(errorReporter);
   
    Parser p = new Parser(ce, errorReporter);
    ScriptOrFnNode ast = p.parse(scriptSource, "script", 0);
   
    return new ObjectLiteral(ast.getFirstChild().getFirstChild().getFirstChild());
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    private AstRoot parse(String string) {
        return parse(string, true);   
    }

    private AstRoot parse(String string, boolean jsdoc) {
        CompilerEnvirons environment = new CompilerEnvirons();

        TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
        environment.setErrorReporter(testErrorReporter);

        environment.setRecordingComments(true);
        environment.setRecordingLocalJsDocComments(jsdoc);

        Parser p = new Parser(environment, testErrorReporter);
        AstRoot script = p.parse(string, null, 0);

        assertTrue(testErrorReporter.hasEncounteredAllErrors());
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

        return script;
    }

    private AstRoot parseAsReader(String string) throws IOException {
        CompilerEnvirons environment = new CompilerEnvirons();

        TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
        environment.setErrorReporter(testErrorReporter);

        environment.setRecordingComments(true);
        environment.setRecordingLocalJsDocComments(true);

        Parser p = new Parser(environment, testErrorReporter);
        AstRoot script = p.parse(new StringReader(string), null, 0);

        assertTrue(testErrorReporter.hasEncounteredAllErrors());
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

  private void scan(final File source) throws IOException {
    log.debug("Scanning: " + source);

    ErrorReporter errorReporter = new LogErrorReporter(log);

    CompilerEnvirons env = new CompilerEnvirons();
    env.setErrorReporter(errorReporter);

    Parser parser = new Parser(env, errorReporter);
    Reader reader = new BufferedReader(new FileReader(source));
    try {
      AstRoot root = parser.parse(reader, source.getAbsolutePath(), 0);
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    @Test
    public void shouldServeInstrumentedJSForWebServer() throws IOException {
        File wwwRoot = new File("wwwRoot");
        ReflectionUtils.setField(webServer, HttpServer.class, "wwwRoot", wwwRoot);
        CompilerEnvirons compilerEnvirons = new CompilerEnvirons();
        given(configuration.getCompilerEnvirons()).willReturn(compilerEnvirons);
        given(configuration.skipInstrumentation("/js/production.js")).willReturn(false);

        webServer.handleGet(new HttpRequest("/js/production.js", null, null, 0, null));
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    @Test
    public void shouldRecordInstrumentedURIsForWebServer() throws IOException {
        given(configuration.isIncludeUnloadedJS()).willReturn(true);
        File wwwRoot = new File("wwwRoot");
        ReflectionUtils.setField(webServer, HttpServer.class, "wwwRoot", wwwRoot);
        CompilerEnvirons compilerEnvirons = new CompilerEnvirons();
        given(configuration.getCompilerEnvirons()).willReturn(compilerEnvirons);
        given(configuration.skipInstrumentation("/js/production.js")).willReturn(false);

        webServer.handleGet(new HttpRequest("/js/production.js", null, null, 0, null));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.