sjm.examples.query
Class ComparisonParser
java.lang.Object
|
+--sjm.examples.query.ComparisonParser
- public class ComparisonParser
- extends java.lang.Object
This utility class provides support to the Jaql
parser, specifically for expression()
and comparison() subparsers.
The grammar this class supports is:
comparison = arg operator arg;
arg = expression | QuotedString;
expression = term ('+' term | '-' term)*;
term = factor ('*' factor | '/' factor)*;
factor = '(' expression ')' | Num | variable;
variable = Word;
operator = "<" | ">" | "=" | "<=" | ">=" | "!=";
|
Constructor Summary |
ComparisonParser(Speller speller)
Construct a ComparisonParser that will consult the
given speller for the proper spelling of variable
names. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
expression
protected Sequence expression
speller
protected Speller speller
ComparisonParser
public ComparisonParser(Speller speller)
- Construct a ComparisonParser that will consult the
given speller for the proper spelling of variable
names.
arg
public Parser arg()
- Returns a parser that will recognize a comparison
argument.
comparison
public Parser comparison()
- Returns a parser that will recognize a comparison.
divideFactor
protected Parser divideFactor()
expression
public Parser expression()
- Returns a parser that will recognize an arithmetic
expression.
factor
protected Parser factor()
minusTerm
protected Parser minusTerm()
operator
protected Parser operator()
plusTerm
protected Parser plusTerm()
term
protected Parser term()
timesFactor
protected Parser timesFactor()
variable
protected Parser variable()