Package wyvern.tools.typedAST.core

Examples of wyvern.tools.typedAST.core.Sequence


    res.setClassName(javaClassName);

    String pic = res.getParserInitCode();
    TypedAST parserInitAST;
    if (pic == null)
      parserInitAST = new Sequence();
    else
      parserInitAST = LangUtil.splice(new IParseBuffer(pic), "parser init");
    String defNamePIA = "initGEN" + methNum.get();
    toGenDefs.put(defNamePIA, parserInitAST);
    methNum.set(methNum.get()+1);
    res.setParserInitCode(String.format("Util.invokeValueVarargs(%s, \"%s\");\n", PAIRED_OBJECT_NAME, defNamePIA));

    String ppc = res.getPostParseCode();
    TypedAST postParseAST;
    if (ppc == null)
      postParseAST = new Sequence();
    else
      postParseAST = LangUtil.splice(new IParseBuffer(ppc), "post parse");
    String defNameP = "postGEN" + methNum.get();
    toGenDefs.put(defNameP, postParseAST);
    methNum.set(methNum.get() + 1);
View Full Code Here


    Assert.assertEquals(19, (int)finalRes);
  }

  @Test
  public void testSplice1() throws IOException, CopperParserException {
    TypedAST testAST = new Sequence(
        new ValDeclaration("x", new IntegerConstant(4), null),
        new Application(new TSLBlock(new Fn(Arrays.asList(new NameBindingImpl("x", Int.getInstance())),
            new SpliceExn(new Variable(new NameBindingImpl("x", Int.getInstance()), null)))), new IntegerConstant(9), null) );
    Type result = testAST.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
    Value out = testAST.evaluate(Globals.getStandardEnv());
    int finalRes = ((IntegerConstant)out).getValue();
    Assert.assertEquals(4, finalRes);
  }
View Full Code Here

TOP

Related Classes of wyvern.tools.typedAST.core.Sequence

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.