# HG changeset patch
# User Raphael Pinson <[EMAIL PROTECTED]>
# Date 1218559255 -7200
# Node ID f8fa71b1e90da61a5b9ba54ec5eeaeeda9bf806a
# Parent  eb214a8856457362373b9ac0899f2982eb894854
Add eol, indent, comment and empty to util

diff -r eb214a885645 -r f8fa71b1e90d lenses/util.aug
--- a/lenses/util.aug   Tue Aug 12 18:22:38 2008 +0200
+++ b/lenses/util.aug   Tue Aug 12 18:40:55 2008 +0200
@@ -7,6 +7,18 @@ module Util =
   let del_ws_tab = del_ws "\t"
 
   let del_opt_ws = del /[ \t]*/
+
+  let eol = del /[ \t]*\n/ "\n"
+  let indent = del_ws ""
+
+  (* comment and empty
+     This is a general definition of comment and empty.
+     It allows indentation for comments, removes the leading and trailing 
spaces
+     of comments and stores them in nodes, except for empty comments which are 
+     ignored together with empty lines
+  *)
+  let comment = [ indent? . label "comment" . del /#[ \t]*/ "# " . store /([^ 
\t\n].*[^ \t\n]|[^ \t\n])/ . eol ]
+  let empty   = [ del /[ \t]*#?[ \t]*\n/ "" ]
 
   (* Split (SEP . ELT)* into an array-like tree where each match for ELT *)
   (* appears in a separate subtree. The labels for the subtrees are      *)

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to