On Tue, Mar 24, 2009 at 5:34 AM, Jester_EE <[email protected]> wrote:
> For an extremely small example, here is a block of something that
> would need to be processed:
> <data>
> ! =A0 =A0Title Block
> ! =A0 =A0Name =A0 =A0 =A0=3D User
> ! =A0 =A0Date =A0 =A0 =A0=3D MM/DD/YYYY
>
> HEADER
> =A0 INPUTS
> =A0 sweep1 =A0 =A0V =A0 =A0D =A0 =A0GRD =A0 =A0SMU1 =A0 =A00.1 =A0 =A0LIN=
=A0 =A01 =A0 =A00 =A0 =A01
My own few cents here. Parsers like PLY are best for grammars where
the lexing in context independent. In this case though, each line has
its own special format, and the format depends somewhat on the data
before it. It's possible to handle this with explicit state
management, but that's extremely tedious.
Instead, you might want to look at pyparsing, which uses a different
approach to parsing. I think it's more appropriate for the sort of
data you show here.
Best regards,
Andrew Dalke
[email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---