[augeas-devel] shellvars - regex parsing help
David Lutterkort
lutter at redhat.com
Thu Jan 14 22:47:18 UTC 2010
On Thu, 2010-01-14 at 12:03 -0500, Adam Stokes wrote:
> > > current shellvars comment:
> > > let key_re = /[A-Za-z0-9_]+(\[[0-9]+\])?/ - "unset" - "export"
> > > let eq = Util.del_str "="
> > > let empty = Util.empty
> > > let comment =
> > > let line_re = /(#[^ \t][^\n]*)?/ - (key_re . "=" . /.*/) in
> > > [ label "#comment" . empty . store line_re . del /\n/ "\n" ]
> > >
> >
>
> Here is my latest attempt
>
> let comment =
> let line_re = /([^ \t\n].*[^ \t\n]|[^ \t\n])/ - /([ \t]key_re . [ \t]*=[ \t]*.*[ \t\n])/ in
> [ label "#comment" . del /#[ \t]*/ "# " . store line_re . del /\n/ "\n" ]
The expression after the '-' is not right: you have
/([ \t]key_re . [ \t]*=[ \t]*.*[ \t\n])/
That's one literal regexp; you're missing a bunch of '/' to end/start
regular expression literals.
I think what you mean is
/[ \t]*/ . key_re . /[ \t]*=[ \t]*.*/
David
More information about the augeas-devel
mailing list