Skip to content

Commit

Permalink
Add an error message when using Lark.save() when parser!='lalr' (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh authored Aug 23, 2023
1 parent 656334c commit fbe6f4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lark/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ def save(self, f, exclude_options: Collection[str] = ()) -> None:
Useful for caching and multiprocessing.
"""
if self.options.parser != 'lalr':
raise NotImplementedError("Lark.save() is only implemented for the LALR(1) parser.")
data, m = self.memo_serialize([TerminalDef, Rule])
if exclude_options:
data["options"] = {n: v for n, v in data["options"].items() if n not in exclude_options}
Expand Down

0 comments on commit fbe6f4c

Please sign in to comment.