@Test public void split5() { List<String> tokens = parser.split("a and b AND(((a>=c AND b> d) OR (x <> y )) ) OR t>u"); assertEquals( Arrays.asList( "a", "and", "b", "AND", "(", "(", "(", "a", ">=", "c", "AND", "b", ">", "d", ")", "OR", "(", "x", "<>", "y", ")", ")", ")", "OR", "t", ">", "u"), tokens); }
@SuppressWarnings("unchecked") @Test public void parserCanSplitStrings() throws IOException { Parser parser = new Parser(); parser .split('\n') .token( new TokenFactory<Token<?>>() { @Override public Token<?> create(String content) { // TODO Auto-generated method stub return null; } }); Iterator<? extends Token<?>> iter = parser.feed(new FileReader("notime.txt")); while (iter.hasNext()) { iter.next(); } }
@Test public void split3() { List<String> tokens = parser.split("((a and b))"); assertEquals(Arrays.asList("(", "(", "a", "and", "b", ")", ")"), tokens); }
@Test public void split1() { List<String> tokens = parser.split("a and b"); assertEquals(Arrays.asList("a", "and", "b"), tokens); }