Pyparsing help

Paul McGuire ptmcg at
Sun Mar 23 02:30:20 CET 2008

Oof, I see that you have multiple "Layer" entries, with different
qualifying labels.  Since the dicts use "Layer" as the key, you only
get the last "Layer" value, with qualifier "PRBOUNDARY", and lose the
"Layer" for "METAL2".  To fix this, you'll have to move the optional
alias term to the key, and merge "Layer" and "PRBOUNDARY" into a
single key, perhaps "Layer/PRBOUNDARY" or "Layer(PRBOUNDARY)" - a
parse action should take care of this for you.  Unfortnately, these
forms will not allow you to use object attribute form
(md.Layer.lineStyle), you will have to use dict access form
(md["Layer(PRBOUNDARY)"].lineStyle), since these keys have characters
that are not valid attribute name characters.

Or you could add one more level of Dict nesting to your grammar, to
permit access like "md.Layer.PRBOUNDARY.lineStyle".

-- Paul

More information about the Python-list mailing list