/** * Parse AND, OR and NOT nodes : * * and = '&' filterlist * or = '|' filterlist * not = '!' filter * filterlist = 1*filter * * @return */ private static ExprNode parseBranchNode( ExprNode node, String filter, Position pos ) throws ParseException { BranchNode bNode = ( BranchNode ) node; // We must have at least one filter ExprNode child = parseFilterInternal( filter, pos ); // Add the child to the node children bNode.addNode( child ); // Now, iterate recusively though all the remaining filters, if any while ( ( child = parseFilterInternal( filter, pos ) ) != null ) { // Add the child to the node children bNode.addNode( child ); } return node; }
/** * @see FilterParser#parse(String) */ public static ExprNode parse( String filter ) throws ParseException { // The filter must not be null. This is a defensive test if ( StringTools.isEmpty( filter ) ) { throw new ParseException( I18n.err( I18n.ERR_04158 ), 0 ); } Position pos = new Position(); pos.start = 0; pos.end = 0; pos.length = filter.length(); return parseFilterInternal( filter, pos ); }