Package org.sugarj.driver

Examples of org.sugarj.driver.Result


            }
             
            monitor.beginTask("compile " + input.sourceFile.getRelativePath(), IProgressMonitor.UNKNOWN);

            RelativePath depFile = new RelativePath(environment.getParseBin(), FileCommands.dropExtension(input.sourceFile.getRelativePath()) + ".dep");
            Result res = Result.readDependencyFile(depFile);
            if (res == null || !res.isUpToDate(input.sourceFile, environment))
              res = Driver.run(input.sourceFile, environment, monitor, input.baseLang);
           
            IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
            for (IWorkbenchWindow workbenchWindow : workbenchWindows)
              for (IWorkbenchPage page : workbenchWindow.getPages())
View Full Code Here


      for (final RelativePath sourceFile : allInputFiles) {
        AbstractBaseLanguage lang = BaseLanguageRegistry.getInstance().getBaseLanguage(FileCommands.getExtension(sourceFile));
        if (null == lang)
          throw new RuntimeException("Unknown file extension \"" + FileCommands.getExtension(sourceFile) + "\".");
       
        Result res = Driver.run(sourceFile, environment, monitor, lang);
   
        if (!DriverCLI.processResultCLI(res, sourceFile, new File(".").getAbsolutePath()))
          throw new RuntimeException("compilation of " + sourceFile + " failed");
      }
     
View Full Code Here

    RelativePath sourceFile = ModuleSystemCommands.locateSourceFile(filename, environment.getSourcePath());
    if (sourceFile == null)
      throw new IllegalArgumentException("Cannot find source file for path " + filename);
    this.sourceFile = sourceFile;
    String modulePath = FileCommands.dropExtension(sourceFile.getRelativePath());
    Result result = ModuleSystemCommands.locateResult(modulePath, environment);

    if (result == null)
      result = parseFailureResult(filename);

    if (input.contains(ContentProposerSemantic.COMPLETION_TOKEN) && result != null && result.getParseTable() != null)
      return parseCompletionTree(input, filename, result);
    if (result.getSugaredSyntaxTree() != null && result.isUpToDate(input.hashCode(), environment))
        return result.getSugaredSyntaxTree();
    if (result.hasFailed())
      return parseFailureResult(filename).getSugaredSyntaxTree();
   
    if (!isPending(sourceFile))
      scheduleParse(input, sourceFile);
   
    return result.getSugaredSyntaxTree() == null ? parseFailureResult(filename).getSugaredSyntaxTree() : result.getSugaredSyntaxTree();
  }
View Full Code Here

    this.environment = environment;
  }
 
  @Override
  public Set<org.spoofax.jsglr.shared.BadTokenException> getCollectedErrors() {
    Result result = ModuleSystemCommands.locateResult(FileCommands.dropExtension(sourceFile.getRelativePath()), environment);
    if (result == null)
      return Collections.emptySet();
   
    Set<org.spoofax.jsglr.shared.BadTokenException> res = new HashSet<org.spoofax.jsglr.shared.BadTokenException>();
    for (BadTokenException e : result.getParseErrors())
      res.add(new org.spoofax.jsglr.shared.BadTokenException(null, e.getToken(), e.getOffset(), e.getLineNumber(), e.getColumnNumber()));
    return res;
  }
View Full Code Here

  }


  public List<IStrategoTerm> getEditorServices() {
    final List<IStrategoTerm> empty = Collections.emptyList();
    Result result = ModuleSystemCommands.locateResult(FileCommands.dropExtension(sourceFile.getRelativePath()), environment);
    return result == null ? empty : new ArrayList<IStrategoTerm>(result.getEditorServices());
  }
View Full Code Here

    Tokenizer tokenizer = new Tokenizer(" ", " ", new KeywordRecognizer(pt) {});
    Token tok = tokenizer.makeToken(0, IToken.TK_UNKNOWN, true);
    IStrategoTerm term = ATermCommands.makeList("CompilationUnit", tok);
   
    Result r = new Result() {
      public boolean isUpToDate(int h, Environment env) { return false; }
    };
    r.setSugaredSyntaxTree(term);
    r.setDesugaredSyntaxTree(term);
    r.registerEditorDesugarings(new AbsolutePath(StdLib.failureTrans.getAbsolutePath()));
    return r;
  }
View Full Code Here

        driver.getCurrentResult().generateFile(source, ATermCommands.atermToString(generatedModel));
      } catch (IOException e) {
        driver.setErrorMessage(e.getLocalizedMessage());
      }
     
      Result res;
      try {
        res = driver.subcompile(driver.getTreeForErrorMarking(), source);
       
        if (res != null) {
          context.setCurrent(ATermCommands.atermFromFile(source.getAbsolutePath()));
         
          Result modelResult = ModuleSystemCommands.locateResult(FileCommands.dropExtension(modelPath), environment);
          if (modelResult != null)
            res.addDependency(modelResult);
          Result transformationResult = ModuleSystemCommands.locateResult(FileCommands.dropExtension(transformationPath.getRelativePath()), environment);
          if (transformationResult != null)
            res.addDependency(transformationResult);
        }
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

    String error = null;
   
    Log.log.beginTask("Check communication integrity", Log.CORE);
    try {
      Collection<Path> modelDeps = new HashSet<Path>();
      Result modelResult = ModuleSystemCommands.locateResult(FileCommands.dropExtension(modelPath), environment);
      if (modelResult != null) {
        modelDeps.addAll(modelResult.getCircularFileDependencies(environment));
        modelDeps.addAll(modelResult.getDirectlyGeneratedFiles());
      }
 
      Collection<Path> transDeps = new HashSet<Path>();
      Result transResult = ModuleSystemCommands.locateResult(FileCommands.dropExtension(transformationPath.getRelativePath()), environment);
      if (transResult != null) {
        transDeps.addAll(transResult.getCircularFileDependencies(environment));
        transDeps.addAll(transResult.getDirectlyGeneratedFiles());
      }
 
      if (res.getPersistentPath() == null)
        res.writeDependencyFile(FileCommands.newTempFile("dep"));
      Collection<Path> transformedModelDeps = res.getCircularFileDependencies(environment);
      TreeSet<String> failed = new TreeSet<String>();
     
      for (Path p : transformedModelDeps) {
        boolean ok = false ||
            source.equals(p) ||
            res.getDirectlyGeneratedFiles().contains(p) ||
            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;
            }
          }
        }
        if (!ok)
View Full Code Here

TOP

Related Classes of org.sugarj.driver.Result

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.