Examples of StandardTextWriter


Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

      Type type = result.getType();
     
      if (type.isAbstractData() && type.isSubtypeOf(Factory.Tree)) {
        content = type.toString() + ": `" + TreeAdapter.yield((IConstructor) value, 1000) + "`\n";
       
        StandardTextWriter stw = new StandardTextWriter(false);
        LimitedResultWriter lros = new LimitedResultWriter(1000);
        try{
          stw.write(value, lros);
        }catch(IOLimitReachedException iolrex){
          // This is fine, ignore.
        }catch(IOException ioex){
          // This can never happen.
        }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

    return "Not a rascal exception: " + e.toString();
  }

  public static String throwMessage(Throw e) {
    LimitedResultWriter lros = new LimitedResultWriter(1000);
    StandardTextWriter stw = new StandardTextWriter(false);
    try {
      stw.write(e.getException(), lros);
    }
    catch(IOLimitReachedException iolrex){
      // This is fine, ignore.
    }
    catch(IOException ioex){
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

    loc = rex.resolveSourceLocation(loc);

    OutputStream out = null;
    try{
      out = rex.getResolverRegistry().getOutputStream(loc.getURI(), false);
      new StandardTextWriter().write(value, new OutputStreamWriter(out, "UTF8"));
    }
    catch(IOException e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }
    finally {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

  public String toString(){
    return getType().toString() + ": " + value.toString();
  }
 
  public String toString(int length){
    StandardTextWriter stw = new StandardTextWriter(true);
    LimitedResultWriter lros = new LimitedResultWriter(length);
   
    try {
      stw.write(getValue(), lros);
    }
    catch (IOLimitReachedException iolrex){
      // This is fine, ignore.
    }
    catch (IOException ioex) {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

      currentOutStream.flush();
    }
  }
 
  public void iprint(IValue arg, IEvaluatorContext eval){
    StandardTextWriter w = new StandardTextWriter(true, 2);
   
    try {
      w.write(arg, eval.getStdOut());
    }
    catch (IOException e) {
      RuntimeExceptionFactory.io(values.string("Could not print indented value"), eval.getCurrentAST(), eval.getStackTrace());
    }
    finally{
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

      eval.getStdOut().flush();
    }
  }
 
  public void iprintToFile(ISourceLocation sloc, IValue arg, IEvaluatorContext eval) {
    StandardTextWriter w = new StandardTextWriter(true, 2);
    StringWriter sw = new StringWriter();

    try {
      w.write(arg, sw);
      writeFile(sloc, values.list(values.string(sw.toString())), eval);
    } catch (IOException e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), eval.getCurrentAST(), null);   
    }
  }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), eval.getCurrentAST(), null);   
    }
  }
 
  public void iprintln(IValue arg, IEvaluatorContext eval){
    StandardTextWriter w = new StandardTextWriter(true, 2);
   
    try {
      w.write(arg, eval.getStdOut());
      eval.getStdOut().println();
    }
    catch (IOException e) {
      RuntimeExceptionFactory.io(values.string("Could not print indented value"), eval.getCurrentAST(), eval.getStackTrace());
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

  }

  private IValue itoStringValue(IValue T)
  //@doc{toString -- convert a node to a string}
  {
    StandardTextWriter w = new StandardTextWriter(true, 2);
    StringWriter result = new StringWriter();
    try {
      w.write(T, result);
      return values.string(result.toString());
    }
    catch (IOException e) {
      RuntimeExceptionFactory.io(values.string("Could not convert list to indented value"), null, null);
      throw new RuntimeException("previous command should always throw");
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.io.StandardTextWriter

    loc = ctx.getHeap().resolveSourceLocation(loc);
   
    OutputStream out = null;
    try{
      out = ctx.getResolverRegistry().getOutputStream(loc.getURI(), false);
      new StandardTextWriter().write(value, new OutputStreamWriter(out, "UTF8"));
    }
     catch(IOException e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }
    finally {
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.