[augeas-devel] [PATCH 3 of 4] Add comment fields

Raphael Pinson raphink at gmail.com
Tue Aug 12 16:06:00 UTC 2008


# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# Date 1218557025 -7200
# Node ID 1a795d16c123982ac871d748ef5f1aa00827ec3c
# Parent  c45c95d6acf1c102024137041e035884756bc6be
Add comment fields

diff -r c45c95d6acf1 -r 1a795d16c123 lenses/pam.aug
--- a/lenses/pam.aug	Tue Aug 12 18:02:11 2008 +0200
+++ b/lenses/pam.aug	Tue Aug 12 18:03:45 2008 +0200
@@ -16,7 +16,9 @@ module Pam =
   (* and should be parsed as one                                           *)
   let argument = /[^#\n \t]+/
 
-  let comment = [ indent? . del /[ \t]*(#.*)?\n/ "#\n" ]
+  let comment = [ indent? . label "comment" . del /#[ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ]
+  let empty   = [ del /[ \t]*#?[ \t]*\n/ "" ]
+
 
   (* Not mentioned in the man page, but Debian uses the syntax             *)
   (*   @include module                                                     *)
@@ -33,7 +35,7 @@ module Pam =
                    [ Util.del_ws_tab . label "argument" . store argument ]* .
 		 (comment|eol)
                ]
-  let lns = ( comment | include | record ) *
+  let lns = ( empty | comment | include | record ) *
 
   let xfm = transform lns ((incl "/etc/pam.d/*") . Util.stdexcl)
 




More information about the augeas-devel mailing list