On 06/16/2013 09:25 PM, [email protected] wrote:
Thanks for ideas so far. The grammer I've defined to date is
*#rom* /ID/, *int8* { /int8/, /int8/ … }
*#rom* /ID/, *int16* { /int16/, /int16/ … }
*#rom* /ID/, "/Quoted text string/"
*#rom* /ID/, """
/Block text a/
/la Python/
"""
*#rom* (*locateLo*|*locateHi*)@/addr/
It looks like a 2 stage problem to me, where PLY could play a role.
First perform a line-based search to seperate the #rom sections from the other
sections.
This can be fairly high level, you are not interested in the precise content at this stage, you are
just looking for the end of a #rom section.
Ideally you can do that with some simple string operations and/or re matching. If you have nested
delimiters (eg "{ { } }" ), you need to do some counting,
More complicated options are inspecting a token stream (possibly with counting), or even a parse,
where most of the input would map to a "unimportant text" token. If you want to preserve
white-space, also generate whitespace tokens.
At the end, you should get a list of #rom and #non-rom sections.
Now that you know what text is a #rom section, you can address parsing of separate #rom sections. I
suspect you'll need C expression parsing, to avoid counting "{ 1, f(2,3,4) }" as 4 vaules (which
happens if you do line.split(',') )
Albert
--
You received this message because you are subscribed to the Google Groups
"ply-hack" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ply-hack/51BEB3B6.3080304%40tue.nl.
For more options, visit https://groups.google.com/groups/opt_out.