def add_mod(self, seq, mod): """Create a tree.{Complement, LookAhead, Neg, Until}""" modstr = self.value(mod) if modstr == '~': seq.parser_tree = parsing.Complement(seq.parser_tree) elif modstr == '!!': seq.parser_tree = parsing.LookAhead(seq.parser_tree) elif modstr == '!': seq.parser_tree = parsing.Neg(seq.parser_tree) elif modstr == '->': seq.parser_tree = parsing.Until(seq.parser_tree) return True
def test_19_Until(self): """ Basic test for until ->R """ parser = parsing.Parser() parser.parsed_stream("==|=|==tutu") parseTree = parsing.Seq( parsing.Until(parsing.Call(parsing.Parser.read_text, '|==')), parsing.Call(parsing.Parser.read_text, 'tutu'), ) res = parseTree(parser) self.assertEqual(res, True, "failed to get the correct final value")