[augeas-devel] [PATCH 2 of 4] comment? . eol is actually (comment|eol) since comment includes \n

Raphael Pinson raphink at gmail.com
Tue Aug 12 16:05:59 UTC 2008


# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# Date 1218556931 -7200
# Node ID c45c95d6acf1c102024137041e035884756bc6be
# Parent  cdd1bcb87bc77fd55e4ae87ccc49f81947aef333
comment? . eol is actually (comment|eol) since comment includes \n
Add possible indent to every field

diff -r cdd1bcb87bc7 -r c45c95d6acf1 lenses/pam.aug
--- a/lenses/pam.aug	Tue Aug 12 17:57:08 2008 +0200
+++ b/lenses/pam.aug	Tue Aug 12 18:02:11 2008 +0200
@@ -3,6 +3,7 @@ module Pam =
   autoload xfm
 
   let eol = del /[ \t]*\n/ "\n"
+  let indent = del /[ \t]+/ ""
 
   (* For the control syntax of [key=value ..] we could split the key value *)
   (* pairs into an array and generate a subtree control/N/KEY = VALUE      *)
@@ -15,23 +16,22 @@ module Pam =
   (* and should be parsed as one                                           *)
   let argument = /[^#\n \t]+/
 
-  let comment = [ del /[ \t]*(#.*)?\n/ "#\n" ]
+  let comment = [ indent? . del /[ \t]*(#.*)?\n/ "#\n" ]
 
   (* Not mentioned in the man page, but Debian uses the syntax             *)
   (*   @include module                                                     *)
   (* quite a bit                                                           *)
-  let include = [ Util.del_str "@" . key "include" . 
+  let include = [ indent? . Util.del_str "@" . key "include" . 
                   Util.del_ws_spc . store word . eol ]
 
-  let record = [ seq "record" .
+  let record = [ seq "record" . indent? .
                    [ label "type" . store types ] .
                    Util.del_ws_tab .
                    [ label "control" . store control] .
                    Util.del_ws_tab .
                    [ label "module" . store word ] .
                    [ Util.del_ws_tab . label "argument" . store argument ]* .
-		 comment? .
-                 eol
+		 (comment|eol)
                ]
   let lns = ( comment | include | record ) *
 




More information about the augeas-devel mailing list