diff --git a/CHANGES b/CHANGES index 8432ebd..e76da56 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/sly/yacc.py b/sly/yacc.py index 33d2c6f..c30f13c 100644 --- a/sly/yacc.py +++ b/sly/yacc.py @@ -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