Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeaz committed Feb 28, 2009
1 parent ff2ca29 commit 115388b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
6 changes: 3 additions & 3 deletions ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
February 6, 2009
February 28, 2009

Announcing : PLY-3.0 (Python Lex-Yacc)
Announcing : PLY-3.1 (Python Lex-Yacc)

http://www.dabeaz.com/ply

I'm pleased to announce a significant new update to PLY---a 100% Python
implementation of the common parsing tools lex and yacc. PLY-3.0 adds
implementation of the common parsing tools lex and yacc. PLY-3.1 adds
compatibility for Python 2.6 and 3.0, provides some new customization
options, and cleans up a lot of internal implementation details.

Expand Down
11 changes: 11 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Version 3.1
-----------------------------
02/28/09: beazley
Fixed broken start argument to yacc(). PLY-3.0 broke this
feature by accident.

02/28/09: beazley
Fixed debugging output. yacc() no longer reports shift/reduce
or reduce/reduce conflicts if debugging is turned off. This
restores similar behavior in PLY-2.5. Reported by Andrew Waters.

Version 3.0
-----------------------------
02/03/09: beazley
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PLY (Python Lex-Yacc) Version 3.0
PLY (Python Lex-Yacc) Version 3.1

David M. Beazley ([email protected])

Expand Down
32 changes: 18 additions & 14 deletions ply/yacc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3052,7 +3052,10 @@ def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, star

# Set the grammar start symbols
try:
grammar.set_start(pinfo.start)
if start is None:
grammar.set_start(pinfo.start)
else:
grammar.set_start(start)
except GrammarError:
e = sys.exc_info()[1]
errorlog.error(str(e))
Expand Down Expand Up @@ -3141,19 +3144,20 @@ def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, star

lr = LRGeneratedTable(grammar,method,debuglog)

num_sr = len(lr.sr_conflicts)

# Report shift/reduce and reduce/reduce conflicts
if num_sr == 1:
errorlog.warning("1 shift/reduce conflict")
elif num_sr > 1:
errorlog.warning("%d shift/reduce conflicts", num_sr)

num_rr = len(lr.rr_conflicts)
if num_rr == 1:
errorlog.warning("1 reduce/reduce conflict")
elif num_rr > 1:
errorlog.warning("%d reduce/reduce conflicts", num_rr)
if debug:
num_sr = len(lr.sr_conflicts)

# Report shift/reduce and reduce/reduce conflicts
if num_sr == 1:
errorlog.warning("1 shift/reduce conflict")
elif num_sr > 1:
errorlog.warning("%d shift/reduce conflicts", num_sr)

num_rr = len(lr.rr_conflicts)
if num_rr == 1:
errorlog.warning("1 reduce/reduce conflict")
elif num_rr > 1:
errorlog.warning("%d reduce/reduce conflicts", num_rr)

# Write out conflicts to the output file
if debug and (lr.sr_conflicts or lr.rr_conflicts):
Expand Down
12 changes: 4 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
setup(name = "ply",
description="Python Lex & Yacc",
long_description = """
PLY is yet another implementation of lex and yacc for Python. Although several other
parsing tools are available for Python, there are several reasons why you might
want to take a look at PLY:
It's implemented entirely in Python.
It uses LR-parsing which is reasonably efficient and well suited for larger grammars.
PLY is yet another implementation of lex and yacc for Python. Some notable
features include the fact that its implemented entirely in Python and it
uses LALR(1) parsing which is efficient and well suited for larger grammars.
PLY provides most of the standard lex/yacc features including support for empty
productions, precedence rules, error recovery, and support for ambiguous grammars.
PLY is extremely easy to use and provides very extensive error checking.
""",
license="""Lesser GPL (LGPL)""",
version = "3.0",
version = "3.1",
author = "David Beazley",
author_email = "[email protected]",
maintainer = "David Beazley",
Expand Down

0 comments on commit 115388b

Please sign in to comment.