Examples of IStrategoTerm


Examples of org.spoofax.interpreter.terms.IStrategoTerm

   *             and Stratego statements.
   * @param sdf result file
   * @throws InvalidParseTableException
   */
  public static IStrategoTerm extractSDF(IStrategoTerm term) throws IOException, InvalidParseTableException {
    IStrategoTerm result = null;
    Context extractContext = SugarJContexts.extractionContext();
    try {
      result = extract_sdf_0_0.instance.invoke(extractContext, term);
    }
    catch (StrategoExit e) {
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

    this.environment = environment;
  }

  @Override
  public boolean call(IContext context, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException {
    IStrategoTerm generatedModel = context.current();
   
    String modelPath = ATermCommands.getString(tvars[0]);
    RelativePath modelRelativePath = new RelativePath(modelPath);
   
    IStrategoTerm transformationsTerm = tvars[1];
    RelativePath transformationPath = new RelativePath(ATermCommands.getString(transformationsTerm));
   
    RelativePath source = ImportCommands.getTransformedModelSourceFilePath(modelRelativePath, transformationPath, environment);
   
    try {
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

    List<IStrategoTerm> sugaredImportDecls = null; // XXX

    if (sugaredImportDecls == null)
      return false;
   
    IStrategoTerm imports = ATermCommands.makeList("JavaImportDec*", sugaredImportDecls);
    context.setCurrent(imports);
    return true;
  }
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

  }

  @Override
  public boolean call(IContext context, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException {
    try {
      IStrategoTerm generatedModel = context.current();
     
      if (!ATermCommands.isString(tvars[0]) || !ATermCommands.isString(tvars[1]))
        return false;
     
      String modelPath = ATermCommands.getString(tvars[0]);
      RelativePath modelRelativePath = new RelativePath(modelPath);
     
      IStrategoTerm transformationsTerm = tvars[1];
      RelativePath transformationPath = new RelativePath(ATermCommands.getString(transformationsTerm));
     
      RelativePath source = ImportCommands.getTransformedModelSourceFilePath(modelRelativePath, transformationPath, environment);
     
      try {
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

   
    for (Renaming r : renamings) {
      List<IStrategoTerm> qualTerms = new LinkedList<IStrategoTerm>();
      for (String qual : r.pkgs)
        qualTerms.add(ATermCommands.makeString(qual));
      IStrategoTerm quals = ATermCommands.makeList("Qualifiers", qualTerms);
      IStrategoTerm from = ATermCommands.makeString(r.from);
      IStrategoTerm to = ATermCommands.makeString(r.to);
     
      if (!map.containsKey(from))
        map.put(from, to);
      if (!map.containsKey(ATermCommands.makeTuple(quals, from)))
      map.put(ATermCommands.makeTuple(quals, from), to);
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

    super("SUGARJ_aterm_to_string", 0, 0);
  }

  @Override
  public boolean call(IContext context, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException {
    IStrategoTerm term = context.current();
    String s = term.toString();
    context.setCurrent(ATermCommands.makeString(s));
    return true;
  }
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

    String name = driver.getBaseLanguage().getNamespace();
   
    if (name == null)
      return false;

    IStrategoTerm nameTerm = ATermCommands.makeString(name);
    context.setCurrent(nameTerm);
    return true;
  }
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

        // PARSE the next top-level declaration
        lastSugaredToplevelDecl = declProvider.getNextToplevelDecl(true, false);
       
        stepped();
       
        IStrategoTerm analyzed = currentAnalyze(lastSugaredToplevelDecl);
        analyzed = ATermCommands.copyTokens(lastSugaredToplevelDecl, analyzed);
        lastSugaredToplevelDecl = analyzed;
       
        stepped();
       
        // DESUGAR the parsed top-level declaration
        IStrategoTerm desugared = currentDesugar(analyzed);
       
        stepped();
       
        // RENAME the desugared top-level declaration
        IStrategoTerm renamed = currentRename(desugared);
       
        stepped();
       
        // PROCESS the assimilated top-level declaration
        processToplevelDeclaration(renamed);
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

        sugaredBodyDecls.add(lastSugaredToplevelDecl);
      if (!desugaredBodyDecls.contains(toplevelDecl))
        desugaredBodyDecls.add(toplevelDecl);


      IStrategoTerm head = getApplicationSubterm(toplevelDecl, "PlainDec", 0);
      IStrategoTerm body= getApplicationSubterm(toplevelDecl, "PlainDec", 1);
     
      String extName = ATermCommands.getString(getApplicationSubterm(head, "PlainDecHead", 1));
      checkModuleName(extName, toplevelDecl);

      String extension = null;
View Full Code Here

Examples of org.spoofax.interpreter.terms.IStrategoTerm

  public IStrategoTerm currentRename(IStrategoTerm term) throws IOException, InvalidParseTableException, TokenExpectedException, SGLRException {
    try {
      if (currentTransProg == null)
        return term;
     
      IStrategoTerm result = STRCommands.assimilate("apply-renamings", currentTransProg, term, baseProcessor.getInterpreter());
      return result == null ? term : result;
    } catch (StrategoException e) {
      String msg = e.getClass().getName() + " " + e.getLocalizedMessage() != null ? e.getLocalizedMessage() : e.toString();

      log.logErr(msg, Log.DETAIL);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.