[augeas-devel] [PATCH 1 of 2] Add eol, indent, comment and empty to util
Raphael Pinson
raphink at gmail.com
Tue Aug 12 16:41:45 UTC 2008
# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# 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 *)
More information about the augeas-devel
mailing list