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

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


   
    private Result<IValue> createVisitedDate(IEvaluator<Result<IValue>> eval, String datePart, org.rascalmpl.ast.JustDate.Lexical x) {
      try {
        datePart.replaceAll("-", "");

        StandardTextReader parser = new StandardTextReader();
        IValue result = parser.read(VF, new StringReader("$" + datePart));
        return makeResult(TF.dateTimeType(), result, eval);
      } catch (FactTypeUseException e) {
        throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
      } catch (FactParseError e) {
          throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
View Full Code Here


      return TF.dateTimeType();
    }
   
    public Result<IValue> createVisitedDateTime(IEvaluator<Result<IValue>> eval, String datePart, String timePart, Lexical x) {
      try {
        StandardTextReader parser = new StandardTextReader();
        IValue result = parser.read(VF, new StringReader("$" + datePart + "T" + timePart));
        return makeResult(TF.dateTimeType(), result, eval);
      } catch (FactTypeUseException e) {
        throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
      } catch (FactParseError e) {
        throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
View Full Code Here

    Type start = tr.valueToType((IConstructor) type, store);

    InputStream in = null;
    try{
      in = new BufferedInputStream(rex.getResolverRegistry().getInputStream(loc.getURI()));
      return new StandardTextReader().read(new RascalValuesValueFactory(), store, start, new InputStreamReader(in, "UTF8"));
    }catch(IOException e){
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }finally{
      if(in != null){
        try{
View Full Code Here

    //    }
    Type start = tr.valueToType((IConstructor) type, store);

    StringReader in = new StringReader(input.getValue());
    try {
      return new StandardTextReader().read(values, store, start, in);
    } catch (FactTypeUseException e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    } catch (IOException e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "a".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "appl(prod(sort(\"S\"),[\\char-class([range(97,122)])],{}),[char(97)])";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "a".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "amb({appl(prod(sort(\"S\"),[sort(\"B\")],{}),[amb({appl(prod(sort(\"B\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"B\"),[sort(\"A\")],{}),[amb({appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"A\"),[sort(\"B\")],{}),[cycle(sort(\"B\"),2)])})])})]),appl(prod(sort(\"S\"),[sort(\"A\")],{}),[amb({appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"A\"),[sort(\"B\")],{}),[amb({appl(prod(sort(\"B\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"B\"),[sort(\"A\")],{}),[cycle(sort(\"A\"),2)])})])})])})";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "Bla".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "appl(prod(sort(\"S\"),[sort(\"A\")],{}),[appl(prod(cilit(\"bla\"),[\\char-class([single(98)]),\\char-class([single(108)]),\\char-class([single(97)])],{}),[char(66),char(108),char(97)])])";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "aaa".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "appl(prod(sort(\"S\"),[iter(sort(\"A\"))],{}),[amb({appl(regular(iter(sort(\"A\"))),[appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"A\"),[lit(\"aa\")],{}),[appl(prod(lit(\"aa\"),[\\char-class([single(97)]),\\char-class([single(97)])],{}),[char(97),char(97)])])]),appl(regular(iter(sort(\"A\"))),[amb({appl(regular(iter(sort(\"A\"))),[appl(prod(sort(\"A\"),[lit(\"aa\")],{}),[appl(prod(lit(\"aa\"),[\\char-class([single(97)]),\\char-class([single(97)])],{}),[char(97),char(97)])])]),appl(regular(iter(sort(\"A\"))),[appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])])])}),appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])])])})])";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "appl(prod(sort(\"S\"),[sort(\"N\"),sort(\"N\")],{}),[appl(prod(sort(\"N\"),[sort(\"A\")],{}),[appl(prod(sort(\"A\"),[empty()],{}),[])]),appl(prod(sort(\"N\"),[sort(\"A\")],{}),[appl(prod(sort(\"A\"),[empty()],{}),[])])])";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

    return parse(NONTERMINAL_START_S, null, "aaa".toCharArray(), new DefaultNodeFlattener<IConstructor, IConstructor, ISourceLocation>(), new UPTRNodeFactory());
  }
 
  public IValue getExpectedResult() throws IOException{
    String expectedInput = "amb({appl(prod(sort(\"S\"),[sort(\"A\"),sort(\"A\")],{}),[appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])]),appl(prod(sort(\"A\"),[lit(\"aa\")],{}),[appl(prod(lit(\"aa\"),[\\char-class([single(97)]),\\char-class([single(97)])],{}),[char(97),char(97)])])]),appl(prod(sort(\"S\"),[sort(\"A\"),sort(\"A\")],{}),[appl(prod(sort(\"A\"),[lit(\"aa\")],{}),[appl(prod(lit(\"aa\"),[\\char-class([single(97)]),\\char-class([single(97)])],{}),[char(97),char(97)])]),appl(prod(sort(\"A\"),[lit(\"a\")],{}),[appl(prod(lit(\"a\"),[\\char-class([single(97)])],{}),[char(97)])])])})";
    return new StandardTextReader().read(ValueFactoryFactory.getValueFactory(), Factory.uptr, Factory.Tree, new StringReader(expectedInput));
  }
View Full Code Here

TOP

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

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.