pyparsing: ensuring all sections are parsed -
i write parser evice configuration files. there lot of sections interfaces, contain number of configuration commands. , because of fact different devices (firmware versions) may have different defaults , don't know possible commands @ point --- how write parser in case?
when write:
# cisco: iface = header \ + iftype + ifname \ + descr \ + switchport_options \ + skipto(comment).suppress() \ + comment.suppress() ifaces = group(oneormore(iface))
--- in case miss interfaces ip address
before descr
token. ok, know this, can use optional
every possible command, there can other configuration commands unaware of far.
and list of interfaces without not parsed language definition.
i guess can in 2 passes. first, ifaces
having defined them "everything interface
comment
" , trying parse them 1 one. , possible exceptions me fine-tune definitions.
is right way?
how can this?
Comments
Post a Comment