[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] shellvars - regex parsing help



Hi,

> be. To pinpoint better which line is causing headaches, you might
> want
> to upgrade to 0.6.0.

F-11 seems to be on augeas 0.6.0-2

> 
> > 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" ]
 
> In your specific case, it is most likely that you have a line in that
> file that is neither matched by comment nor by kv. To narrow this
> down
> some more, I'd need to see the actual file that you are using.
> 

I have simplified the file down to just a few lines

[root jak dist]# cat /etc/sysconfig/nfs
# THIS IS A COMMENT FOR MOUNTD
# 
# TESTINGVAR=VAL
# MOUNTD_PORT=892

> A simple way to do this for yourself is to write yourself a module
> t.aug
> that looks like
> 
>   module T
>     let s = Sys.read_file "/etc/sysconfig/nfs"
>     test Shellvars.lns get = ?
> 

Running through the test I'm getting

[root jak dist]# augparse t.aug 
Test failure:t.aug:5.4-6.28:
 Expected:
{ 
  { "TESTINGVAR" = "VAL" }
}

 Actual:
{ 
  { "#comment" = "TESTINGVAR=VAL" }
}

Test failure:t.aug:7.4-8.29:
 Expected:
{ 
  { "MOUNTD_PORT" = "892" }
}

 Actual:
{ 
  { "#comment" = "MOUNTD_PORT=892" }
}

No error

I feel like im almost there it just isn't ignoring the items that look like a 'var=val' within a comment.
-- 
        __          __                
.-----.|  |_.-----.|  |--.-----.-----.
|__ --||   _|  _  ||    <|  -__|__ --|
|_____||____|_____||__|__|_____|_____|
 .----------------------------------.
(   ajs redhat com || 919.754.4187   )
 `----------------------------------'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]