Hello:

I have used Ply for a variety of small-ish parsing projects with great
success.  Now, I'm trying something more ambitious: I'm attempting to
adapt E. Willink's FOG parser to provide a meta-parse of C++.  I just
need to extract class names, methods, and inheritance relationships,
so this sort of meta-parser makes sense.

I've attached my current version of the parser: cxx_parser.py, which
can be run as:

  python cxx_parser.py foo.cpp

The foo.cpp file illustrates a parsing problem that I've run into.
The parse of foo.cpp ends with:

declaration_seq_opt util start_search1 class_key nested_id .
LexToken(LBRACE,'{',4,33) reduce 12
state 259
action None
declaration_seq_opt util start_search1 class_key scoped_id .
LexToken(LBRACE,'{',4,33)
Traceback (most recent call last):
  File "cxx_parser.py", line 2004, in <module>
    parse_cpp(filename=arg,debug=100)

But, if I look at state 259 in parser.out, I see:

state 259

    (412) class_specifier_head -> class_key scoped_id . colon_mark
base_specifier_list LBRACE
    (414) class_specifier_head -> class_key scoped_id . LBRACE
    (410) elaborated_class_specifier -> class_key scoped_id .
    (411) elaborated_class_specifier -> class_key scoped_id .
colon_mark error
    (409) colon_mark -> . :

    LBRACE          shift and go to state 467

This suggests that if LBRACE is the next token on the stack, then from
state 259 you should shift and go to state 467.   Right?

But that isn't happening.  Instead, a 'None' action is occurring, and
an error signal is generated.

This _looks_ like a Ply bug, though I wouldn't be surprised if I'm
just missing some subtle detail.

--Bill

Attachments:

cxx_parser.py
foo.cpp
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to