Package org.sugarj.common.path

Examples of org.sugarj.common.path.Path


    if (sdfCache == null)
      return tbl;
   
    log.beginTask("Caching", "Cache parse table", Log.CACHING);
    try {
      Path cacheTbl = environment.createCachePath(tbl.getFile().getName());
      FileCommands.copyFile(tbl, cacheTbl);
     
      Path oldTbl = sdfCache.putGet(key, cacheTbl);
      FileCommands.delete(oldTbl);

      log.log("Cache Location: " + cacheTbl, Log.CACHING);
      return cacheTbl;
    } finally {
View Full Code Here


  private static Path lookupGrammarInCache(ModuleKeyCache<Path> sdfCache, ModuleKey key) {
    if (sdfCache == null)
      return null;
   
    Path result = null;
   
    log.beginTask("Searching", "Search parse table in cache", Log.CACHING);
    try {
      result = sdfCache.get(key);
     
      if (result == null || !result.getFile().exists()) {
        result = null;
        return null;
      }

      log.log("Cache location: '" + result + "'", Log.CACHING);
View Full Code Here

                                         Environment environment,
                                         AbstractBaseLanguage baseLang)
      throws IOException, InvalidParseTableException {
    log.beginTask("Generating", "Generate the parse table", Log.PARSE);
    try {
      Path tblFile = null;
     
      tblFile = FileCommands.newTempFile("tbl");

      Path def = FileCommands.newTempFile("def");
      packSdf(sdf, def, paths, sdfCache, environment, baseLang);
      sdf2Table(def, tblFile, module);
      FileCommands.deleteTempFiles(def);
      return tblFile;
    } finally {
View Full Code Here

      log.endTask();
    }
  }
 
  public static String makePermissiveSdf(String source) throws IOException {
    Path def = FileCommands.newTempFile("def");
    Path permissiveDef = FileCommands.newTempFile("def-permissive");
   
    FileCommands.writeToFile(def, sdfToDef(source));
    makePermissive(def, permissiveDef);
   
    String s = defToSdf(FileCommands.readFileAsString(permissiveDef)); // drop "definition\n"
View Full Code Here

    }
    finally {
      if (result != null && result.b != null)
        log.endTask();
      else {
        Path tmpSourceFile = FileCommands.newTempFile("");
        FileCommands.writeToFile(tmpSourceFile, source.toString());
        log.endTask("failed: " +
            log.commandLineAsString(new String[] {"jsglri", "-p", tbl == null ? "unknown" : tbl.getAbsolutePath(), "-i " + tmpSourceFile + "-s", start}));
      }
    }
View Full Code Here

                                                          InvalidParseTableException,
                                                          TokenExpectedException,
                                                          BadTokenException,
                                                          SGLRException {
    ModuleKey key = getModuleKeyForAssimilation(str, main, dependentFiles, strParser);
    Path prog = lookupAssimilationInCache(strCache, key);
    StrategoException error = null;
   
    if (prog == null) {
      try {
        prog = generateAssimilator(key, str, main, environment.getIncludePath(), baseProcessor);
View Full Code Here

                                          List<Path> paths,
                                          AbstractBaseProcessor baseProcessor) throws IOException {
    boolean success = false;
    log.beginTask("Generating", "Generate the assimilator", Log.TRANSFORM);
    try {
      Path prog = FileCommands.newTempFile("ctree");
      log.log("calling STRJ", Log.TRANSFORM);
      strj(true, str, prog, main, paths, baseProcessor);
      success = FileCommands.exists(prog);
      return prog;
    } finally {
View Full Code Here

      return prog;
   

    log.beginTask("Caching", "Cache assimilator", Log.CACHING);
    try {
      Path cacheProg = environment.createCachePath(prog.getFile().getName());
      if (FileCommands.exists(prog))
        FileCommands.copyFile(prog, cacheProg);
      else
        cacheProg = prog;
     
      Path oldProg = strCache.putGet(key, cacheProg);
//      FileCommands.delete(oldProg);

      log.log("Cache Location: " + cacheProg, Log.CACHING);
      return cacheProg;
    } finally {
View Full Code Here

 
  private static Path lookupAssimilationInCache(ModuleKeyCache<Path> strCache, ModuleKey key) {
    if (strCache == null)
      return null;
   
    Path result = null;
   
    log.beginTask("Searching", "Search assimilator in cache", Log.CACHING);
    try {
      result = strCache.get(key);
     
      if (result == null || !result.getFile().exists())
        return null;

      log.log("Cache location: '" + result + "'", Log.CACHING);
     
      return result;
View Full Code Here

            modelDeps.contains(p) ||
            transDeps.contains(p);
        Result pRes = null;
        if (!ok) {
          // transformations may generate other artifacts, given that their dependencies in turn are marked in the current result
          Path dep = new AbsolutePath(FileCommands.dropExtension(p.getAbsolutePath()) + ".dep");
          if (FileCommands.exists(dep)) {
            pRes = Result.readDependencyFile(dep);
            if (pRes != null && pRes.isGenerated()) {
              boolean isContained = transformedModelDeps.containsAll(pRes.getCircularFileDependencies(environment));
              ok = isContained;
View Full Code Here

TOP

Related Classes of org.sugarj.common.path.Path

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.