Package org.spoofax.interpreter.terms

Examples of org.spoofax.interpreter.terms.IStrategoTerm


      processNamespaceDecl(toplevelDecl);
      return Collections.emptyList();
    }

    // Nothing to do here for prolog
    IStrategoTerm dec = toplevelDecl;

    // TODO: Implement reexport handling in a more sensible way
    if (isApplication(dec, "ModuleReexport"))
      imports.add(prettyPrint(dec));
    else
View Full Code Here


    return Collections.emptyList();
  }

  private IStrategoTerm initializePrettyPrinter(Context ctx) {
    if (pptable == null) {
      IStrategoTerm pptable_file = ATermCommands.makeString(getPrettyPrint().getAbsolutePath());
      pptable = parse_pptable_file_0_0.instance.invoke(org.strategoxt.stratego_gpp.stratego_gpp.init(), pptable_file);
    }

    return pptable;
  }
View Full Code Here

    return pptable;
  }

  public String prettyPrint(IStrategoTerm term) {
    IStrategoTerm ppTable = initializePrettyPrinter(interp.getCompiledContext());
    return ATermCommands.prettyPrint(ppTable, term, interp);
  }
View Full Code Here

    return false;
  }

  @Override
  public IStrategoTerm getExtensionBody(IStrategoTerm decl) {
    IStrategoTerm sugarBody = getApplicationSubterm(decl, "ExtensionBody", 0);
 
    return sugarBody;
 
  }
View Full Code Here

    if (getLanguage().isNamespaceDec(toplevelDecl)) {
      processNamespaceDecl(toplevelDecl);
      return Collections.emptyList();
    }
   
    IStrategoTerm term = getApplicationSubterm(toplevelDecl, "HaskellBody", 0);
    String text = null;
    try {
      text = prettyPrint(term);
    } catch (NullPointerException e) {
      ATermCommands.setErrorMessage(toplevelDecl, "pretty printing Haskell failed");
View Full Code Here

    if (getLanguage().isNamespaceDec(toplevelDecl)) {
      processNamespaceDecl(toplevelDecl);
      return Collections.emptyList();
    }

    IStrategoTerm dec = isApplication(toplevelDecl, "JavaTypeDec") ? getApplicationSubterm(toplevelDecl, "JavaTypeDec", 0) : toplevelDecl;

    String decName = Term.asJavaString(dec.getSubterm(0).getSubterm(1).getSubterm(0));
    String expectedDecName = FileCommands.fileName(javaOutFile);
    if (expectedDecName != null && !expectedDecName.equals(decName))
      throw new RuntimeException("Declaration name '" + decName + "'" + " does not match the file name '" + expectedDecName + "'.");

    body.add(prettyPrint(dec));
View Full Code Here

    return modulePath;
  }
 
  @Override
  public String getImportLocalName(IStrategoTerm decl) {
    IStrategoTerm opt = null;
    if (isApplication(decl, "TransImportDec"))
      opt = getApplicationSubterm(decl, "TransImportDec", 0);
    else if (isApplication(decl, "TypeImportAsDec"))
      opt = getApplicationSubterm(decl, "TypeImportAsDec", 0);
   
View Full Code Here

    return null;
  }
 
  @Override
  public IStrategoTerm reconstructImport(String modulePath, IStrategoTerm decl) {
    IStrategoTerm localName = null;
    if (isApplication(decl, "TransImportDec"))
      localName = getApplicationSubterm(decl, "TransImportDec", 0);
    else if (isApplication(decl, "TypeImportAsDec"))
      localName = getApplicationSubterm(decl, "TypeImportAsDec", 0);
   
View Full Code Here

    imports.add(prettyPrint(toplevelDecl));
  }

  @Override
  public String getExtensionName(IStrategoTerm decl) throws IOException {
    IStrategoTerm head = getApplicationSubterm(decl, "ExtensionDec", 0);
    String extName = prettyPrint(getApplicationSubterm(head, "ExtensionDecHead", 1));
    return extName;
  }
View Full Code Here

    }
  }

  @Override
  public IStrategoTerm getExtensionBody(IStrategoTerm decl) {
    IStrategoTerm body = getApplicationSubterm(decl, "ExtensionDec", 1);
    IStrategoTerm sugarBody = getApplicationSubterm(body, "ExtensionBody", 0);
    return sugarBody;
  }
View Full Code Here

TOP

Related Classes of org.spoofax.interpreter.terms.IStrategoTerm

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.