Package org.mozilla.javascript

Examples of org.mozilla.javascript.ErrorReporter


    private static Parser createParser() {
        CompilerEnvirons env = new CompilerEnvirons();
        env.setIdeMode(true);
        env.setRecoverFromErrors(true);
        env.setStrictMode(false);
        env.setErrorReporter(new ErrorReporter() {

            public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) {
            }

            public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) {
View Full Code Here


                    if (type.equalsIgnoreCase("js")) {

                        try {

                            JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {

                                public void warning(String message, String sourceName,
                                        int line, String lineSource, int lineOffset) {
                                    if (line < 0) {
                                        System.err.println("\n[WARNING] " + message);
View Full Code Here

                            logger.getName()));
                }
            }
        };

        ErrorReporter errorReporter = new ErrorReporter()
        {
            private String format(String message, int line, int lineOffset)
            {
                if (line < 0)
                    return message;
View Full Code Here

                            logger.getName()));
                }
            }
        };

        ErrorReporter errorReporter = new ErrorReporter()
        {
            private String format(String message, int line, int lineOffset)
            {
                if (line < 0)
                    return message;
View Full Code Here

        srcChannel.close();
        dstChannel.close();
    }

    private JavaScriptCompressor createJavaScriptCompressor(final Reader in) throws IOException {
        final JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {

            public void error(final String message, final String sourceName, final int line, final String lineSource,
                    final int lineOffset) {
                log(getMessage(sourceName, message, line, lineOffset), Project.MSG_ERR);
            }
View Full Code Here

      }
     
        try {
         
            Optimizer builder = new Optimizer();
            ErrorReporter reporter = new DefaultErrorReporter(getLog(), true);
            builder.build( optimizeBuildDir, providePlugins, createBuildProfile(), reporter );
            moveModulesToOutputDir();

        } catch (RuntimeException exc) {
            throw exc;
View Full Code Here

import org.mozilla.javascript.tools.ToolErrorReporter;

public class JQueryScanner {

  public JQueryScanner(FileReader in) {
    final ErrorReporter reporter = new ToolErrorReporter(true);
    final CompilerEnvirons env = new CompilerEnvirons();
    final Parser parser = new Parser(env, reporter);

    try {
      parser.parse(in, null, 0);
View Full Code Here

    return out.toString();
  }
  public static String compressJS(Reader in) throws IOException{
    StringWriter out = new StringWriter();
    try {
      JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {
        public void warning(String message, String sourceName,
            int line, String lineSource, int lineOffset) {
          log.warn("[JAVASCRIPT COMPRESSOR WARN] in file : "+sourceName+"\n"+message+"\n"+line+":"+lineOffset);
        }
View Full Code Here

   * @param out the writer where the data must be written
   * @throws IOException
   */
  public static void compressJS(Reader in, Writer out) throws IOException{
    try {
      JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {
        public void warning(String message, String sourceName,
            int line, String lineSource, int lineOffset) {
          LOG.warn("[JAVASCRIPT COMPRESSOR WARN] in file : "+sourceName+"\n"+message+"\n"+line+":"+lineOffset);
        }

View Full Code Here

   * 创建JavaScript压缩器
   */
  public JSCompressor() {

    /** 创建向控制台进行错误输出的对象 */
    this.reporter = new ErrorReporter() {

      public void warning(String message, String sourceName, int line,
          String lineSource, int lineOffset) {
        if (line < 0) {
          System.err.println("\n[WARNING] " + message);
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ErrorReporter

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.