Package persistence.antlr.collections

Examples of persistence.antlr.collections.AST


        if (text == null) {
            return null;
        }

        // return value
        AST paramsAST = null;

        // error message helper
        ErrorMsg errorMsg = new ErrorMsg();

        // create parser
View Full Code Here


                return "";

            // Check for DOT nodes #(DOT left right)
            // They are represented as left.right
            if (ast.getType() == JQLParser.DOT) {
                AST left = ast.getFirstChild();
                AST right = left.getNextSibling();
                return getTypeRepr(left) + "." + getTypeRepr(right);
            }

            // For all other nodes return the token text
            return ast.getText();
View Full Code Here

    return create(Token.INVALID_TYPE);
    }

    public AST create(int type) {
    Class c = getASTNodeType(type);
    AST t = create(c);
    if ( t!=null ) {
      t.initialize(type, "");
    }
    return t;
  }
View Full Code Here

    }
    return t;
  }

  public AST create(int type, String txt) {
        AST t = create(type);
    if ( t!=null ) {
      t.initialize(type, txt);
    }
        return t;
    }
View Full Code Here

   *  with a specific Java object type. Typically called when you
   *  say @[PLUS,"+",PLUSNode] in an antlr action.
   *  @since 2.7.2
   */
  public AST create(int type, String txt, String className) {
        AST t = create(className);
    if ( t!=null ) {
      t.initialize(type, txt);
    }
        return t;
    }
View Full Code Here

    /** Create a new empty AST node; if the user did not specify
     *  an AST node type, then create a default one: CommonAST.
     */
    public AST create(AST tr) {
        if (tr == null) return null;    // create(null) == null
        AST t = create(tr.getType());
    if ( t!=null ) {
      t.initialize(tr);
    }
        return t;
    }
View Full Code Here

    }
        return t;
    }

  public AST create(Token tok) {
        AST t = create(tok.getType());
    if ( t!=null ) {
      t.initialize(tok);
    }
        return t;
    }
View Full Code Here

   *  and so I must call the appropriate constructor not T().
   *
   * @since 2.7.2
   */
  public AST create(Token tok, String className) {
        AST t = createUsingCtor(tok,className);
        return t;
    }
View Full Code Here

  /**
   * @since 2.7.2
   */
  protected AST createUsingCtor(Token token, String className) {
    Class c = null;
    AST t = null;
    try {
      c = Class.forName(className);
      Class[] tokenArgType = new Class[] { persistence.antlr.Token.class };
      try {
        Constructor ctor = c.getConstructor(tokenArgType);
        t = (AST)ctor.newInstance(new Object[]{token}); // make a new one
      }
      catch (NoSuchMethodException e){
        // just do the regular thing if you can't find the ctor
        // Your AST must have default ctor to use this.
        t = create(c);
        if ( t!=null ) {
          t.initialize(token);
        }
      }
    }
    catch (Exception e) {
      throw new IllegalArgumentException("Invalid class or can't make instance, "+className);
View Full Code Here

  /**
   * @since 2.7.2
   */
  protected AST create(Class c) {
    AST t = null;
    try {
      t = (AST)c.newInstance(); // make a new one
    }
    catch (Exception e) {
      error("Can't create AST Node " + c.getName());
View Full Code Here

TOP

Related Classes of persistence.antlr.collections.AST

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.