예제 #1
0
 @Test
 public void negativeBackwardAssertion() {
   String[] rules = {
     "ROOT = !- 'b' 'a'", //
   };
   Grammar g = new Grammar(new Grammar(rules).describe());
   assertNotNull(g.find("a").match());
 }
예제 #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());
 }