db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/jdo/jdoql QueryTreeResolver.java LocalVariableAccess.java VisitorBase.java NameExpression.java ASTWithPositionInfo.java QueryTreeNode.java TypeAccess.java Visitor.java Acceptor.java JDOQLTokenTypes.txt LocalVariable.java JDOQLQueryHelper.java JDOQLTreeParserTokenTypes.java jdoql-ojb-parser.g Expression.java Type.java JDOQLTreeParserTokenTypes.txt BinaryExpression.java ThisExpression.java jdoql-ojb-lexer.g Import.java JDOQLParserTokenTypes.java JDOQLTreeParser.java PostfixExpression.java JDOQLParser.java JDOQLParserTokenTypes.txt UnaryExpression.java NullLiteral.java JDOQLTokenTypes.java Literal.java jdoql-ojb-treeparser.g FieldAccess.java Ordering.java MethodInvocation.java
Date Sun, 16 May 2004 22:15:46 GMT
tomdz       2004/05/16 15:15:46

  Modified:    src/java/org/apache/ojb/jdo/jdoql JDOQLTokenTypes.txt
                        LocalVariable.java JDOQLQueryHelper.java
                        JDOQLTreeParserTokenTypes.java jdoql-ojb-parser.g
                        Expression.java Type.java
                        JDOQLTreeParserTokenTypes.txt BinaryExpression.java
                        ThisExpression.java jdoql-ojb-lexer.g Import.java
                        JDOQLParserTokenTypes.java JDOQLTreeParser.java
                        PostfixExpression.java JDOQLParser.java
                        JDOQLParserTokenTypes.txt UnaryExpression.java
                        NullLiteral.java JDOQLTokenTypes.java Literal.java
                        jdoql-ojb-treeparser.g FieldAccess.java
                        Ordering.java MethodInvocation.java
  Added:       src/java/org/apache/ojb/jdo/jdoql QueryTreeResolver.java
                        LocalVariableAccess.java VisitorBase.java
                        NameExpression.java ASTWithPositionInfo.java
                        QueryTreeNode.java TypeAccess.java Visitor.java
                        Acceptor.java
  Log:
  Added position info to query tree nodes (for error reporting)
  Put basic error handling into place (ANTLRException -> JDOUserException)
  Added visitor pattern support for easy traversal of the tree
  Started implementing resolving & checking of the query
  
  Revision  Changes    Path
  1.5       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTokenTypes.txt
  
  Index: JDOQLTokenTypes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTokenTypes.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOQLTokenTypes.txt	13 May 2004 21:37:08 -0000	1.4
  +++ JDOQLTokenTypes.txt	16 May 2004 22:15:46 -0000	1.5
  @@ -13,7 +13,7 @@
   CAST=14
   METHOD_INVOCATION=15
   ARG_LIST=16
  -FIELD_ACCESS=17
  +NAME_EXPRESSION=17
   PRIMITIVE_TYPE=18
   NAME=19
   LITERAL_IMPORT="import"=20
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/LocalVariable.java
  
  Index: LocalVariable.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/LocalVariable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalVariable.java	12 May 2004 22:30:49 -0000	1.1
  +++ LocalVariable.java	16 May 2004 22:15:46 -0000	1.2
  @@ -23,7 +23,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class LocalVariable
  +public class LocalVariable extends QueryTreeNode
   {
       /** The name of the variable */
       private String  _name;
  @@ -95,6 +95,14 @@
       public String getName()
       {
           return _name;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.2       +80 -17    db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLQueryHelper.java
  
  Index: JDOQLQueryHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLQueryHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JDOQLQueryHelper.java	12 May 2004 22:30:49 -0000	1.1
  +++ JDOQLQueryHelper.java	16 May 2004 22:15:46 -0000	1.2
  @@ -18,7 +18,10 @@
   import java.io.StringReader;
   import java.util.List;
   
  -import antlr.ANTLRException;
  +import javax.jdo.JDOUserException;
  +
  +import antlr.RecognitionException;
  +import antlr.TokenStreamException;
   
   /**
    * Helper class for building the actual query structure from a JDOQL query definition.
  @@ -32,14 +35,26 @@
        *
        * @return The parameters list
        */
  -    public List parseParameters(String declaration) throws ANTLRException
  +    public List parseParameters(String declaration) throws JDOUserException
       {
           JDOQLLexer      lexer      = new JDOQLLexer(new StringReader(declaration));
           JDOQLParser     parser     = new JDOQLParser(lexer);
           JDOQLTreeParser treeParser = new JDOQLTreeParser();
           
  -        parser.declareParameters();
  -        return treeParser.declareParameters(parser.getAST());
  +        parser.setASTNodeClass(ASTWithPositionInfo.class.getName());
  +        try
  +        {
  +            parser.declareParameters();
  +            return treeParser.declareParameters(parser.getAST());
  +        }
  +        catch (RecognitionException ex)
  +        {
  +            throw new JDOUserException("Error in parameter declaration at line "+ex.getLine()+", column "+ex.getColumn());
  +        }
  +        catch (TokenStreamException ex)
  +        {
  +            throw new JDOUserException("Could not parse the parameter declaration");
  +        }
       }
   
       /**
  @@ -47,14 +62,26 @@
        *
        * @return The variable ast
        */
  -    public List parseVariables(String declaration) throws ANTLRException
  +    public List parseVariables(String declaration) throws JDOUserException
       {
           JDOQLLexer      lexer      = new JDOQLLexer(new StringReader(declaration));
           JDOQLParser     parser     = new JDOQLParser(lexer);
           JDOQLTreeParser treeParser = new JDOQLTreeParser();
           
  -        parser.declareVariables();
  -        return treeParser.declareVariables(parser.getAST());
  +        parser.setASTNodeClass(ASTWithPositionInfo.class.getName());
  +        try
  +        {
  +            parser.declareVariables();
  +            return treeParser.declareVariables(parser.getAST());
  +        }
  +        catch (RecognitionException ex)
  +        {
  +            throw new JDOUserException("Error in variable declaration at line "+ex.getLine()+", column "+ex.getColumn());
  +        }
  +        catch (TokenStreamException ex)
  +        {
  +            throw new JDOUserException("Could not parse the variable declaration");
  +        }
       }
   
       /**
  @@ -62,14 +89,26 @@
        *
        * @return The imports list
        */
  -    public List parseImports(String declaration) throws ANTLRException
  +    public List parseImports(String declaration) throws JDOUserException
       {
           JDOQLLexer      lexer      = new JDOQLLexer(new StringReader(declaration));
           JDOQLParser     parser     = new JDOQLParser(lexer);
           JDOQLTreeParser treeParser = new JDOQLTreeParser();
   
  -        parser.declareImports();
  -        return treeParser.declareImports(parser.getAST());
  +        parser.setASTNodeClass(ASTWithPositionInfo.class.getName());
  +        try
  +        {
  +            parser.declareImports();
  +            return treeParser.declareImports(parser.getAST());
  +        }
  +        catch (RecognitionException ex)
  +        {
  +            throw new JDOUserException("Error in import specification at line "+ex.getLine()+", column "+ex.getColumn());
  +        }
  +        catch (TokenStreamException ex)
  +        {
  +            throw new JDOUserException("Could not parse the import specification");
  +        }
       }
   
       /**
  @@ -77,14 +116,26 @@
        *
        * @return The orderings list
        */
  -    public List parseOrderings(String declaration) throws ANTLRException
  +    public List parseOrderings(String declaration) throws JDOUserException
       {
           JDOQLLexer      lexer      = new JDOQLLexer(new StringReader(declaration));
           JDOQLParser     parser     = new JDOQLParser(lexer);
           JDOQLTreeParser treeParser = new JDOQLTreeParser();
           
  -        parser.setOrdering();
  -        return treeParser.setOrdering(parser.getAST());
  +        parser.setASTNodeClass(ASTWithPositionInfo.class.getName());
  +        try
  +        {
  +            parser.setOrdering();
  +            return treeParser.setOrdering(parser.getAST());
  +        }
  +        catch (RecognitionException ex)
  +        {
  +            throw new JDOUserException("Error in ordering specification at line "+ex.getLine()+", column "+ex.getColumn());
  +        }
  +        catch (TokenStreamException ex)
  +        {
  +            throw new JDOUserException("Could not parse the ordering specification");
  +        }
       }
   
       /**
  @@ -92,17 +143,29 @@
        *
        * @return The filter expression
        */
  -    public Expression parseFilter(String expression) throws ANTLRException
  +    public Expression parseFilter(String expression) throws JDOUserException
       {
           JDOQLLexer      lexer      = new JDOQLLexer(new StringReader(expression));
           JDOQLParser     parser     = new JDOQLParser(lexer);
           JDOQLTreeParser treeParser = new JDOQLTreeParser();
           
  -        parser.expression();
  -        return treeParser.expression(parser.getAST());
  +        parser.setASTNodeClass(ASTWithPositionInfo.class.getName());
  +        try
  +        {
  +            parser.expression();
  +            return treeParser.expression(parser.getAST());
  +        }
  +        catch (RecognitionException ex)
  +        {
  +            throw new JDOUserException("Error in filter expression at line "+ex.getLine()+", column "+ex.getColumn());
  +        }
  +        catch (TokenStreamException ex)
  +        {
  +            throw new JDOUserException("Could not parse the filter expression");
  +        }
       }
   
  -    public static void main(String[] args) throws ANTLRException
  +    public static void main(String[] args) throws JDOUserException
       {
           if (args.length < 2)
           {
  
  
  
  1.3       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParserTokenTypes.java
  
  Index: JDOQLTreeParserTokenTypes.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParserTokenTypes.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDOQLTreeParserTokenTypes.java	13 May 2004 21:37:08 -0000	1.2
  +++ JDOQLTreeParserTokenTypes.java	16 May 2004 22:15:46 -0000	1.3
  @@ -35,7 +35,7 @@
   	int CAST = 14;
   	int METHOD_INVOCATION = 15;
   	int ARG_LIST = 16;
  -	int FIELD_ACCESS = 17;
  +	int NAME_EXPRESSION = 17;
   	int PRIMITIVE_TYPE = 18;
   	int NAME = 19;
   	int LITERAL_IMPORT = 20;
  
  
  
  1.5       +5 -5      db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-parser.g
  
  Index: jdoql-ojb-parser.g
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-parser.g,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jdoql-ojb-parser.g	13 May 2004 21:37:08 -0000	1.4
  +++ jdoql-ojb-parser.g	16 May 2004 22:15:46 -0000	1.5
  @@ -98,17 +98,17 @@
         literal
       | LITERAL_THIS^
       | SEP_OPENING_PARENTHESIS! expression SEP_CLOSING_PARENTHESIS!
  -    | directFeatureAccess
  +    | directAccess
       )
       ;
   
  -directFeatureAccess :
  +directAccess :
       id:IDENTIFIER^
       ( 
         SEP_OPENING_PARENTHESIS! argList SEP_CLOSING_PARENTHESIS!
  -      { #directFeatureAccess.setType(METHOD_INVOCATION); }
  +      { #directAccess.setType(METHOD_INVOCATION); }
       | /* empty */
  -      { #directFeatureAccess.setType(FIELD_ACCESS); }
  +      { #directAccess.setType(NAME_EXPRESSION); }
       )
   	;
   
  @@ -122,7 +122,7 @@
   	;
   
   postfixExpression :
  -	primary ( SEP_DOT^ directFeatureAccess )*
  +	primary ( SEP_DOT^ directAccess )*
       ;
   
   unaryExpression :
  
  
  
  1.2       +1 -2      db-ojb/src/java/org/apache/ojb/jdo/jdoql/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/Expression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Expression.java	12 May 2004 22:30:49 -0000	1.1
  +++ Expression.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,7 +20,6 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public interface Expression
  +public interface Expression extends Acceptor
   {
  -
   }
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/Type.java
  
  Index: Type.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/Type.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Type.java	12 May 2004 22:30:49 -0000	1.1
  +++ Type.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,7 +20,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class Type
  +public class Type extends QueryTreeNode
   {
       /** The (possibly unqualified) name of the type */
       private String  _typeName;
  @@ -90,6 +90,14 @@
       public String getTypeName()
       {
           return _typeName;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.3       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParserTokenTypes.txt
  
  Index: JDOQLTreeParserTokenTypes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParserTokenTypes.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDOQLTreeParserTokenTypes.txt	13 May 2004 21:37:09 -0000	1.2
  +++ JDOQLTreeParserTokenTypes.txt	16 May 2004 22:15:46 -0000	1.3
  @@ -13,7 +13,7 @@
   CAST=14
   METHOD_INVOCATION=15
   ARG_LIST=16
  -FIELD_ACCESS=17
  +NAME_EXPRESSION=17
   PRIMITIVE_TYPE=18
   NAME=19
   LITERAL_IMPORT="import"=20
  
  
  
  1.3       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/BinaryExpression.java
  
  Index: BinaryExpression.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/BinaryExpression.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BinaryExpression.java	13 May 2004 21:37:09 -0000	1.2
  +++ BinaryExpression.java	16 May 2004 22:15:46 -0000	1.3
  @@ -20,7 +20,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class BinaryExpression implements Expression
  +public class BinaryExpression extends QueryTreeNode implements Expression
   {
       public static final int OPERATOR_MULTIPLY        = 0;
       public static final int OPERATOR_DIVIDE          = 1;
  @@ -87,6 +87,14 @@
       public Expression getRightSide()
       {
           return _right;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/ThisExpression.java
  
  Index: ThisExpression.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/ThisExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ThisExpression.java	12 May 2004 22:30:49 -0000	1.1
  +++ ThisExpression.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,13 +20,21 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class ThisExpression implements Expression
  +public class ThisExpression extends QueryTreeNode implements Expression
   {
       /**
        * Creates a new this expression object. 
        */
       public ThisExpression()
       {
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.5       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-lexer.g
  
  Index: jdoql-ojb-lexer.g
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-lexer.g,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- jdoql-ojb-lexer.g	13 May 2004 21:37:08 -0000	1.4
  +++ jdoql-ojb-lexer.g	16 May 2004 22:15:46 -0000	1.5
  @@ -47,7 +47,7 @@
   	CAST;
   	METHOD_INVOCATION;
   	ARG_LIST;
  -	FIELD_ACCESS;
  +	NAME_EXPRESSION;
   	PRIMITIVE_TYPE;
   	NAME;
       LITERAL_IMPORT = "import";
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/Import.java
  
  Index: Import.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/Import.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Import.java	12 May 2004 22:30:49 -0000	1.1
  +++ Import.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,7 +20,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class Import
  +public class Import extends QueryTreeNode
   {
       /** The import spec, either a fully qualified class name or a qualified package name */
       private String _spec;
  @@ -60,6 +60,14 @@
       public String getSpec()
       {
           return _spec;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.5       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParserTokenTypes.java
  
  Index: JDOQLParserTokenTypes.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParserTokenTypes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOQLParserTokenTypes.java	13 May 2004 21:37:08 -0000	1.4
  +++ JDOQLParserTokenTypes.java	16 May 2004 22:15:46 -0000	1.5
  @@ -33,7 +33,7 @@
   	int CAST = 14;
   	int METHOD_INVOCATION = 15;
   	int ARG_LIST = 16;
  -	int FIELD_ACCESS = 17;
  +	int NAME_EXPRESSION = 17;
   	int PRIMITIVE_TYPE = 18;
   	int NAME = 19;
   	int LITERAL_IMPORT = 20;
  
  
  
  1.3       +203 -121  db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParser.java
  
  Index: JDOQLTreeParser.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTreeParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDOQLTreeParser.java	13 May 2004 21:37:08 -0000	1.2
  +++ JDOQLTreeParser.java	16 May 2004 22:15:46 -0000	1.3
  @@ -97,6 +97,7 @@
   		_t = _t.getNextSibling();
   		
   			    varDecl = new LocalVariable(varType, name.getText());
  +			    varDecl.setPosition(varType.getLine(), varType.getColumn());
   		
   		_retTree = _t;
   		return varDecl;
  @@ -118,7 +119,8 @@
   			match(_t,PRIMITIVE_TYPE);
   			_t = _t.getNextSibling();
   			
  -				     result = new Type(primitiveTypeName.getText(), true);
  +				      result = new Type(primitiveTypeName.getText(), true);
  +				  	  result.setPosition(primitiveTypeName.getLine(), primitiveTypeName.getColumn());
   				
   			break;
   		}
  @@ -128,7 +130,8 @@
   			match(_t,NAME);
   			_t = _t.getNextSibling();
   			
  -				     result = new Type(typeName.getText(), false);
  +				      result = new Type(typeName.getText(), false);
  +				  	  result.setPosition(typeName.getLine(), typeName.getColumn());
   				
   			break;
   		}
  @@ -201,6 +204,7 @@
   		_t = _t.getNextSibling();
   		
   			    varDecl = new LocalVariable(varType, name.getText());
  +			    varDecl.setPosition(varType.getLine(), varType.getColumn());
   		
   		_retTree = _t;
   		return varDecl;
  @@ -247,7 +251,9 @@
   		Import importDecl;
   		
   		AST importDeclaration_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST i1 = null;
   		AST name1 = null;
  +		AST i2 = null;
   		AST name2 = null;
   		
   		{
  @@ -256,7 +262,7 @@
   		case IMPORT:
   		{
   			AST __t19 = _t;
  -			AST tmp6_AST_in = (AST)_t;
  +			i1 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,IMPORT);
   			_t = _t.getFirstChild();
   			name1 = (AST)_t;
  @@ -266,13 +272,14 @@
   			_t = _t.getNextSibling();
   			
   				  	  importDecl = new Import(name1.getText(), false);
  +				  	  importDecl.setPosition(i1.getLine(), i1.getColumn());
   				
   			break;
   		}
   		case ON_DEMAND_IMPORT:
   		{
   			AST __t20 = _t;
  -			AST tmp7_AST_in = (AST)_t;
  +			i2 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,ON_DEMAND_IMPORT);
   			_t = _t.getFirstChild();
   			name2 = (AST)_t;
  @@ -282,6 +289,7 @@
   			_t = _t.getNextSibling();
   			
   				  	  importDecl = new Import(name2.getText(), true);
  +				  	  importDecl.setPosition(i2.getLine(), i2.getColumn());
   				
   			break;
   		}
  @@ -306,7 +314,7 @@
   				result = new ArrayList();
   			
   		AST __t22 = _t;
  -		AST tmp8_AST_in = (AST)_t;
  +		AST tmp6_AST_in = (AST)_t;
   		match(_t,ORDERSPECS);
   		_t = _t.getFirstChild();
   		{
  @@ -336,13 +344,14 @@
   		Ordering orderingDecl;
   		
   		AST orderSpecification_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST o = null;
   		
   		
   				Expression expr = null;
   				boolean    isAscending;
   			
   		AST __t26 = _t;
  -		AST tmp9_AST_in = (AST)_t;
  +		o = _t==ASTNULL ? null :(AST)_t;
   		match(_t,ORDERSPEC);
   		_t = _t.getFirstChild();
   		expr=expression(_t);
  @@ -352,7 +361,7 @@
   		switch ( _t.getType()) {
   		case LITERAL_ASCENDING:
   		{
  -			AST tmp10_AST_in = (AST)_t;
  +			AST tmp7_AST_in = (AST)_t;
   			match(_t,LITERAL_ASCENDING);
   			_t = _t.getNextSibling();
   			
  @@ -362,7 +371,7 @@
   		}
   		case LITERAL_DESCENDING:
   		{
  -			AST tmp11_AST_in = (AST)_t;
  +			AST tmp8_AST_in = (AST)_t;
   			match(_t,LITERAL_DESCENDING);
   			_t = _t.getNextSibling();
   			
  @@ -380,6 +389,7 @@
   		_t = _t.getNextSibling();
   		
   				orderingDecl = new Ordering(expr, isAscending);
  +				orderingDecl.setPosition(o.getLine(), o.getColumn());
   			
   		_retTree = _t;
   		return orderingDecl;
  @@ -395,8 +405,6 @@
   		switch ( _t.getType()) {
   		case LITERAL_TRUE:
   		case LITERAL_FALSE:
  -		case LITERAL_NULL:
  -		case LITERAL_THIS:
   		case FLOATING_POINT_LITERAL:
   		case INTEGER_LITERAL:
   		case CHARACTER_LITERAL:
  @@ -406,6 +414,18 @@
   			_t = _retTree;
   			break;
   		}
  +		case LITERAL_NULL:
  +		{
  +			expr=nullLiteral(_t);
  +			_t = _retTree;
  +			break;
  +		}
  +		case LITERAL_THIS:
  +		{
  +			expr=thisExpression(_t);
  +			_t = _retTree;
  +			break;
  +		}
   		case OP_GREATER_OR_EQUAL:
   		case OP_LOWER_OR_EQUAL:
   		case OP_NOT_EQUAL:
  @@ -442,9 +462,9 @@
   			_t = _retTree;
   			break;
   		}
  -		case FIELD_ACCESS:
  +		case NAME_EXPRESSION:
   		{
  -			expr=fieldAccess(_t);
  +			expr=nameExpression(_t);
   			_t = _retTree;
   			break;
   		}
  @@ -464,8 +484,8 @@
   		return expr;
   	}
   	
  -	public final Expression  literal(AST _t) throws RecognitionException {
  -		Expression expr;
  +	public final Literal  literal(AST _t) throws RecognitionException {
  +		Literal literal;
   		
   		AST literal_AST_in = (_t == ASTNULL) ? null : (AST)_t;
   		AST l1 = null;
  @@ -484,7 +504,8 @@
   			match(_t,LITERAL_TRUE);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(boolean.class, l1.getText());
  +				  	  literal = new Literal(boolean.class, l1.getText());
  +					  literal.setPosition(l1.getLine(), l2.getColumn());
   				
   			break;
   		}
  @@ -494,17 +515,8 @@
   			match(_t,LITERAL_FALSE);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(boolean.class, l2.getText());
  -				
  -			break;
  -		}
  -		case LITERAL_NULL:
  -		{
  -			AST tmp12_AST_in = (AST)_t;
  -			match(_t,LITERAL_NULL);
  -			_t = _t.getNextSibling();
  -			
  -				  	  expr = new NullLiteral();
  +				  	  literal = new Literal(boolean.class, l2.getText());
  +					  literal.setPosition(l2.getLine(), l2.getColumn());
   				
   			break;
   		}
  @@ -514,7 +526,8 @@
   			match(_t,INTEGER_LITERAL);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(long.class, l3.getText());
  +				  	  literal = new Literal(long.class, l3.getText());
  +					  literal.setPosition(l3.getLine(), l3.getColumn());
   				
   			break;
   		}
  @@ -524,7 +537,8 @@
   			match(_t,FLOATING_POINT_LITERAL);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(double.class, l4.getText());
  +				  	  literal = new Literal(double.class, l4.getText());
  +					  literal.setPosition(l4.getLine(), l4.getColumn());
   				
   			break;
   		}
  @@ -534,7 +548,8 @@
   			match(_t,CHARACTER_LITERAL);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(char.class, l5.getText());
  +				  	  literal = new Literal(char.class, l5.getText());
  +					  literal.setPosition(l5.getLine(), l5.getColumn());
   				
   			break;
   		}
  @@ -544,20 +559,11 @@
   			match(_t,STRING_LITERAL);
   			_t = _t.getNextSibling();
   			
  -				  	  expr = new Literal(String.class, l1.getText());
  +				  	  literal = new Literal(String.class, l6.getText());
  +					  literal.setPosition(l6.getLine(), l6.getColumn());
   				
   			break;
   		}
  -		case LITERAL_THIS:
  -		{
  -			AST tmp13_AST_in = (AST)_t;
  -			match(_t,LITERAL_THIS);
  -			_t = _t.getNextSibling();
  -			
  -				  expr = new ThisExpression();
  -			
  -			break;
  -		}
   		default:
   		{
   			throw new NoViableAltException(_t);
  @@ -565,6 +571,40 @@
   		}
   		}
   		_retTree = _t;
  +		return literal;
  +	}
  +	
  +	public final NullLiteral  nullLiteral(AST _t) throws RecognitionException {
  +		NullLiteral literal;
  +		
  +		AST nullLiteral_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST l = null;
  +		
  +		l = (AST)_t;
  +		match(_t,LITERAL_NULL);
  +		_t = _t.getNextSibling();
  +		
  +			  	literal = new NullLiteral();
  +				literal.setPosition(l.getLine(), l.getColumn());
  +			
  +		_retTree = _t;
  +		return literal;
  +	}
  +	
  +	public final ThisExpression  thisExpression(AST _t) throws RecognitionException {
  +		ThisExpression expr;
  +		
  +		AST thisExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST l = null;
  +		
  +		l = (AST)_t;
  +		match(_t,LITERAL_THIS);
  +		_t = _t.getNextSibling();
  +		
  +		expr = new ThisExpression();
  +				expr.setPosition(l.getLine(), l.getColumn());
  +		
  +		_retTree = _t;
   		return expr;
   	}
   	
  @@ -572,6 +612,21 @@
   		BinaryExpression expr;
   		
   		AST binaryExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST o1 = null;
  +		AST o2 = null;
  +		AST o3 = null;
  +		AST o4 = null;
  +		AST o5 = null;
  +		AST o6 = null;
  +		AST o7 = null;
  +		AST o8 = null;
  +		AST o9 = null;
  +		AST o10 = null;
  +		AST o11 = null;
  +		AST o12 = null;
  +		AST o13 = null;
  +		AST o14 = null;
  +		AST o15 = null;
   		
   		
   				Expression left  = null;
  @@ -582,256 +637,271 @@
   		switch ( _t.getType()) {
   		case OP_MULTIPLY:
   		{
  -			AST __t51 = _t;
  -			AST tmp14_AST_in = (AST)_t;
  +			AST __t53 = _t;
  +			o1 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_MULTIPLY);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t51;
  +			_t = __t53;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_MULTIPLY, right);
  +					  expr.setPosition(o1.getLine(), o1.getColumn());
   				
   			break;
   		}
   		case OP_DIVIDE:
   		{
  -			AST __t52 = _t;
  -			AST tmp15_AST_in = (AST)_t;
  +			AST __t54 = _t;
  +			o2 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_DIVIDE);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t52;
  +			_t = __t54;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_DIVIDE, right);
  +					  expr.setPosition(o2.getLine(), o2.getColumn());
   				
   			break;
   		}
   		case OP_BINARY_PLUS:
   		{
  -			AST __t53 = _t;
  -			AST tmp16_AST_in = (AST)_t;
  +			AST __t55 = _t;
  +			o3 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BINARY_PLUS);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t53;
  +			_t = __t55;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_PLUS, right);
  +					  expr.setPosition(o3.getLine(), o3.getColumn());
   				
   			break;
   		}
   		case OP_BINARY_MINUS:
   		{
  -			AST __t54 = _t;
  -			AST tmp17_AST_in = (AST)_t;
  +			AST __t56 = _t;
  +			o4 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BINARY_MINUS);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t54;
  +			_t = __t56;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_MINUS, right);
  +					  expr.setPosition(o4.getLine(), o4.getColumn());
   				
   			break;
   		}
   		case OP_LOWER:
   		{
  -			AST __t55 = _t;
  -			AST tmp18_AST_in = (AST)_t;
  +			AST __t57 = _t;
  +			o5 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_LOWER);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t55;
  +			_t = __t57;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_LOWER, right);
  +					  expr.setPosition(o5.getLine(), o5.getColumn());
   				
   			break;
   		}
   		case OP_GREATER:
   		{
  -			AST __t56 = _t;
  -			AST tmp19_AST_in = (AST)_t;
  +			AST __t58 = _t;
  +			o6 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_GREATER);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t56;
  +			_t = __t58;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_GREATER, right);
  +					  expr.setPosition(o6.getLine(), o6.getColumn());
   				
   			break;
   		}
   		case OP_LOWER_OR_EQUAL:
   		{
  -			AST __t57 = _t;
  -			AST tmp20_AST_in = (AST)_t;
  +			AST __t59 = _t;
  +			o7 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_LOWER_OR_EQUAL);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t57;
  +			_t = __t59;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_LOWER_OR_EQUAL, right);
  +					  expr.setPosition(o7.getLine(), o7.getColumn());
   				
   			break;
   		}
   		case OP_GREATER_OR_EQUAL:
   		{
  -			AST __t58 = _t;
  -			AST tmp21_AST_in = (AST)_t;
  +			AST __t60 = _t;
  +			o8 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_GREATER_OR_EQUAL);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t58;
  +			_t = __t60;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_GREATE_OR_EQUAL, right);
  +					  expr.setPosition(o8.getLine(), o8.getColumn());
   				
   			break;
   		}
   		case OP_EQUAL:
   		{
  -			AST __t59 = _t;
  -			AST tmp22_AST_in = (AST)_t;
  +			AST __t61 = _t;
  +			o9 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_EQUAL);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t59;
  +			_t = __t61;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_EQUAL, right);
  +					  expr.setPosition(o9.getLine(), o9.getColumn());
   				
   			break;
   		}
   		case OP_NOT_EQUAL:
   		{
  -			AST __t60 = _t;
  -			AST tmp23_AST_in = (AST)_t;
  +			AST __t62 = _t;
  +			o10 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_NOT_EQUAL);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t60;
  +			_t = __t62;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_NOT_EQUAL, right);
  +					  expr.setPosition(o10.getLine(), o10.getColumn());
   				
   			break;
   		}
   		case OP_BITWISE_AND:
   		{
  -			AST __t61 = _t;
  -			AST tmp24_AST_in = (AST)_t;
  +			AST __t63 = _t;
  +			o11 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BITWISE_AND);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t61;
  +			_t = __t63;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_AND, right);
  +					  expr.setPosition(o11.getLine(), o11.getColumn());
   				
   			break;
   		}
   		case OP_BITWISE_XOR:
   		{
  -			AST __t62 = _t;
  -			AST tmp25_AST_in = (AST)_t;
  +			AST __t64 = _t;
  +			o12 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BITWISE_XOR);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t62;
  +			_t = __t64;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_XOR, right);
  +					  expr.setPosition(o12.getLine(), o12.getColumn());
   				
   			break;
   		}
   		case OP_BITWISE_OR:
   		{
  -			AST __t63 = _t;
  -			AST tmp26_AST_in = (AST)_t;
  +			AST __t65 = _t;
  +			o13 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BITWISE_OR);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t63;
  +			_t = __t65;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_OR, right);
  +					  expr.setPosition(o13.getLine(), o13.getColumn());
   				
   			break;
   		}
   		case OP_AND:
   		{
  -			AST __t64 = _t;
  -			AST tmp27_AST_in = (AST)_t;
  +			AST __t66 = _t;
  +			o14 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_AND);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t64;
  +			_t = __t66;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_AND, right);
  +					  expr.setPosition(o14.getLine(), o14.getColumn());
   				
   			break;
   		}
   		case OP_OR:
   		{
  -			AST __t65 = _t;
  -			AST tmp28_AST_in = (AST)_t;
  +			AST __t67 = _t;
  +			o15 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_OR);
   			_t = _t.getFirstChild();
   			left=expression(_t);
   			_t = _retTree;
   			right=expression(_t);
   			_t = _retTree;
  -			_t = __t65;
  +			_t = __t67;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_OR, right);
  +					  expr.setPosition(o15.getLine(), o15.getColumn());
   				
   			break;
   		}
  @@ -849,6 +919,11 @@
   		UnaryExpression expr;
   		
   		AST unaryExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST o1 = null;
  +		AST o2 = null;
  +		AST o3 = null;
  +		AST o4 = null;
  +		AST o5 = null;
   		
   		
   				Expression inner    = null;
  @@ -859,78 +934,83 @@
   		switch ( _t.getType()) {
   		case OP_UNARY_MINUS:
   		{
  -			AST __t44 = _t;
  -			AST tmp29_AST_in = (AST)_t;
  +			AST __t46 = _t;
  +			o1 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_UNARY_MINUS);
   			_t = _t.getFirstChild();
   			inner=expression(_t);
   			_t = _retTree;
  -			_t = __t44;
  +			_t = __t46;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_MINUS, inner);
  +					  expr.setPosition(o1.getLine(), o1.getColumn());
   				
   			break;
   		}
   		case OP_UNARY_PLUS:
   		{
  -			AST __t45 = _t;
  -			AST tmp30_AST_in = (AST)_t;
  +			AST __t47 = _t;
  +			o2 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_UNARY_PLUS);
   			_t = _t.getFirstChild();
   			inner=expression(_t);
   			_t = _retTree;
  -			_t = __t45;
  +			_t = __t47;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_PLUS, inner);
  +					  expr.setPosition(o2.getLine(), o2.getColumn());
   				
   			break;
   		}
   		case OP_BITWISE_COMPLEMENT:
   		{
  -			AST __t46 = _t;
  -			AST tmp31_AST_in = (AST)_t;
  +			AST __t48 = _t;
  +			o3 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_BITWISE_COMPLEMENT);
   			_t = _t.getFirstChild();
   			inner=expression(_t);
   			_t = _retTree;
  -			_t = __t46;
  +			_t = __t48;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_BITWISE_COMPLEMENT, inner);
  +					  expr.setPosition(o3.getLine(), o3.getColumn());
   				
   			break;
   		}
   		case OP_NOT:
   		{
  -			AST __t47 = _t;
  -			AST tmp32_AST_in = (AST)_t;
  +			AST __t49 = _t;
  +			o4 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,OP_NOT);
   			_t = _t.getFirstChild();
   			inner=expression(_t);
   			_t = _retTree;
  -			_t = __t47;
  +			_t = __t49;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_NOT, inner);
  +					  expr.setPosition(o4.getLine(), o4.getColumn());
   				
   			break;
   		}
   		case CAST:
   		{
  -			AST __t48 = _t;
  -			AST tmp33_AST_in = (AST)_t;
  +			AST __t50 = _t;
  +			o5 = _t==ASTNULL ? null :(AST)_t;
   			match(_t,CAST);
   			_t = _t.getFirstChild();
   			castType=type(_t);
   			_t = _retTree;
   			inner=expression(_t);
   			_t = _retTree;
  -			_t = __t48;
  +			_t = __t50;
   			_t = _t.getNextSibling();
   			
   				  	  expr = new UnaryExpression(castType, inner);
  +					  expr.setPosition(o5.getLine(), o5.getColumn());
   				
   			break;
   		}
  @@ -953,35 +1033,37 @@
   		
   				List args = null;
   			
  -		AST __t33 = _t;
  +		AST __t35 = _t;
   		m = _t==ASTNULL ? null :(AST)_t;
   		match(_t,METHOD_INVOCATION);
   		_t = _t.getFirstChild();
   		args=argList(_t);
   		_t = _retTree;
  -		_t = __t33;
  +		_t = __t35;
   		_t = _t.getNextSibling();
   		
   				methodInvoc = new MethodInvocation(null, m.getText(), args);
  +				methodInvoc.setPosition(m.getLine(), m.getColumn());
   			
   		_retTree = _t;
   		return methodInvoc;
   	}
   	
  -	public final FieldAccess  fieldAccess(AST _t) throws RecognitionException {
  -		FieldAccess fieldAccess;
  +	public final NameExpression  nameExpression(AST _t) throws RecognitionException {
  +		NameExpression nameExpr;
   		
  -		AST fieldAccess_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  -		AST f = null;
  +		AST nameExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
  +		AST expr = null;
   		
  -		f = (AST)_t;
  -		match(_t,FIELD_ACCESS);
  +		expr = (AST)_t;
  +		match(_t,NAME_EXPRESSION);
   		_t = _t.getNextSibling();
   		
  -				fieldAccess = new FieldAccess(null, f.getText());
  +				nameExpr = new NameExpression(null, expr.getText());
  +			    nameExpr.setPosition(expr.getLine(), expr.getColumn());
   			
   		_retTree = _t;
  -		return fieldAccess;
  +		return nameExpr;
   	}
   	
   	public final PostfixExpression  postfixExpression(AST _t) throws RecognitionException {
  @@ -993,8 +1075,8 @@
   				Expression        baseExpr     = null;
   				PostfixExpression trailingExpr = null;
   			
  -		AST __t40 = _t;
  -		AST tmp34_AST_in = (AST)_t;
  +		AST __t42 = _t;
  +		AST tmp9_AST_in = (AST)_t;
   		match(_t,SEP_DOT);
   		_t = _t.getFirstChild();
   		baseExpr=expression(_t);
  @@ -1002,9 +1084,9 @@
   		{
   		if (_t==null) _t=ASTNULL;
   		switch ( _t.getType()) {
  -		case FIELD_ACCESS:
  +		case NAME_EXPRESSION:
   		{
  -			trailingExpr=fieldAccess(_t);
  +			trailingExpr=nameExpression(_t);
   			_t = _retTree;
   			break;
   		}
  @@ -1020,7 +1102,7 @@
   		}
   		}
   		}
  -		_t = __t40;
  +		_t = __t42;
   		_t = _t.getNextSibling();
   		
   				expr = trailingExpr;
  @@ -1040,12 +1122,12 @@
   		
   				args = new ArrayList();
   			
  -		AST __t35 = _t;
  -		AST tmp35_AST_in = (AST)_t;
  +		AST __t37 = _t;
  +		AST tmp10_AST_in = (AST)_t;
   		match(_t,ARG_LIST);
   		_t = _t.getFirstChild();
   		{
  -		_loop37:
  +		_loop39:
   		do {
   			if (_t==null) _t=ASTNULL;
   			if ((_tokenSet_0.member(_t.getType()))) {
  @@ -1056,12 +1138,12 @@
   				
   			}
   			else {
  -				break _loop37;
  +				break _loop39;
   			}
   			
   		} while (true);
   		}
  -		_t = __t35;
  +		_t = __t37;
   		_t = _t.getNextSibling();
   		_retTree = _t;
   		return args;
  @@ -1086,7 +1168,7 @@
   		"CAST",
   		"METHOD_INVOCATION",
   		"ARG_LIST",
  -		"FIELD_ACCESS",
  +		"NAME_EXPRESSION",
   		"PRIMITIVE_TYPE",
   		"NAME",
   		"\"import\"",
  
  
  
  1.2       +9 -2      db-ojb/src/java/org/apache/ojb/jdo/jdoql/PostfixExpression.java
  
  Index: PostfixExpression.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/PostfixExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PostfixExpression.java	13 May 2004 21:37:08 -0000	1.1
  +++ PostfixExpression.java	16 May 2004 22:15:46 -0000	1.2
  @@ -24,16 +24,23 @@
   public interface PostfixExpression extends Expression
   {
       /**
  +     * Determines whether this postfix expression has a base expression.
  +     * 
  +     * @return <code>true</code> if it has a base expression
  +     */
  +    boolean hasBaseExpression();
  +
  +    /**
        * Returns the base expression.
        * 
        * @return The base expression (can be <code>null</code>)
        */
  -    public Expression getBaseExpression();
  +    Expression getBaseExpression();
   
       /**
        * Sets the base expression.
        * 
        * @param base The base expression (can be <code>null</code>)
        */
  -    public void setBaseExpression(Expression base);
  +    void setBaseExpression(Expression base);
   }
  
  
  
  1.5       +11 -11    db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParser.java
  
  Index: JDOQLParser.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOQLParser.java	13 May 2004 21:37:08 -0000	1.4
  +++ JDOQLParser.java	16 May 2004 22:15:46 -0000	1.5
  @@ -544,7 +544,7 @@
   		}
   		case IDENTIFIER:
   		{
  -			directFeatureAccess();
  +			directAccess();
   			astFactory.addASTChild(currentAST, returnAST);
   			break;
   		}
  @@ -636,11 +636,11 @@
   		returnAST = literal_AST;
   	}
   	
  -	public final void directFeatureAccess() throws RecognitionException, TokenStreamException {
  +	public final void directAccess() throws RecognitionException, TokenStreamException {
   		
   		returnAST = null;
   		ASTPair currentAST = new ASTPair();
  -		AST directFeatureAccess_AST = null;
  +		AST directAccess_AST = null;
   		Token  id = null;
   		AST id_AST = null;
   		
  @@ -657,8 +657,8 @@
   			astFactory.addASTChild(currentAST, returnAST);
   			match(SEP_CLOSING_PARENTHESIS);
   			if ( inputState.guessing==0 ) {
  -				directFeatureAccess_AST = (AST)currentAST.root;
  -				directFeatureAccess_AST.setType(METHOD_INVOCATION);
  +				directAccess_AST = (AST)currentAST.root;
  +				directAccess_AST.setType(METHOD_INVOCATION);
   			}
   			break;
   		}
  @@ -685,8 +685,8 @@
   		case OP_DIVIDE:
   		{
   			if ( inputState.guessing==0 ) {
  -				directFeatureAccess_AST = (AST)currentAST.root;
  -				directFeatureAccess_AST.setType(FIELD_ACCESS);
  +				directAccess_AST = (AST)currentAST.root;
  +				directAccess_AST.setType(NAME_EXPRESSION);
   			}
   			break;
   		}
  @@ -696,8 +696,8 @@
   		}
   		}
   		}
  -		directFeatureAccess_AST = (AST)currentAST.root;
  -		returnAST = directFeatureAccess_AST;
  +		directAccess_AST = (AST)currentAST.root;
  +		returnAST = directAccess_AST;
   	}
   	
   	public final void argList() throws RecognitionException, TokenStreamException {
  @@ -787,7 +787,7 @@
   				tmp27_AST = astFactory.create(LT(1));
   				astFactory.makeASTRoot(currentAST, tmp27_AST);
   				match(SEP_DOT);
  -				directFeatureAccess();
  +				directAccess();
   				astFactory.addASTChild(currentAST, returnAST);
   			}
   			else {
  @@ -1432,7 +1432,7 @@
   		"CAST",
   		"METHOD_INVOCATION",
   		"ARG_LIST",
  -		"FIELD_ACCESS",
  +		"NAME_EXPRESSION",
   		"PRIMITIVE_TYPE",
   		"NAME",
   		"\"import\"",
  
  
  
  1.5       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParserTokenTypes.txt
  
  Index: JDOQLParserTokenTypes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLParserTokenTypes.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOQLParserTokenTypes.txt	13 May 2004 21:37:09 -0000	1.4
  +++ JDOQLParserTokenTypes.txt	16 May 2004 22:15:46 -0000	1.5
  @@ -13,7 +13,7 @@
   CAST=14
   METHOD_INVOCATION=15
   ARG_LIST=16
  -FIELD_ACCESS=17
  +NAME_EXPRESSION=17
   PRIMITIVE_TYPE=18
   NAME=19
   LITERAL_IMPORT="import"=20
  
  
  
  1.3       +10 -2     db-ojb/src/java/org/apache/ojb/jdo/jdoql/UnaryExpression.java
  
  Index: UnaryExpression.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/UnaryExpression.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UnaryExpression.java	13 May 2004 21:37:09 -0000	1.2
  +++ UnaryExpression.java	16 May 2004 22:15:46 -0000	1.3
  @@ -20,7 +20,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class UnaryExpression implements Expression
  +public class UnaryExpression extends QueryTreeNode implements Expression
   {
       public static final int OPERATOR_MINUS              = 0;
       public static final int OPERATOR_PLUS               = 1;
  @@ -75,7 +75,7 @@
        * 
        * @return The inner expression 
        */
  -    public Expression getInner()
  +    public Expression getInnerExpression()
       {
           return _inner;
       }
  @@ -89,6 +89,14 @@
       public Type getCastType()
       {
           return _castType;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/NullLiteral.java
  
  Index: NullLiteral.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/NullLiteral.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NullLiteral.java	12 May 2004 22:30:49 -0000	1.1
  +++ NullLiteral.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,13 +20,21 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class NullLiteral implements Expression
  +public class NullLiteral extends QueryTreeNode implements Expression
   {
       /**
        * Creates a new null literal object. 
        */
       public NullLiteral()
       {
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.5       +1 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTokenTypes.java
  
  Index: JDOQLTokenTypes.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/JDOQLTokenTypes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDOQLTokenTypes.java	13 May 2004 21:37:09 -0000	1.4
  +++ JDOQLTokenTypes.java	16 May 2004 22:15:46 -0000	1.5
  @@ -33,7 +33,7 @@
   	int CAST = 14;
   	int METHOD_INVOCATION = 15;
   	int ARG_LIST = 16;
  -	int FIELD_ACCESS = 17;
  +	int NAME_EXPRESSION = 17;
   	int PRIMITIVE_TYPE = 18;
   	int NAME = 19;
   	int LITERAL_IMPORT = 20;
  
  
  
  1.2       +9 -1      db-ojb/src/java/org/apache/ojb/jdo/jdoql/Literal.java
  
  Index: Literal.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/Literal.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Literal.java	12 May 2004 22:30:49 -0000	1.1
  +++ Literal.java	16 May 2004 22:15:46 -0000	1.2
  @@ -20,7 +20,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class Literal implements Expression
  +public class Literal extends QueryTreeNode implements Expression
   {
       /** The type of the literal */
       private Class  _type;
  @@ -57,6 +57,14 @@
       public Class getType()
       {
           return _type;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.3       +91 -46    db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-treeparser.g
  
  Index: jdoql-ojb-treeparser.g
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/jdoql-ojb-treeparser.g,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jdoql-ojb-treeparser.g	13 May 2004 21:37:09 -0000	1.2
  +++ jdoql-ojb-treeparser.g	16 May 2004 22:15:46 -0000	1.3
  @@ -59,6 +59,7 @@
   	#( PARAMETER varType=type name:IDENTIFIER )
       {
     	    varDecl = new LocalVariable(varType, name.getText());
  +  	    varDecl.setPosition(varType.getLine(), varType.getColumn());
       }
       ;
   
  @@ -89,6 +90,7 @@
   	#( VARIABLE varType=type name:IDENTIFIER )
       {
     	    varDecl = new LocalVariable(varType, name.getText());
  +  	    varDecl.setPosition(varType.getLine(), varType.getColumn());
       }
       ;
   
  @@ -114,13 +116,15 @@
   
   importDeclaration returns [Import importDecl]:
   	(
  -	  #( IMPORT name1:NAME )
  +	  #( i1:IMPORT name1:NAME )
   	  {
   	  	  importDecl = new Import(name1.getText(), false);
  +	  	  importDecl.setPosition(i1.getLine(), i1.getColumn());
   	  }
  -	| #( ON_DEMAND_IMPORT name2:NAME )
  +	| #( i2:ON_DEMAND_IMPORT name2:NAME )
   	  {
   	  	  importDecl = new Import(name2.getText(), true);
  +	  	  importDecl.setPosition(i2.getLine(), i2.getColumn());
   	  }
   	)
       ;
  @@ -149,7 +153,7 @@
   		Expression expr = null;
   		boolean    isAscending;
   	}
  -	#( ORDERSPEC expr=expression
  +	#( o:ORDERSPEC expr=expression
         (
           LITERAL_ASCENDING
           {
  @@ -163,6 +167,7 @@
       )
   	{
   		orderingDecl = new Ordering(expr, isAscending);
  +		orderingDecl.setPosition(o.getLine(), o.getColumn());
   	}
       ;
   
  @@ -172,49 +177,65 @@
   expression returns [Expression expr]:
       (
         expr=literal
  +    | expr=nullLiteral
  +    | expr=thisExpression
       | expr=binaryExpression
       | expr=unaryExpression
       | expr=methodInvocation
  -    | expr=fieldAccess
  +    | expr=nameExpression
       | expr=postfixExpression
       )
       ;
   
  -literal returns [Expression expr]:
  +literal returns [Literal literal]:
   	(
   	  l1:LITERAL_TRUE
   	  {
  -	  	  expr = new Literal(boolean.class, l1.getText());
  +	  	  literal = new Literal(boolean.class, l1.getText());
  +		  literal.setPosition(l1.getLine(), l2.getColumn());
   	  }
       | l2:LITERAL_FALSE
   	  {
  -	  	  expr = new Literal(boolean.class, l2.getText());
  -	  }
  -    | LITERAL_NULL
  -	  {
  -	  	  expr = new NullLiteral();
  +	  	  literal = new Literal(boolean.class, l2.getText());
  +		  literal.setPosition(l2.getLine(), l2.getColumn());
   	  }
       | l3:INTEGER_LITERAL
   	  {
  -	  	  expr = new Literal(long.class, l3.getText());
  +	  	  literal = new Literal(long.class, l3.getText());
  +		  literal.setPosition(l3.getLine(), l3.getColumn());
   	  }
       | l4:FLOATING_POINT_LITERAL
   	  {
  -	  	  expr = new Literal(double.class, l4.getText());
  +	  	  literal = new Literal(double.class, l4.getText());
  +		  literal.setPosition(l4.getLine(), l4.getColumn());
   	  }
       | l5:CHARACTER_LITERAL
   	  {
  -	  	  expr = new Literal(char.class, l5.getText());
  +	  	  literal = new Literal(char.class, l5.getText());
  +		  literal.setPosition(l5.getLine(), l5.getColumn());
   	  }
       | l6:STRING_LITERAL
   	  {
  -	  	  expr = new Literal(String.class, l1.getText());
  +	  	  literal = new Literal(String.class, l6.getText());
  +		  literal.setPosition(l6.getLine(), l6.getColumn());
   	  }
  -    | LITERAL_THIS
  -      {
  -      	  expr = new ThisExpression();
  -      }
  -    )
  +	)
  +	;
  +
  +nullLiteral returns [NullLiteral literal]:
  +    l:LITERAL_NULL
  +	{
  +	  	literal = new NullLiteral();
  +		literal.setPosition(l.getLine(), l.getColumn());
  +	}
  +	;
  +
  +thisExpression returns [ThisExpression expr]:
  +    l:LITERAL_THIS
  +    {
  +        expr = new ThisExpression();
  +		expr.setPosition(l.getLine(), l.getColumn());
  +    }
       ;
   
   methodInvocation returns [MethodInvocation methodInvoc]:
  @@ -224,6 +245,7 @@
   	#( m:METHOD_INVOCATION args=argList )
   	{
   		methodInvoc = new MethodInvocation(null, m.getText(), args);
  +		methodInvoc.setPosition(m.getLine(), m.getColumn());
   	}
   	;
   
  @@ -243,10 +265,11 @@
   	)
   	;
   
  -fieldAccess returns [FieldAccess fieldAccess]:
  -	f:FIELD_ACCESS
  +nameExpression returns [NameExpression nameExpr]:
  +	expr:NAME_EXPRESSION
   	{
  -		fieldAccess = new FieldAccess(null, f.getText());
  +		nameExpr = new NameExpression(null, expr.getText());
  +	    nameExpr.setPosition(expr.getLine(), expr.getColumn());
   	}
   	;
   
  @@ -255,7 +278,7 @@
   		Expression        baseExpr     = null;
   		PostfixExpression trailingExpr = null;
   	}
  -	#( SEP_DOT baseExpr=expression ( trailingExpr=fieldAccess | trailingExpr=methodInvocation ) )
  +	#( SEP_DOT baseExpr=expression ( trailingExpr=nameExpression | trailingExpr=methodInvocation ) )
   	{
   		expr = trailingExpr;
   		expr.setBaseExpression(baseExpr);
  @@ -268,25 +291,30 @@
   		Type       castType = null;
   	}
   	(
  -	  #( OP_UNARY_MINUS inner=expression )
  +	  #( o1:OP_UNARY_MINUS inner=expression )
   	  {
   	  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_MINUS, inner);
  +		  expr.setPosition(o1.getLine(), o1.getColumn());
   	  }
  -	| #( OP_UNARY_PLUS inner=expression )
  +	| #( o2:OP_UNARY_PLUS inner=expression )
   	  {
   	  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_PLUS, inner);
  +		  expr.setPosition(o2.getLine(), o2.getColumn());
   	  }
  -	| #( OP_BITWISE_COMPLEMENT inner=expression )
  +	| #( o3:OP_BITWISE_COMPLEMENT inner=expression )
   	  {
   	  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_BITWISE_COMPLEMENT, inner);
  +		  expr.setPosition(o3.getLine(), o3.getColumn());
   	  }
  -	| #( OP_NOT inner=expression )
  +	| #( o4:OP_NOT inner=expression )
   	  {
   	  	  expr = new UnaryExpression(UnaryExpression.OPERATOR_NOT, inner);
  +		  expr.setPosition(o4.getLine(), o4.getColumn());
   	  }
  -	| #( CAST castType=type inner=expression )
  +	| #( o5:CAST castType=type inner=expression )
   	  {
   	  	  expr = new UnaryExpression(castType, inner);
  +		  expr.setPosition(o5.getLine(), o5.getColumn());
   	  }
   	)
       ;
  @@ -297,65 +325,80 @@
   		Expression right = null;
   	}
   	(
  -	  #( OP_MULTIPLY left=expression right=expression )
  +	  #( o1:OP_MULTIPLY left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_MULTIPLY, right);
  +		  expr.setPosition(o1.getLine(), o1.getColumn());
   	  }
  -	| #( OP_DIVIDE left=expression right=expression )
  +	| #( o2:OP_DIVIDE left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_DIVIDE, right);
  +		  expr.setPosition(o2.getLine(), o2.getColumn());
   	  }
  -	| #( OP_BINARY_PLUS left=expression right=expression )
  +	| #( o3:OP_BINARY_PLUS left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_PLUS, right);
  +		  expr.setPosition(o3.getLine(), o3.getColumn());
   	  }
  -	| #( OP_BINARY_MINUS left=expression right=expression )
  +	| #( o4:OP_BINARY_MINUS left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_MINUS, right);
  +		  expr.setPosition(o4.getLine(), o4.getColumn());
   	  }
  -	| #( OP_LOWER left=expression right=expression )
  +	| #( o5:OP_LOWER left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_LOWER, right);
  +		  expr.setPosition(o5.getLine(), o5.getColumn());
   	  }
  -	| #( OP_GREATER left=expression right=expression )
  +	| #( o6:OP_GREATER left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_GREATER, right);
  +		  expr.setPosition(o6.getLine(), o6.getColumn());
   	  }
  -	| #( OP_LOWER_OR_EQUAL left=expression right=expression )
  +	| #( o7:OP_LOWER_OR_EQUAL left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_LOWER_OR_EQUAL, right);
  +		  expr.setPosition(o7.getLine(), o7.getColumn());
   	  }
  -	| #( OP_GREATER_OR_EQUAL left=expression right=expression )
  +	| #( o8:OP_GREATER_OR_EQUAL left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_GREATE_OR_EQUAL, right);
  +		  expr.setPosition(o8.getLine(), o8.getColumn());
   	  }
  -	| #( OP_EQUAL left=expression right=expression )
  +	| #( o9:OP_EQUAL left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_EQUAL, right);
  +		  expr.setPosition(o9.getLine(), o9.getColumn());
   	  }
  -	| #( OP_NOT_EQUAL left=expression right=expression )
  +	| #( o10:OP_NOT_EQUAL left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_NOT_EQUAL, right);
  +		  expr.setPosition(o10.getLine(), o10.getColumn());
   	  }
  -	| #( OP_BITWISE_AND left=expression right=expression )
  +	| #( o11:OP_BITWISE_AND left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_AND, right);
  +		  expr.setPosition(o11.getLine(), o11.getColumn());
   	  }
  -	| #( OP_BITWISE_XOR left=expression right=expression )
  +	| #( o12:OP_BITWISE_XOR left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_XOR, right);
  +		  expr.setPosition(o12.getLine(), o12.getColumn());
   	  }
  -	| #( OP_BITWISE_OR left=expression right=expression )
  +	| #( o13:OP_BITWISE_OR left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_BITWISE_OR, right);
  +		  expr.setPosition(o13.getLine(), o13.getColumn());
   	  }
  -	| #( OP_AND left=expression right=expression )
  +	| #( o14:OP_AND left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_AND, right);
  +		  expr.setPosition(o14.getLine(), o14.getColumn());
   	  }
  -	| #( OP_OR left=expression right=expression )
  +	| #( o15:OP_OR left=expression right=expression )
   	  {
   	  	  expr = new BinaryExpression(left, BinaryExpression.OPERATOR_OR, right);
  +		  expr.setPosition(o15.getLine(), o15.getColumn());
   	  }
   	)
   	;
  @@ -364,11 +407,13 @@
   	(
   	  primitiveTypeName:PRIMITIVE_TYPE
   	  {
  -	     result = new Type(primitiveTypeName.getText(), true);
  +	      result = new Type(primitiveTypeName.getText(), true);
  +	  	  result.setPosition(primitiveTypeName.getLine(), primitiveTypeName.getColumn());
   	  }
   	| typeName:NAME
   	  {
  -	     result = new Type(typeName.getText(), false);
  +	      result = new Type(typeName.getText(), false);
  +	  	  result.setPosition(typeName.getLine(), typeName.getColumn());
   	  }
   	)
   	;
  
  
  
  1.3       +9 -52     db-ojb/src/java/org/apache/ojb/jdo/jdoql/FieldAccess.java
  
  Index: FieldAccess.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/FieldAccess.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FieldAccess.java	13 May 2004 21:37:09 -0000	1.2
  +++ FieldAccess.java	16 May 2004 22:15:46 -0000	1.3
  @@ -16,72 +16,29 @@
    */
   
   /**
  - * A field access expression.
  + * A field access expression. Note that this expression type can only be
  + * present in a query tree after resolving it.
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class FieldAccess implements PostfixExpression
  +public class FieldAccess extends NameExpression implements PostfixExpression
   {
  -    /** The base expression (can be <code>null</code>) */
  -    private Expression _base;
  -    /** The field name */
  -    private String     _fieldName;
  -
       /**
        * Creates a new field access object.
        * 
  -     * @param base      The base expression (can be <code>null</code>)
  -     * @param fieldName The name of the field
  -     */
  -    public FieldAccess(Expression base, String fieldName)
  -    {
  -        _base      = base;
  -        _fieldName = fieldName;
  -    }
  -
  -    /**
  -     * Returns the base expression.
  -     * 
  -     * @return The base expression (can be <code>null</code>)
  -     */
  -    public Expression getBaseExpression()
  -    {
  -        return _base;
  -    }
  -
  -    /**
  -     * Sets the base expression.
  -     * 
        * @param base The base expression (can be <code>null</code>)
  +     * @param name The field's name
        */
  -    public void setBaseExpression(Expression base)
  -    {
  -        _base = base;
  -    }
  -
  -    /**
  -     * Returns the name of the accessed field.
  -     * 
  -     * @return The field's name 
  -     */
  -    public String getFieldName()
  +    public FieldAccess(Expression base, String name)
       {
  -        return _fieldName;
  +        super(base, name);
       }
   
       /* (non-Javadoc)
  -     * @see java.lang.Object#toString()
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
        */
  -    public String toString()
  +    public void accept(Visitor visitor)
       {
  -        StringBuffer result = new StringBuffer();
  -
  -        if (_base != null)
  -        {
  -            result.append(_base.toString());
  -            result.append(".");
  -        }
  -        result.append(_fieldName);
  -        return result.toString();
  +        visitor.visit(this);
       }
   }
  
  
  
  1.2       +10 -2     db-ojb/src/java/org/apache/ojb/jdo/jdoql/Ordering.java
  
  Index: Ordering.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/Ordering.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ordering.java	12 May 2004 22:30:49 -0000	1.1
  +++ Ordering.java	16 May 2004 22:15:46 -0000	1.2
  @@ -16,11 +16,11 @@
    */
   
   /**
  - * Encapsulates a ordering expression.
  + * Encapsulates an ordering.
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class Ordering
  +public class Ordering extends QueryTreeNode
   {
       /** The ordering expression */
       private Expression _expr;
  @@ -57,6 +57,14 @@
       public boolean isAscending()
       {
           return _isAscending;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.3       +21 -9     db-ojb/src/java/org/apache/ojb/jdo/jdoql/MethodInvocation.java
  
  Index: MethodInvocation.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/jdoql/MethodInvocation.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MethodInvocation.java	13 May 2004 21:37:09 -0000	1.2
  +++ MethodInvocation.java	16 May 2004 22:15:46 -0000	1.3
  @@ -22,7 +22,7 @@
    * 
    * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
    */
  -public class MethodInvocation implements PostfixExpression
  +public class MethodInvocation extends QueryTreeNode implements PostfixExpression
   {
       /** The base expression (can be <code>null</code>) */
       private Expression _base;
  @@ -45,20 +45,24 @@
           _args       = args;
       }
   
  -    /**
  -     * Returns the base expression.
  -     * 
  -     * @return The base expression (can be <code>null</code>)
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.PostfixExpression#hasBaseExpression()
  +     */
  +    public boolean hasBaseExpression()
  +    {
  +        return _base != null;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.PostfixExpression#getBaseExpression()
        */
       public Expression getBaseExpression()
       {
           return _base;
       }
   
  -    /**
  -     * Sets the base expression.
  -     * 
  -     * @param base The base expression (can be <code>null</code>)
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.PostfixExpression#setBaseExpression(org.apache.ojb.jdo.jdoql.Expression)
        */
       public void setBaseExpression(Expression base)
       {
  @@ -83,6 +87,14 @@
       public List getArguments()
       {
           return _args;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
  +     */
  +    public void accept(Visitor visitor)
  +    {
  +        visitor.visit(this);
       }
   
       /* (non-Javadoc)
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/QueryTreeResolver.java
  
  Index: QueryTreeResolver.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Resolves and checks the query trees. This involves the following things:<br/>
   * <ul>
   * <li>Replace {@link NameExpression NameExpression} with {@link LocalVariableAccess VariableAccess},
   *     {@link FieldAccess FieldAccess}, or {@link TypeAccess TypeAccess}</li>
   * <li>Resolve types referenced by {@link Type Type} and {@link TypeAccess TypeAccess}</li>
   * <li>Resolve features/variables referenced by {@link LocalVariableAccess VariableAccess},
   *     {@link FieldAccess FieldAccess}, and {@link MethodInvocation MethodInvocation}</li>
   * <li>Check that expression types are valid, e.g. that the types of the two sides of a binary
   *     expression are compatible to each other and that this binary operator can be applied
   *     to them</li>
   * <li>Check that the accessed methods are allowed to be accessed as per JDO spec (or
   *     extensions allowed by OJB)</li>
   * <li>Check that for each accessed variable there is a variable or parameter defined</li>
   * <li>Check that each accessed field is persistent</li>
   * </ul> 
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class QueryTreeResolver extends VisitorBase
  {
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.BinaryExpression)
       */
      public void visit(BinaryExpression binExpr)
      {
          super.visit(binExpr);
          // TODO: Now check that the types of the sub expressions are compatible
          //       and that this operator can be applied to them
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.FieldAccess)
       */
      public void visit(FieldAccess fieldAccess)
      {
          // TODO: Resolve the field (->PersistentField object)
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.LocalVariableAccess)
       */
      public void visit(LocalVariableAccess localVarAccess)
      {
          // TODO: Resolve the accessed local variable or parameter
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.MethodInvocation)
       */
      public void visit(MethodInvocation methodInvoc)
      {
          super.visit(methodInvoc);
          // TODO: Resolve accessed method at type of base expression (or extent if
          //       without a base expression)
          //       A method may only be called upon a Collection or a String
          //       so check these types and the methods as allowed per JDO Spec or OJB
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.NameExpression)
       */
      public void visit(NameExpression nameExpr)
      {
          super.visit(nameExpr);
          // TODO: Replace the name expression by a corresponding variable access,
          //       field access, or type access, and then visit the resulting expression
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.Type)
       */
      public void visit(Type type)
      {
          // TODO: Resolve the type (class, and class descriptor if possible)
          //       We need to determine under what exact circumstances a type
          //       must be persistent 
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.TypeAccess)
       */
      public void visit(TypeAccess typeAccess)
      {
          // TODO: Resolve the accessed type
          //       We need to determine under what exact circumstances a type
          //       can be accessed within a query (this includes inner types accessed
          //       at a variable/field)
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.UnaryExpression)
       */
      public void visit(UnaryExpression unaryExpr)
      {
          super.visit(unaryExpr);
          // TODO: Now check that this operator can be applied to the inner expression
          //       (esp. a cast expression)
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/LocalVariableAccess.java
  
  Index: LocalVariableAccess.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * A local variable access expression. Note that this expression type can only be
   * present in a query tree after resolving it.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class LocalVariableAccess extends NameExpression implements PostfixExpression
  {
      /**
       * Creates a new variable access object.
       * 
       * @param name The variable's name
       */
      public LocalVariableAccess(String name)
      {
          super(null, name);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
       */
      public void accept(Visitor visitor)
      {
          visitor.visit(this);
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/VisitorBase.java
  
  Index: VisitorBase.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * Convenience base class for visitors that provides basic traversal capabilities.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class VisitorBase implements Visitor
  {
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visitFilter(org.apache.ojb.jdo.jdoql.Expression)
       */
      public void visitFilter(Expression filterExpr)
      {
          filterExpr.accept(this);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visitOrderings(java.util.List)
       */
      public void visitOrderings(List orderings)
      {
          for (Iterator it = orderings.iterator(); it.hasNext();)
          {
              ((Acceptor)it.next()).accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visitParameters(java.util.List)
       */
      public void visitParameters(List params)
      {
          for (Iterator it = params.iterator(); it.hasNext();)
          {
              ((Acceptor)it.next()).accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visitVariables(java.util.List)
       */
      public void visitVariables(List variables)
      {
          for (Iterator it = variables.iterator(); it.hasNext();)
          {
              ((Acceptor)it.next()).accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.BinaryExpression)
       */
      public void visit(BinaryExpression binExpr)
      {
          binExpr.getLeftSide().accept(this);
          binExpr.getRightSide().accept(this);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.FieldAccess)
       */
      public void visit(FieldAccess fieldAccess)
      {
          if (fieldAccess.hasBaseExpression())
          {
              fieldAccess.getBaseExpression().accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.Import)
       */
      public void visit(Import importSpec)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.Literal)
       */
      public void visit(Literal literal)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.LocalVariable)
       */
      public void visit(LocalVariable localVar)
      {
          localVar.getType().accept(this);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.LocalVariableAccess)
       */
      public void visit(LocalVariableAccess localVarAccess)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.MethodInvocation)
       */
      public void visit(MethodInvocation methodInvoc)
      {
          if (methodInvoc.hasBaseExpression())
          {
              methodInvoc.getBaseExpression().accept(this);
          }
          for (Iterator it = methodInvoc.getArguments().iterator(); it.hasNext();)
          {
              ((Acceptor)it.next()).accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.NullLiteral)
       */
      public void visit(NullLiteral nullLit)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.Ordering)
       */
      public void visit(Ordering ordering)
      {
          ordering.getExpression().accept(this);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.ThisExpression)
       */
      public void visit(ThisExpression thisExpr)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.Type)
       */
      public void visit(Type type)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.TypeAccess)
       */
      public void visit(TypeAccess typeAccess)
      {
          if (typeAccess.hasBaseExpression())
          {
              typeAccess.getBaseExpression().accept(this);
          }
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.UnaryExpression)
       */
      public void visit(UnaryExpression unaryExpr)
      {
          if (unaryExpr.getOperator() == UnaryExpression.OPERATOR_CAST)
          {
              unaryExpr.getCastType().accept(this);
          }
          unaryExpr.getInnerExpression().accept(this);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Visitor#visit(org.apache.ojb.jdo.jdoql.NameExpression)
       */
      public void visit(NameExpression nameExpr)
      {
          if (nameExpr.hasBaseExpression())
          {
              nameExpr.getBaseExpression().accept(this);
          }
      }
  
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/NameExpression.java
  
  Index: NameExpression.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * A name expression which can mean an access to a variable/field or to a type.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class NameExpression extends QueryTreeNode implements PostfixExpression
  {
      /** The base expression (can be <code>null</code>) */
      private Expression _base;
      /** The name */
      private String     _name;
  
      /**
       * Creates a new name expression object.
       * 
       * @param base The base expression (can be <code>null</code>)
       * @param name The name
       */
      public NameExpression(Expression base, String name)
      {
          _base = base;
          _name = name;
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.PostfixExpression#hasBaseExpression()
       */
      public boolean hasBaseExpression()
      {
          return _base != null;
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.PostfixExpression#getBaseExpression()
       */
      public Expression getBaseExpression()
      {
          return _base;
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.PostfixExpression#setBaseExpression(org.apache.ojb.jdo.jdoql.Expression)
       */
      public void setBaseExpression(Expression base)
      {
          _base = base;
      }
  
      /**
       * Returns the name.
       * 
       * @return The name
       */
      public String getName()
      {
          return _name;
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
       */
      public void accept(Visitor visitor)
      {
          visitor.visit(this);
      }
  
      /* (non-Javadoc)
       * @see java.lang.Object#toString()
       */
      public String toString()
      {
          StringBuffer result = new StringBuffer();
  
          if (_base != null)
          {
              result.append(_base.toString());
              result.append(".");
          }
          result.append(_name);
          return result.toString();
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/ASTWithPositionInfo.java
  
  Index: ASTWithPositionInfo.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import antlr.CommonAST;
  import antlr.Token;
  import antlr.collections.AST;
  
  /**
   * An AST node that also contains position info (for error handling).
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class ASTWithPositionInfo extends CommonAST
  {
      /** The line where the source of this node started. */
      private int _line   = 0;
      /** The column where the source of this node started. */
      private int _column = 0;
  
      /**
       * Creates a new node.
       */
      public ASTWithPositionInfo()
      {
          super();
      }
  
      /**
       * Creates a new node for the given token.
       * 
       * @param tok The token
       */
      public ASTWithPositionInfo(Token tok)
      {
          super(tok);
      }
  
      /**
       * Returns the column where the source of this node started.
       * 
       * @return The column
       * @see antlr.collections.AST#getColumn()
       */
      public int getColumn()
      {
          return _column;
      }
  
      /**
       * Returns the line where the source of this node started.
       * 
       * @return The line
       * @see antlr.collections.AST#getLine()
       */
      public int getLine()
      {
          return _line;
      }
  
      /* (non-Javadoc)
       * @see antlr.collections.AST#initialize(antlr.collections.AST)
       */
      public void initialize(AST ast)
      {
          super.initialize(ast);
          _line   = ast.getLine();
          _column = ast.getColumn();
      }
  
      /* (non-Javadoc)
       * @see antlr.collections.AST#initialize(antlr.Token)
       */
      public void initialize(Token tok)
      {
          super.initialize(tok);
          _line   = tok.getLine();
          _column = tok.getColumn();
      }
  
      /* (non-Javadoc)
       * @see antlr.collections.AST#addChild(antlr.collections.AST)
       */
      public void addChild(AST ast)
      {
          if ((ast != null) && (down == null) && (_line == 0) && (_column == 0))
          {
              _line   = ast.getLine();
              _column = ast.getColumn();
          }
          super.addChild(ast);
      }
  
      /* (non-Javadoc)
       * @see antlr.collections.AST#setFirstChild(antlr.collections.AST)
       */
      public void setFirstChild(AST ast)
      {
          if ((ast != null) && (_line == 0) && (_column == 0))
          {
              _line   = ast.getLine();
              _column = ast.getColumn();
          }
          super.setFirstChild(ast);
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/QueryTreeNode.java
  
  Index: QueryTreeNode.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Base class for nodes of the query trees.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public abstract class QueryTreeNode implements Acceptor
  {
      /** The line where the source of this node started. */
      private int _line   = 0;
      /** The column where the source of this node started. */
      private int _column = 0;
  
      /**
       * Sets the position of this node in the source.
       * 
       * @param line   The line
       * @param column The column
       */
      public void setPosition(int line, int column)
      {
          _line   = line;
          _column = column;
      }
      
      /**
       * Returns the column where the source of this node started.
       * 
       * @return The column
       */
      public int getColumn()
      {
          return _column;
      }
  
      /**
       * Returns the line where the source of this node started.
       * 
       * @return The line
       */
      public int getLine()
      {
          return _line;
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/TypeAccess.java
  
  Index: TypeAccess.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * A type access expression. Note that this expression type can only be
   * present in a query tree after resolving it.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public class TypeAccess extends NameExpression implements PostfixExpression
  {
      /**
       * Creates a new type access object.
       * 
       * @param base The base expression (can be <code>null</code>)
       * @param name The type's name
       */
      public TypeAccess(Expression base, String name)
      {
          super(base, name);
      }
  
      /* (non-Javadoc)
       * @see org.apache.ojb.jdo.jdoql.Acceptor#accept(org.apache.ojb.jdo.jdoql.Visitor)
       */
      public void accept(Visitor visitor)
      {
          visitor.visit(this);
      }
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/Visitor.java
  
  Index: Visitor.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  import java.util.List;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Denotes types that visit the jdoql expression trees.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public interface Visitor
  {
      /**
       * Processes the variable declarations.
       * 
       * @param variables The variables
       */
      public void visitVariables(List variables);
  
      /**
       * Processes the parameter declarations.
       * 
       * @param params The parameters
       */
      public void visitParameters(List params);
  
      /**
       * Processes the orderings.
       * 
       * @param orderings The orderings
       */
      public void visitOrderings(List orderings);
  
      /**
       * Processes the filter expression.
       * 
       * @param filterExpr The filter expression
       */
      public void visitFilter(Expression filterExpr);
  
      /**
       * Processes the given binary expression.
       * 
       * @param binExpr The binary expression to process
       */
      void visit(BinaryExpression binExpr);
  
      /**
       * Processes the given field access expression.
       * 
       * @param fieldAccess The field access to process
       */
      void visit(FieldAccess fieldAccess);
  
      /**
       * Processes the given import specification.
       * 
       * @param nullLit The import specification to process
       */
      void visit(Import importSpec);
  
      /**
       * Processes the given literal.
       * 
       * @param literal The literal to process
       */
      void visit(Literal literal);
  
      /**
       * Processes the given local variable declaration.
       * 
       * @param localVar The local variable declaration to process
       */
      void visit(LocalVariable localVar);
  
      /**
       * Processes the given local variable access expression.
       * 
       * @param localVarAccess The local variable access expression to process
       */
      void visit(LocalVariableAccess localVarAccess);
  
      /**
       * Processes the given method invocation expression.
       * 
       * @param methodInvoc The method invocation expression to process
       */
      void visit(MethodInvocation methodInvoc);
  
      /**
       * Processes the given name expression.
       * 
       * @param varAccess The name expression to process
       */
      void visit(NameExpression nameExpr);
  
      /**
       * Processes the given <code>null</code> literal.
       * 
       * @param nullLit The <code>null</code> literal to process
       */
      void visit(NullLiteral nullLit);
  
      /**
       * Processes the given ordering.
       * 
       * @param ordering The ordering to process
       */
      void visit(Ordering ordering);
  
      /**
       * Processes the given <code>this</code> expression.
       * 
       * @param thisExpr The <code>this</code> expression to process
       */
      void visit(ThisExpression thisExpr);
      
      /**
       * Processes the given type.
       * 
       * @param type The type to process
       */
      void visit(Type type);
  
      /**
       * Processes the given type access expression.
       * 
       * @param type The type access expression to process
       */
      void visit(TypeAccess typeAccess);
  
      /**
       * Processes the given unary expression.
       * 
       * @param unaryExpr The unary expression to process
       */
      void visit(UnaryExpression unaryExpr);
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/jdoql/Acceptor.java
  
  Index: Acceptor.java
  ===================================================================
  package org.apache.ojb.jdo.jdoql;
  
  /* Copyright 2003-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Denotes types that accept a visitor object.
   * 
   * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak</a>
   */
  public interface Acceptor
  {
      void accept(Visitor visitor);
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message