Package org.mozilla.javascript

Examples of org.mozilla.javascript.ErrorReporter


    public JavaScriptResourceMinimizer(final Logger logger, OperationTracker tracker)
    {
        super(logger, tracker, "JavaScript");

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


    try {
      // Initialize the standard objects (Object, Function, etc.)
      // This must be done before scripts can be executed. Returns
      // a scope object that we use in later calls.
      Scriptable scope = cx.initStandardObjects();
      cx.setErrorReporter(new ErrorReporter() {

        @Override
        public void warning(String arg0, String arg1, int arg2,
            String arg3, int arg4) {
          System.err.println(String.format("%s %s %s %s %s", arg0,
View Full Code Here

    try {
      Timer timer = new Timer();     
      // logger.debug( "Starting minification for '" + inputFilename + "'...");
      Reader in = new StringReader( input );
      JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {
        public void warning(String message, String sourceName,
            int line, String lineSource, int lineOffset) {
          if (line < 0) {
            logger.warn("Minifier Warning: " + message);
          } else {
View Full Code Here

        Optimizer converter = new Optimizer();
       
        //File moduleFile = getCommonModuleFile();
        File moduleFile = new File("/tmp/asdf.asdf");
        File amdFile = File.createTempFile("amdModule", "js");
        ErrorReporter reporter = new LoggerErrorReporter(LOG, true);
        converter.convertCommonJsModulesToAmdModules(moduleFile, amdFile, reporter);

        String result = readFile(amdFile);

        assertEquals(expectedAmdOutput, result);
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

    protected void doMinimize(StreamableResource resource, Writer output) throws IOException
    {
        final Set<Integer> errorLines = CollectionFactory.newSet();

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

   * Scan the given file for class definitions and accumulate dependencies.
   */
  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);
View Full Code Here

       
        return minifiedBytes;
    }
   
    protected ErrorReporter getLogBasedErrorReporter() {
        return new ErrorReporter() {
            @Override
            public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) {
                if (line < 0) {
                    LOG.warn(message);
                } else {
View Full Code Here

        int linebreakpos = yuiLineBreak;          //-1;
        boolean ycVerbose = yuiVerbose;            //false;
       
        // not generating a new error reporter each time
        //  its not using any closure in the loop so no point. this should be way faster
        if (reporter != null) reporter = new ErrorReporter() {           
            public void warning(String message, String sourceName,
                    int line, String lineSource, int lineOffset) {
              if (line < 0) message = line + ':' + lineOffset + ':' + message;
                System.err.println("\n[WARNING] " + message);
           
View Full Code Here

    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

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.