Skip to content

Commit

Permalink
Python3.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeaz committed Feb 18, 2011
1 parent c971fab commit b680111
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
8 changes: 4 additions & 4 deletions ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
September 2, 2009
February 17, 2011

Announcing : PLY-3.3 (Python Lex-Yacc)
Announcing : PLY-3.4 (Python Lex-Yacc)

http://www.dabeaz.com/ply

I'm pleased to announce PLY-3.3--a pure Python implementation of the
common parsing tools lex and yacc. PLY-3.3 is a minor bug fix
I'm pleased to announce PLY-3.4--a pure Python implementation of the
common parsing tools lex and yacc. PLY-3.4 is a minor bug fix
release. It supports both Python 2 and Python 3.

If you are new to PLY, here are a few highlights:
Expand Down
10 changes: 9 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Version (in progress)
Version 3.4
---------------------
02/17/11: beazley
Minor patch to make cpp.py compatible with Python 3. Note: This
is an experimental file not currently used by the rest of PLY.

02/17/11: beazley
Fixed setup.py trove classifiers to properly list PLY as
Python 3 compatible.

01/02/11: beazley
Migration of repository to github.

Expand Down
14 changes: 7 additions & 7 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PLY (Python Lex-Yacc) Version 3.3
PLY (Python Lex-Yacc) Version 3.4

Copyright (C) 2001-2009,
Copyright (C) 2001-2011,
David M. Beazley (Dabeaz LLC)
All rights reserved.

Expand Down Expand Up @@ -177,7 +177,7 @@ def t_newline(t):
t.lexer.lineno += t.value.count("\n")

def t_error(t):
print "Illegal character '%s'" % t.value[0]
print("Illegal character '%s'" % t.value[0])
t.lexer.skip(1)

# Build the lexer
Expand All @@ -200,7 +200,7 @@ def p_statement_assign(p):

def p_statement_expr(p):
'statement : expression'
print p[1]
print(p[1])

def p_expression_binop(p):
'''expression : expression PLUS expression
Expand Down Expand Up @@ -229,18 +229,18 @@ def p_expression_name(p):
try:
p[0] = names[p[1]]
except LookupError:
print "Undefined name '%s'" % p[1]
print("Undefined name '%s'" % p[1])
p[0] = 0

def p_error(p):
print "Syntax error at '%s'" % p.value
print("Syntax error at '%s'" % p.value)

import ply.yacc as yacc
yacc.yacc()

while 1:
try:
s = raw_input('calc > ')
s = raw_input('calc > ') # use input() on Python 3
except EOFError:
break
yacc.parse(s)
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
productions, precedence rules, error recovery, and support for ambiguous grammars.
PLY is extremely easy to use and provides very extensive error checking.
It is compatible with both Python 2 and Python 3.
""",
license="""BSD""",
version = "3.3",
version = "3.4",
author = "David Beazley",
author_email = "dave@dabeaz.com",
maintainer = "David Beazley",
maintainer_email = "dave@dabeaz.com",
url = "http://www.dabeaz.com/ply/",
packages = ['ply'],
classifiers = [
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2',
]
)

0 comments on commit b680111

Please sign in to comment.