Package wyrl.core

Examples of wyrl.core.Type


    if (decl.type.element() == null) {
      myOut(1, "public final static Automaton.Term " + name
          + " = new Automaton.Term(K_" + name + ");");
    } else {
      Type.Ref<?> data = decl.type.element();
      Type element = data.element();
      if (element instanceof Type.Collection) {
        // add two helpers
        myOut(1, "public final static int " + name
            + "(Automaton automaton, int... r0) {");
        if (element instanceof Type.Set) {
View Full Code Here


  public void translate(RewriteDecl decl, SpecFile file) {
    register(decl.pattern);

    boolean isReduction = decl instanceof ReduceDecl;
    Type param = decl.pattern.attribute(Attribute.Type.class).type;

    if(decl.name != null) {
      myOut(1, "// " + decl.name);
    }
View Full Code Here

    }
  }

  public int translatePatternMatch(int level, Pattern.Leaf pattern,
      Type declared, int source, Environment environment) {
    Type element = pattern.type().element();

    if (element == Type.T_ANY() || element.isSubtype(declared)) {
      // In this very special case, we don't need to do anything since
      // we're guarantted to have a match based on the context.
      return level;
    } else {
      int typeIndex = register(pattern.type);
View Full Code Here

    // Third, check all remaining elements against the unbounded match.
    // ====================================================================

    int lastPatternElementIndex = pattern_elements.length-1;
    Pattern lastPatternElement = pattern_elements[lastPatternElementIndex].first();
    Type lastDeclaredElement = declared_elements[declared_elements.length-1];
    int element = environment.allocate(Type.T_VOID());

    if(!willSkip(lastPatternElement,lastDeclaredElement)) {

      // Only include the loop if we really need it. In many cases, this
View Full Code Here

    // ====================================================================
    // Third, check all remaining elements against the unbounded match.
    // ====================================================================
    int lastPatternElementIndex = pattern_elements.length-1;
    Pattern lastPatternElement = pattern_elements[lastPatternElementIndex].first();
    Type lastDeclaredElement = declared_elements[declared_elements.length-1];
    int item = environment.allocate(Type.T_VOID());

    if(!willSkip(lastPatternElement,lastDeclaredElement)) {

      // Only include the loop if we really need it. In many cases, this
View Full Code Here

  protected boolean willSkip(Pattern pattern, Type declared) {
    declared = stripNominalsAndRefs(declared);

    if (pattern instanceof Pattern.Leaf) {
      Pattern.Leaf leaf = (Pattern.Leaf) pattern;
      Type element = leaf.type().element();

      if (element == Type.T_ANY() || element.isSubtype(declared)) {
        // In this very special case, we don't need to do anything since
        // we're guarantted to have a match based on the context.
        return true;
      }
    } else if (pattern instanceof Pattern.Term
View Full Code Here

    myOut(1,
        "// =========================================================================");
    myOut();

    for (int i = 0; i != typeRegister.size(); ++i) {
      Type t = typeRegister.get(i);
      JavaIdentifierOutputStream jout = new JavaIdentifierOutputStream();
      BinaryOutputStream bout = new BinaryOutputStream(jout);
      bout.write(t.toBytes());
      bout.flush();
      bout.close();
      // FIXME: strip out nominal types (and any other unneeded types).
      myOut(1, "// " + t);
      myOut(1, "private static Type type" + i + " = Runtime.Type(\""
View Full Code Here

    }
  }

  public int translate(int level, Expr.Cast code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;

    // first translate src expression, and coerce to a value
    int src = translate(level, code.src, environment, file);
    src = coerceFromRef(level, code.src, src, environment);
View Full Code Here

  }

  public int translate(int level, Expr.Constant code,
      Environment environment, SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    Object v = code.value;
    String rhs;

    if (v instanceof Boolean) {
      rhs = v.toString();
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.UnOp code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    int rhs = translate(level, code.mhs, environment, file);
    rhs = coerceFromRef(level, code.mhs, rhs, environment);
    String body;

    switch (code.op) {
View Full Code Here

TOP

Related Classes of wyrl.core.Type

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.