Add the grammar as an argument to saving the parser.

This makes collisions of different grammars when loading from the cache impossible.
This commit is contained in:
Dave Halter
2017-03-22 18:32:49 +01:00
parent c41bee4253
commit 26cce4d078
10 changed files with 41 additions and 34 deletions

View File

@@ -46,8 +46,9 @@ def check_p(src, number_parsers_used, number_of_splits=None, number_of_misses=0)
if number_of_splits is None:
number_of_splits = number_parsers_used
p = FastParser(load_grammar(), u(src))
save_parser(None, p, pickling=False)
grammar = load_grammar()
p = FastParser(grammar, u(src))
save_parser(grammar, None, p, pickling=False)
assert src == p.get_root_node().get_code()
return p.get_root_node()