Package wyvern.tools.typedAST.extensions

Examples of wyvern.tools.typedAST.extensions.SpliceBindExn


  }

  public static SpliceBindExn spliceBinding(ParseBuffer buffer, List<NameBinding> bindings) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), "inner");
      return new SpliceBindExn(res, bindings);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here


  }

  public static SpliceBindExn spliceBinding(ParseBuffer buffer, List<NameBinding> bindings, String filename) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), filename);
      return new SpliceBindExn(res, bindings);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

      List<NameBinding> argNames = dis.getMembers().stream().map(cer->cer.getName().toString())
          .map(name -> new NameBindingImpl(name, Int.getInstance())).collect(Collectors.toList());

      argNames.add(new NameBindingImpl("lexeme", Str.getInstance()));

      SpliceBindExn spliced = LangUtil.spliceBinding(new IParseBuffer(disambiguationCode), argNames, dis.getDisplayName());

      CopperElementName newName = dis.getName();
      String nextName = getNextName(methNum, newName);
      toGen.put(nextName, new Pair<>(Int.getInstance(),spliced));
      dis.setCode(String.format("return ((IntegerConstant)Util.invokeValueVarargs(%s, \"%s\", %s)).getValue();", PAIRED_OBJECT_NAME, nextName,
View Full Code Here

      String newName = getNextName(methNum, termName);

      Type resType = lhsEnv.lookup(term.getName().toString()).getType();

      splicers.add((termClassType,termObjType) -> {
            SpliceBindExn spliced = LangUtil.spliceBinding(new IParseBuffer(oCode), Arrays.asList(new NameBinding[]{
                new NameBindingImpl("lexeme", Str.getInstance()),
                new NameBindingImpl("pushToken", new Arrow(new Tuple(termObjType, Str.getInstance()), Unit.getInstance())),
                new NameBindingImpl("Terminals", termClassType)}), term.getDisplayName());

            toGen.put(newName, new Pair<>(resType, spliced));
View Full Code Here

      Util.javaToWyvDecl(CupSkinParser.Terminals.class);
      //Generate the new Wyvern method name
      String newName = getNextName(methNum, prod.getName());

      //Parse the input code
      SpliceBindExn spliced = LangUtil.spliceBinding(new IParseBuffer(prod.getCode()), bindings);

      Type resType = lhsEnv.lookup(prod.getLhs().getName().toString()).getType();

      //Save it to the external dict
      toGen.put(newName, new Pair<>(resType, spliced));
View Full Code Here

TOP

Related Classes of wyvern.tools.typedAST.extensions.SpliceBindExn

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.