Ejemplo n.º 1
0
 @Test
 public void negativeBackwardAssertion() {
   String[] rules = {
     "ROOT = !- 'b' 'a'", //
   };
   Grammar g = new Grammar(new Grammar(rules).describe());
   assertNotNull(g.find("a").match());
 }
Ejemplo n.º 2
0
 @Test
 public void basicTest() throws GrammarException, IOException {
   String[] rules = {
     //
     "<ROOT> = <a> <s> <b>", //
     "<a> = 'a'", //
     "<b> = 'b'", //
     "<s> = /\\s++/", //
   };
   Grammar g = new Grammar(rules);
   String s = "a\nb";
   Matcher m = g.find(s);
   assertNotNull("found joe", m.match());
 }