multiple parsers in 2.3

24 views
Skip to first unread message

Jim Crumpler

unread,
May 3, 2008, 3:34:12 PM5/3/08
to ply-hack
Has anything changed in 2.3 that could allow a global state to linger
between multiple parser instances?.. I can't get stable results when
parsing sequential files with different lex/yacc instances. 2.2 and
below seem ok.

parsing a file by itself works ok (no grammatical errors).. parsing it
with a new parser, but in the same program that parsed another file
with the same grammar fails on 2.3 only:

2008-05-03 12:25:40,412 ERROR (mibparser) ADSL-LINE-MIB.mib:1
grammatical error
Traceback (most recent call last):
File "/home/jgc/bin/mib-compiler", line 77, in ?
blah = compiler.compileFiles(filenames)
File "/home/jgc/lib/python/mibtools/mibcompiler.py", line 97, in
compileFiles
self.compileFile(filename)
File "/home/jgc/lib/python/mibtools/mibcompiler.py", line 112, in
compileFile
results = parser.parseFile(filename)
File "/home/jgc/lib/python/mibtools/mibparser.py", line 2405, in
parseFile
self.parser.parse(data, lexer=self.lexer, debug=self.debug)
File "/usr/pkg/lib/python2.4/site-packages/ply/yacc.py", line 314,
in parse
state = goto[statestack[-1]][pname]
IndexError: list index out of range

Any idea where to start looking? or could it be a weirdo grammar
problem of mine that only surfaces in 2.3?

Thanks

Jim..

Jim Crumpler

unread,
May 3, 2008, 3:45:08 PM5/3/08
to ply-hack
Actually, that particular file being parsed does have a grammatically
error, so it appears to be an error state problem being maintained
globally.

Jim.

David Beazley

unread,
May 3, 2008, 5:27:45 PM5/3/08
to ply-hack, Jim Crumpler
I really don't know what this is off the top of my head, but I'll take a look at it and see if I can find anything.

Cheers,
Dave


On Sat 03/05/08 3:34 PM , Jim Crumpler Jim.Cr...@unicity.com.au sent:

David Beazley

unread,
May 3, 2008, 6:09:27 PM5/3/08
to ply-...@googlegroups.com
On further looking, this might be releated to the following entry in the CHANGES file for the upcoming 2.4 release.

11/09/07: beazely
Fixed a bug in error handling in yacc. If a syntax error occurred and the
parser rolled the entire parse stack back, the parser would be left in in
inconsistent state that would cause it to trigger incorrect actions on
subsequent input.

You might try downloading PLY from the Subversion repository and see if the problem goes away.

Jim Crumpler

unread,
May 3, 2008, 9:05:40 PM5/3/08
to ply-hack
Excellent!.. That seems to have done the trick.. It just compiled 300
MIB files happily (and the average SNMP MIB file is loaded with
errors).

Jim.

On May 3, 3:09 pm, David Beazley <d...@dabeaz.com> wrote:
> On further looking, this might be releated to the following entry in the CHANGES file for the upcoming 2.4 release.
>
> 11/09/07: beazely
>           Fixed a bug in error handling in yacc.  If a syntax error occurred and the
>           parser rolled the entire parse stack back, the parser would be left in in
>           inconsistent state that would cause it to trigger incorrect actions on
>           subsequent input.  
>
> You might try downloading PLY from the Subversion repository and see if the problem goes away.
>
> Cheers,
> Dave
>
> On Sat 03/05/08  3:34 PM , Jim Crumpler Jim.Crump...@unicity.com.au sent:
> > Jim..- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages