Fixed mysterious error message if start defined as a function

This commit is contained in:
David Beazley 2019-04-09 17:18:29 -05:00
parent 5bf4d9707d
commit d9c763d2f7
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,9 @@
Version 0.4
-----------
04/09/2019 Fixed very mysterious error message that resulted if you
defined a grammar rule called "start". start can now
be a string or a function.
04/09/2019 Minor refinement to the reporting of reduce/reduce conflicts.
If a top grammar rule wasn't specified, SLY could fail with
a mysterious "unknown conflict" exception. This should be

View File

@ -486,6 +486,9 @@ class Grammar(object):
# -----------------------------------------------------------------------------
def set_start(self, start=None):
if callable(start):
start = start.__name__
if not start:
start = self.Productions[1].name