Skip to content

Commit

Permalink
Fix: do not repeat rule names in NoMatch exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
igordejanovic committed Oct 14, 2020
1 parent 64fbd6a commit a1f14be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arpeggio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
import codecs
import re
import bisect
Expand Down Expand Up @@ -88,8 +89,8 @@ def rule_to_exp_str(rule):
if not self.rules:
err_message = "Not expected input"
else:
what_is_expected = ["{}".format(rule_to_exp_str(r))
for r in self.rules]
what_is_expected = OrderedDict.fromkeys(
["{}".format(rule_to_exp_str(r)) for r in self.rules])
what_str = " or ".join(what_is_expected)
err_message = "Expected {}".format(what_str)

Expand Down

0 comments on commit a1f14be

Please sign in to comment.