[augeas-devel] shellvars - regex parsing help

Adam Stokes ajs at redhat.com
Mon Jan 11 19:01:25 UTC 2010


My regex skills are probably less than par but I'm having some trouble getting this comment var to work with shellvars.aug.

error in augtool:
/augeas/files/etc/sysconfig/nfs/error = "parse_failed"
/augeas/files/etc/sysconfig/nfs/error/pos = "0"
/augeas/files/etc/sysconfig/nfs/error/line = "1"
/augeas/files/etc/sysconfig/nfs/error/char = "0"
/augeas/files/etc/sysconfig/nfs/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:47.12-.45:"
/augeas/files/etc/sysconfig/nfs/error/message = "Iterated lens matched less than it should"

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" ]

David has been helping a lot with this and I know that line_re should match all '#.*' minus anything that looks like a setting though only limiting it to key_re . '=' . /.*/ is not the best way to handle this since other settings may be written as 'var:val'.

In any case I can't quite understand why I'm getting that particular error message.
-- 
        __          __                
.-----.|  |_.-----.|  |--.-----.-----.
|__ --||   _|  _  ||    <|  -__|__ --|
|_____||____|_____||__|__|_____|_____|
 .----------------------------------.
(   ajs at redhat.com || 919.754.4187   )
 `----------------------------------'




More information about the augeas-devel mailing list