Package org.mozilla.javascript.tools

Examples of org.mozilla.javascript.tools.ToolErrorReporter


    private List<ErrorReporter> chainedReporters = new ArrayList<ErrorReporter>();

    ChainedErrorReporter(ErrorReporter chainedDefaultReporter) {
        chainedReporters.add(chainedDefaultReporter);
        chainedReporters.add(new ToolErrorReporter(true, System.err));
    }
View Full Code Here


      throw Kit.codeBug();
    }
  }
 
  public static void main(String[] args) {
    errorReporter = new ToolErrorReporter(false, global.getErr());
    shellContextFactory.setErrorReporter(errorReporter);
    IProxy iproxy = new IProxy(IProxy.PROCESS_FILES, processOptions(args));
    global.init(shellContextFactory);
    shellContextFactory.call(iproxy);
  }
View Full Code Here

        reader.setHistory(new History(history));
        PrintStream out = System.out;
        int lineno = 0;
        repl: while (true) {
            Context cx = engine.getContextFactory().enterContext(null);
            cx.setErrorReporter(new ToolErrorReporter(false, System.err));
            String source = "";
            String prompt = getPrompt();
            while (true) {
                String newline = reader.readLine(prompt);
                if (newline == null) {
View Full Code Here

    private void runSilently() throws IOException {
        int lineno = 0;
        outer: while (true) {
            Context cx = engine.getContextFactory().enterContext(null);
            cx.setErrorReporter(new ToolErrorReporter(false, System.err));
            String source = "";
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                String line = reader.readLine();
                if (line == null) {
View Full Code Here

        }
    }

    public Main()
    {
        reporter = new ToolErrorReporter(true);
        compilerEnv = new CompilerEnvirons();
        compilerEnv.setErrorReporter(reporter);
        compiler = new ClassCompiler(compilerEnv);
    }
View Full Code Here

        int status = self.exec(args);
        System.exit(status);
    }

    private int exec(String[] args) {
        R = new ToolErrorReporter(true, System.err);

        int arg_count = process_options(args);

        if (arg_count == 0) {
            option_error(ToolErrorReporter.getMessage(
View Full Code Here

    /**
     *  Execute the given arguments, but don't System.exit at the end.
     */
    public static int exec(String origArgs[])
    {
        errorReporter = new ToolErrorReporter(false, global.getErr());
        shellContextFactory.setErrorReporter(errorReporter);
        String[] args = processOptions(origArgs);
        if (processStdin) {
            fileList.add(null);
        }
View Full Code Here

        ByteArrayOutputStream err = new ByteArrayOutputStream();
        this.setOut(new PrintStream(out));
        this.setErr(new PrintStream(err));
        String resultString = "";
        ErrorReporter savedErrorReporter = cx.getErrorReporter();
        cx.setErrorReporter(new ToolErrorReporter(false, this.getErr()));
        try {
            testCount++;
          Object result = cx.evaluateString(scope, inputString,
                          "doctest input", 1, null);
              if (result != Context.getUndefinedValue() &&
View Full Code Here

        }
        if (engine.isPolicyEnabled()) {
            cx.setInstructionObserverThreshold(instructionLimit);
            cx.setSecurityController(new PolicySecurityController());
        }
        cx.setErrorReporter(new ToolErrorReporter(true));
        cx.setGeneratingDebug(generatingDebug);
    }
View Full Code Here

        ModuleScope module = new ModuleScope(moduleName, resource, prototype, worker);
        // put module scope in map right away to make circular dependencies work
        worker.registerModule(resource, module);
        // warnings are disabled in shell - enable warnings for module loading
        ErrorReporter er = cx.getErrorReporter();
        ToolErrorReporter reporter = er instanceof ToolErrorReporter ?
                (ToolErrorReporter) er : null;
        if (reporter != null && !reporter.isReportingWarnings()) {
            try {
                reporter.setIsReportingWarnings(true);
                script.exec(cx, module);
            } finally {
                reporter.setIsReportingWarnings(false);
            }
        } else {
            script.exec(cx, module);
        }
        // Update exports in case module updated module.exports
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.tools.ToolErrorReporter

Copyright © 2018 www.massapicom. 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.