Package org.eclipse.imp.pdb.facts.io

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


  public static TypeStore getStore() {
    return errors;
  }
 
  public INode readSummary(InputStream stream) throws FactTypeUseException, IOException {
    ATermReader reader = new ATermReader();
    return (INode) reader.read(vf, Summary, stream);
  }
View Full Code Here


    Type start = new TypeReifier(ctx.getValueFactory()).valueToType((IConstructor) type, store);
   
    InputStream in = null;
    try{
      in = ctx.getResolverRegistry().getInputStream(loc.getURI());
      return new ATermReader().read(values, store, start, in);
    }catch(IOException e){
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }finally{
      if(in != null){
        try{
View Full Code Here

    }
  }
 
  public IValue readATermFromFile(IString fileName){
  //@doc{readATermFromFile -- read an ATerm from a named file}
    ATermReader atr = new ATermReader();
    try {
      FileInputStream stream = new FileInputStream(fileName.getValue());
      IValue result = atr.read(values, stream);
      stream.close();
      return result;
    } catch (FactTypeUseException e) {
      e.printStackTrace();
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
View Full Code Here

    return values.node(N.getValue(), args, map);
  }
 
  public IValue readATermFromFile(IString fileName){
  //@doc{readATermFromFile -- read an ATerm from a named file}
    ATermReader atr = new ATermReader();
    try {
      FileInputStream stream = new FileInputStream(fileName.getValue());
      IValue result = atr.read(values, stream);
      stream.close();
      return result;
    } catch (FactTypeUseException e) {
      e.printStackTrace();
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
View Full Code Here

  private static IValue name(String n) {
    return vf.constructor(NameNode, vf.string(n));
  }
 
  public void testATermReader() {
    ATermReader testReader = new ATermReader();
   
   
   
    try {
      for (int i = 0; i < testATerm.length; i++) {
        IValue result = testReader.read(vf, ts, Boolean, new ByteArrayInputStream(testATerm[i].getBytes()));
        System.err.println(testATerm[i] + " -> " + result);
       
        if (!result.isEqual(testValues[i])) {
          fail(testATerm[i] + " did not parse correctly: " + result + " != " + testValues[i]);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.io.ATermReader

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.