summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2009-08-27 01:28:42 +0000
committerDavid Beazley <dave@dabeaz.com>2009-08-27 01:28:42 +0000
commitb01e189ad2c4f6e6017b17985c5608099b1fb27f (patch)
tree290d494ed0dfd8f8c9c8c0208e9854bf113df3c1
parent2eac1759d1df351e4c40b4212dd3b354f32a0776 (diff)
downloadply-b01e189ad2c4f6e6017b17985c5608099b1fb27f.tar.gz
A few minor bug fixes
-rw-r--r--CHANGES11
-rw-r--r--doc/ply.html3
-rw-r--r--ply/lex.py5
-rw-r--r--ply/yacc.py2
4 files changed, 17 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 9d8b25d..376a7ab 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,14 @@
+Version 3.3
+-----------------------------
+08/25/09: beazley
+ Fixed issue 15 related to the set_lineno() method in yacc. Reported by
+ mdsherry.
+
+08/25/09: beazley
+ Fixed a bug related to regular expression compilation flags not being
+ properly stored in lextab.py files created by the lexer when running
+ in optimize mode. Reported by Bruce Frederiksen.
+
Version 3.2
-----------------------------
diff --git a/doc/ply.html b/doc/ply.html
index 3345e79..d6cb006 100644
--- a/doc/ply.html
+++ b/doc/ply.html
@@ -1403,7 +1403,8 @@ it only needs to conform to the following requirements:
<ul>
<li>It must provide a <tt>token()</tt> method that returns the next token or <tt>None</tt> if no more
tokens are available.
-<li>The <tt>token()</tt> method must return an object <tt>tok</tt> that has <tt>type</tt> and <tt>value</tt> attributes.
+<li>The <tt>token()</tt> method must return an object <tt>tok</tt> that has <tt>type</tt> and <tt>value</tt> attributes. If
+line number tracking is being used, then the token should also define a <tt>lineno</tt> attribute.
</ul>
<H2><a name="ply_nn22"></a>5. Parsing basics</H2>
diff --git a/ply/lex.py b/ply/lex.py
index 4759d1b..267ec10 100644
--- a/ply/lex.py
+++ b/ply/lex.py
@@ -31,7 +31,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
-__version__ = "3.2"
+__version__ = "3.3"
__tabversion__ = "3.2" # Version of table file used
import re, sys, types, copy, os
@@ -236,7 +236,7 @@ class Lexer:
titem = []
txtitem = []
for i in range(len(lre)):
- titem.append((re.compile(lre[i][0],lextab._lexreflags),_names_to_funcs(lre[i][1],fdict)))
+ titem.append((re.compile(lre[i][0],lextab._lexreflags | re.VERBOSE),_names_to_funcs(lre[i][1],fdict)))
txtitem.append(lre[i][0])
self.lexstatere[key] = titem
self.lexstateretext[key] = txtitem
@@ -969,6 +969,7 @@ def lex(module=None,object=None,debug=0,optimize=0,lextab="lextab",reflags=0,now
lexobj.lexstateinfo = stateinfo
lexobj.lexre = lexobj.lexstatere["INITIAL"]
lexobj.lexretext = lexobj.lexstateretext["INITIAL"]
+ lexobj.lexreflags = reflags
# Set up ignore variables
lexobj.lexstateignore = linfo.ignore
diff --git a/ply/yacc.py b/ply/yacc.py
index 3bf6e8e..a3316cc 100644
--- a/ply/yacc.py
+++ b/ply/yacc.py
@@ -211,7 +211,7 @@ class YaccProduction:
return getattr(self.slice[n],"lineno",0)
def set_lineno(self,n,lineno):
- self.slice[n].lineno = n
+ self.slice[n].lineno = lineno
def linespan(self,n):
startline = getattr(self.slice[n],"lineno",0)