opendap.dap.parser
Class ExprParser

java.lang.Object
  extended by opendap.dap.parser.ExprParser
All Implemented Interfaces:
ExprParserConstants

public class ExprParser
extends java.lang.Object
implements ExprParserConstants

The constraint expression parser class.

Because it only makes sense to evaluate CEs when serving data, the BaseTyeFactory must create instances of the SDtype classes, not the Dtype classes. The is because we use the setRead method of the class ServerMethods when creating constants (to ensure that the evaluator doesn't try to read tem from the dataset!).

Author:
jhrg

Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 ExprParserTokenManager token_source
           
 
Fields inherited from interface opendap.dap.parser.ExprParserConstants
AMPERSAND, COLON, COMMA, DEFAULT, EOF, EQUAL, GREATER, GREATER_EQL, LBRACE, LBRACKET, LESS, LESS_EQL, LPAREN, NOT_EQUAL, RBRACE, RBRACKET, REGEXP, RPAREN, SEPARATOR, tokenImage, WORD
 
Constructor Summary
ExprParser(ExprParserTokenManager tm)
           
ExprParser(java.io.InputStream stream)
           
ExprParser(java.io.InputStream stream, java.lang.String encoding)
           
ExprParser(java.io.Reader stream)
           
 
Method Summary
 java.util.Vector arg_list()
           
 void array_index(int count, ServerArrayMethods bt)
           
 Clause bool_function()
           
 Clause clause()
           
 java.util.Stack component(java.util.Stack components)
           
 BaseType constant()
           
 void constraint_expression(CEEvaluator ceEval, BaseTypeFactory factory, ClauseFactory clauseFactory)
          This is the entry point for the Constraint expression parser.
 void disable_tracing()
           
 void enable_tracing()
           
 java.lang.String field()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void proj_clause()
           
 void proj_variable()
           
 void projection()
           
 void ReInit(ExprParserTokenManager tm)
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
           
 void ReInit(java.io.Reader stream)
           
 int rel_op()
           
 void selection()
           
 SubClause value()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public ExprParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

ExprParser

public ExprParser(java.io.InputStream stream)

ExprParser

public ExprParser(java.io.InputStream stream,
                  java.lang.String encoding)

ExprParser

public ExprParser(java.io.Reader stream)

ExprParser

public ExprParser(ExprParserTokenManager tm)
Method Detail

constraint_expression

public final void constraint_expression(CEEvaluator ceEval,
                                        BaseTypeFactory factory,
                                        ClauseFactory clauseFactory)
                                 throws ParseException,
                                        NoSuchVariableException,
                                        NoSuchFunctionException,
                                        InvalidOperatorException,
                                        DAP2Exception,
                                        InvalidParameterException,
                                        SBHException,
                                        WrongTypeException
This is the entry point for the Constraint expression parser.

Note that this method catches any ParserException and recasts it to a DAP2Exception after replacing all double quotes with single quotes.

Parameters:
ceEval - A CEEvaluator instance where any select clauses will be dumped and from which the DDS, which supplies the evaluation environment, will be read.
factory - A BaseTypeFactory used to generate instances of variables as needed (e.g., to hold values of constants).
clauseFactory - A ClauseFactory used to generate instances of each type of clause.
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
DAP2Exception
InvalidParameterException
SBHException
WrongTypeException

selection

public final void selection()
                     throws ParseException,
                            NoSuchVariableException,
                            NoSuchFunctionException,
                            InvalidOperatorException,
                            ParseException,
                            SBHException,
                            DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
SBHException
DAP2Exception

clause

public final Clause clause()
                    throws ParseException,
                           NoSuchVariableException,
                           NoSuchFunctionException,
                           InvalidOperatorException,
                           ParseException,
                           DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
DAP2Exception

bool_function

public final Clause bool_function()
                           throws ParseException,
                                  NoSuchVariableException,
                                  NoSuchFunctionException,
                                  InvalidOperatorException,
                                  ParseException,
                                  DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
DAP2Exception

rel_op

public final int rel_op()
                 throws ParseException
Throws:
ParseException

projection

public final void projection()
                      throws ParseException,
                             NoSuchVariableException,
                             NoSuchFunctionException,
                             InvalidOperatorException,
                             ParseException,
                             InvalidParameterException,
                             SBHException,
                             WrongTypeException,
                             DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
InvalidParameterException
SBHException
WrongTypeException
DAP2Exception

proj_clause

public final void proj_clause()
                       throws ParseException,
                              NoSuchVariableException,
                              NoSuchFunctionException,
                              InvalidOperatorException,
                              ParseException,
                              InvalidParameterException,
                              SBHException,
                              WrongTypeException,
                              DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
InvalidParameterException
SBHException
WrongTypeException
DAP2Exception

proj_variable

public final void proj_variable()
                         throws ParseException,
                                NoSuchVariableException,
                                NoSuchFunctionException,
                                InvalidOperatorException,
                                ParseException,
                                InvalidParameterException,
                                SBHException,
                                WrongTypeException,
                                DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
InvalidParameterException
SBHException
WrongTypeException
DAP2Exception

component

public final java.util.Stack component(java.util.Stack components)
                                throws ParseException,
                                       ParseException,
                                       DAP2Exception
Throws:
ParseException
DAP2Exception

arg_list

public final java.util.Vector arg_list()
                                throws ParseException,
                                       NoSuchVariableException,
                                       NoSuchFunctionException,
                                       InvalidOperatorException,
                                       ParseException,
                                       DAP2Exception
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
DAP2Exception

array_index

public final void array_index(int count,
                              ServerArrayMethods bt)
                       throws ParseException,
                              ParseException,
                              DAP2Exception,
                              InvalidParameterException,
                              SBHException
Throws:
ParseException
DAP2Exception
InvalidParameterException
SBHException

value

public final SubClause value()
                      throws ParseException,
                             NoSuchVariableException,
                             NoSuchFunctionException,
                             InvalidOperatorException,
                             DAP2Exception,
                             ParseException
Throws:
ParseException
NoSuchVariableException
NoSuchFunctionException
InvalidOperatorException
DAP2Exception

field

public final java.lang.String field()
                             throws ParseException,
                                    ParseException
Throws:
ParseException

constant

public final BaseType constant()
                        throws ParseException,
                               DAP2Exception,
                               ParseException
Throws:
ParseException
DAP2Exception

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(ExprParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()