jltools.parse
Class Util

java.lang.Object
  |
  +--jltools.parse.Util

public class Util
extends java.lang.Object

Utility routines for use by the parser. Although some routines are static, the intended use is to instantiate this class on a ParserWrapper and use the resulting object in the parser.


Field Summary
protected  NodeFactory nf
           
protected  ParserWrapper parser
           
protected  TypeSystem ts
           
 
Constructor Summary
Util(ParserWrapper parser)
          Construct a utility object for use by parser.
 
Method Summary
 TypeNode array(TypeNode n, int dims)
          Return a TypeNode representing a dims-dimensional array of n.
protected  QualifierNode exprToQualifier(Expr e)
          Helper for exprToType.
 TypeNode exprToType(Expr e)
          Convert e into a type, yielding a TypeNode.
static Position pos(java.util.List l)
          Return the source position of the first element in the list.
static Position pos(Node n)
          Return the source position of the Node.
static Position pos(Token t)
          Return the position of the Token.
static Position pos(Type n)
          Return the source position of the Type.
static Position pos(VarDeclarator n)
          Return the source position of the declaration.
protected  QualifierNode prefixToQualifier(Prefix p)
          Helper for exprToType.
protected  QualifierNode typeToQualifier(TypeNode t)
          Helper for exprToType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parser

protected ParserWrapper parser

nf

protected NodeFactory nf

ts

protected TypeSystem ts
Constructor Detail

Util

public Util(ParserWrapper parser)
Construct a utility object for use by parser.
Method Detail

pos

public static Position pos(Token t)
Return the position of the Token.

pos

public static Position pos(Type n)
Return the source position of the Type.

pos

public static Position pos(java.util.List l)
Return the source position of the first element in the list.

pos

public static Position pos(VarDeclarator n)
Return the source position of the declaration.

pos

public static Position pos(Node n)
Return the source position of the Node.

array

public TypeNode array(TypeNode n,
                      int dims)
               throws java.lang.Exception
Return a TypeNode representing a dims-dimensional array of n.

prefixToQualifier

protected QualifierNode prefixToQualifier(Prefix p)
                                   throws java.lang.Exception
Helper for exprToType.

typeToQualifier

protected QualifierNode typeToQualifier(TypeNode t)
                                 throws java.lang.Exception
Helper for exprToType.

exprToQualifier

protected QualifierNode exprToQualifier(Expr e)
                                 throws java.lang.Exception
Helper for exprToType.

exprToType

public TypeNode exprToType(Expr e)
                    throws java.lang.Exception
Convert e into a type, yielding a TypeNode. This is used by the cast_expression production.