Examples of CompilerEnvirons


Examples of org.mozilla.javascript.CompilerEnvirons

  public ScriptOrFnNode parse() throws IOException {

    if (nodeTree == null) {
      Reader reader = new FileReader(jsFile);

      CompilerEnvirons compilerEnv = new CompilerEnvirons();
      ErrorReporter errorReporter = compilerEnv.getErrorReporter();

      Parser parser = new Parser(compilerEnv, errorReporter);

      String sourceURI;
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    public static final String compressScript(String source, int indent, int lineno, boolean escapeUnicode, String stripConsole) {
      return compressScript(source, indent, lineno, escapeUnicode, stripConsole, null);
    }
       
    public static final String compressScript(String source, int indent, int lineno, boolean escapeUnicode, String stripConsole, StringBuffer debugData) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();

        Parser parser = new Parser(compilerEnv, compilerEnv.getErrorReporter());
       
        ScriptOrFnNode tree = parser.parse(source, null, lineno);
        String encodedSource = parser.getEncodedSource();
        if (encodedSource.length() == 0) { return ""; }
       
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

      compiler = new Codegen();
    }
    FileReader in = new FileReader(new File(baseDir, file));
    try {
      if (compilerEnv == null) {
        compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        compilerEnv.setOptimizationLevel(1);
        compilerEnv.setGeneratingSource(false);
      }
      if (compilationErrorReporter == null) {
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

         */
        protected ScriptNode compile(CharSequence source) {
            final String mainMethodClassName = "Main";
            final String scriptClassName = "Main";

            CompilerEnvirons compilerEnv = new CompilerEnvirons();
            compilerEnv.initFromContext(cx);
            ErrorReporter compilationErrorReporter = compilerEnv
                    .getErrorReporter();
            Parser p = new Parser(compilerEnv, compilationErrorReporter);
            AstRoot ast = p.parse(source.toString(), "<eval>", 1);
            IRFactory irf = new IRFactory(compilerEnv);
            ScriptNode tree = irf.transformTree(ast);
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    CompilerEnvirons environment;

    @Override
    protected void setUp() throws Exception {
      super.setUp();
      environment = new CompilerEnvirons();
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    public void tearDown() {
        Context.exit();
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    public void tearDown() {
        Context.exit();
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

     * @param expectedOutput the JavaScript source that is expected to be
     *                       returned by {@link AstRoot#toSource()}
     */
    private void assertSource(String source, String expectedOutput)
    {
        CompilerEnvirons env = new CompilerEnvirons();
        env.setLanguageVersion(Context.VERSION_1_7);
        Parser parser = new Parser(env);
        AstRoot root = parser.parse(source, null, 0);
        Assert.assertEquals(expectedOutput, root.toSource());
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    private Object eval(CharSequence cs) {
        return cx.evaluateString(scope, cs.toString(), "<eval>", 1, null);
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
View Full Code Here

Examples of org.mozilla.javascript.CompilerEnvirons

    public void tearDown() {
        Context.exit();
    }

    private AstRoot parse(CharSequence cs) {
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
        compilerEnv.initFromContext(cx);
        ErrorReporter compilationErrorReporter = compilerEnv.getErrorReporter();
        Parser p = new Parser(compilerEnv, compilationErrorReporter);
        return p.parse(cs.toString(), "<eval>", 1);
    }
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.