@Test public void testParsesMultiCorrectly() { Evaluator eval = QueryParser.parse(".foo > ol, ol > li + li"); assertTrue(eval instanceof CombiningEvaluator.Or); CombiningEvaluator.Or or = (CombiningEvaluator.Or) eval; assertEquals(2, or.evaluators.size()); CombiningEvaluator.And andLeft = (CombiningEvaluator.And) or.evaluators.get(0); CombiningEvaluator.And andRight = (CombiningEvaluator.And) or.evaluators.get(1); assertEquals("ol :ImmediateParent.foo", andLeft.toString()); assertEquals(2, andLeft.evaluators.size()); assertEquals("li :prevli :ImmediateParentol", andRight.toString()); assertEquals(2, andLeft.evaluators.size()); }
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private  QueryParser(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private  QueryParser(String query); static Evaluator parse(String query); }
QueryParser { public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } } private  QueryParser(String query); static Evaluator parse(String query);  }