Exemplo n.º 1
0
 @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);
 }
Exemplo n.º 2
0
  @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();
    }
  }
Exemplo n.º 3
0
 @Test
 public void split3() {
   List<String> tokens = parser.split("((a and b))");
   assertEquals(Arrays.asList("(", "(", "a", "and", "b", ")", ")"), tokens);
 }
Exemplo n.º 4
0
 @Test
 public void split1() {
   List<String> tokens = parser.split("a and b");
   assertEquals(Arrays.asList("a", "and", "b"), tokens);
 }