Package com.orange.wink.util

Examples of com.orange.wink.util.WinkJsFile


  /**
   * @param so
   */
  private static String getSource(final ScriptObject so) throws IOException {
    final WinkJsFile jf = new WinkJsFile(so.getSourceName(), so.getGlobalScope());
    final int ls = so.getLineStart();
    final int le = so.getLineEnd();
    final String lines = jf.getLinesAsString(ls, le);
    final String source = lines.substring(so.getCharStart(), so.getCharEnd());
    return source;
  }
View Full Code Here


      globalScope = scope;
    }
    if (Constants.optimDontKeepJsFile) {

    } else {
      jsFiles.add(new WinkJsFile(filename, scope));
    }

    scope.setSourceName(filename);
    scope.interpret();
  }
View Full Code Here

        }
      }

      if (!lt.isVirtual()) {
        FileObject fo = null;
        WinkJsFile jf = null;
        String ltSource;
        int linesSize = -1;

        try {
          if (Constants.optimDontKeepJsFile) {
            fo = FileManager.getFileObject(sourceName);
            if ((lt.getLineEnd() == -1)) {
              linesSize = fo.getLines().size();
            }
          } else {
            jf = getJsFile(sourceName);
            if ((lt.getLineEnd() == -1)) {
              linesSize = jf.getLines().size();
            }
          }

          final int lns = (lt.getLineStart() == -1) ? 1 : lt.getLineStart();
          final int lne = (lt.getLineEnd() == -1) ? linesSize : lt.getLineEnd();

          if (Constants.optimDontKeepJsFile) {
            ltSource = fo.getLinesAsString(lns, lne);
          } else {
            ltSource = jf.getLinesAsString(lns, lne);
          }

          ParserUtils.updateLiteralLines(lt, ltSource, lns);
          if (lt.getLineStart() == -1 || lt.getLineEnd() == -1) {
            throw new WinkParseException("Bad literal lines [" + lt.getNamespace() + "] identified (L:" + lt.getLineStart() + ", " + lt.getLineEnd() + ")");
          }

          String las;
          if (Constants.optimDontKeepJsFile) {
            las = fo.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          } else {
            las = jf.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          }
          ParserUtils.updateLiteralChars(lt, las);
        } catch (final IOException e) {
          throw new WinkParseException(e);
        }
View Full Code Here

  private void printSource(final ScriptObject o) throws WinkParseException {
    if (!(o instanceof FunctionObject || o instanceof LiteralObject)) {
      return;
    }
    if (!(o instanceof GlobalObject)) {
      WinkJsFile jf;
      FileObject fo;
      String lines, source;
      try {
        if (Constants.optimDontKeepJsFile) {
          fo = FileManager.getFileObject(o.getSourceName());
          lines = fo.getLinesAsString(o.getLineStart(), o.getLineEnd());
        } else {
          jf = getJsFile(o.getSourceName());
          lines = jf.getLinesAsString(o.getLineStart(), o.getLineEnd());
        }

        System.out.println("------------ " + o);
        if (!o.isVirtual()) {
          source = lines.substring(o.getCharStart(), o.getCharEnd());
View Full Code Here

    }
    for (final LiteralObject ltchild : ltChilds) {
      removeFromFile(ltchild);
    }

    final WinkJsFile jf = new WinkJsFile(so.getSourceName());
    try {
      // System.out.println("REMOVE: " + so.getNamespace());
      FileManager.removeInFile(jf.getFilename(), so.getLineStart(), so.getLineEnd(), so.getCharStart(), so.getCharEnd());
      so.setSourceActiveInFile(false);
    } catch (final IOException e) {
      throw new WinkBuildException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.orange.wink.util.WinkJsFile

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.