Beispiel #1
0
 private Ast.Predicate predicate()
 {
     trace("FIQLParser.Parser.predicate()");
     if (accept(Symbol.ident))
     {
         var predicate = new Ast.Predicate();
         predicate.ident = new Ast.Identifier(lastToken());
         if (accept(Symbol.lessthan) ||
             accept(Symbol.lessequal) ||
             accept(Symbol.greaterthan) ||
             accept(Symbol.greaterequal)
             )
         {
             predicate.op     = new Ast.Operator(lastToken());
             predicate.rvalue = value();
         }
         else if (accept(Symbol.equal) || accept(Symbol.notequal))
         {
             predicate.op     = new Ast.Operator(lastToken());
             predicate.rvalue = equatable();
         }
         else
         {
             throw error("predicate: " + expectedMessage());
         }
         return(predicate);
     }
     throw error("predicate: must start with identifier");
 }
Beispiel #2
0
 public String Visit(Ast.Predicate predicate)
 {
     try {
         wildFlag = (predicate.rvalue.Token.symbol == Symbol.wildstring);
         return(predicate.ident.Accept(this)
                + predicate.op.Accept(this)
                + predicate.rvalue.Accept(this));
     } finally {
         wildFlag = false;
     }
 }