Generic module providing useful primitives
Author: David Lutterkort
Util | Generic module providing useful primitives |
License | This file is licensed under the LGPLv2+, like the rest of Augeas. |
del_str | Delete a string and default to it |
del_ws | Delete mandatory whitespace |
del_ws_spc | Delete mandatory whitespace, default to single space |
del_ws_tab | Delete mandatory whitespace, default to single tab |
del_opt_ws | Delete optional whitespace |
eol | Delete end of line, including optional trailing whitespace |
indent | Delete indentation, including leading whitespace |
Comment and empty | This is a general definition of comment and empty. |
comment | Map comments into “#comment” nodes |
empty | Map empty lines, including empty comments |
Split | |
Exclusions | |
stdexcl | Exclusion for files that are commonly not wanted/needed |
Delete a string and default to it
let del_str ( s:string ) = del s s
Delete mandatory whitespace
let del_ws = del /[ \t]+/
Delete mandatory whitespace, default to single space
let del_ws_spc = del_ws " "
Delete mandatory whitespace, default to single tab
let del_ws_tab = del_ws "\t"
Delete optional whitespace
let del_opt_ws = del /[ \t]*/
Delete end of line, including optional trailing whitespace
let eol = del /[ \t]*\n/ "\n"
Delete indentation, including leading whitespace
let indent = del /[ \t]*/ ""
Map comments into “#comment” nodes
let comment = [ indent . label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ]
Map empty lines, including empty comments
let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
Exclusion for files that are commonly not wanted/needed
let stdexcl = ( excl "*~" ) . (excl "*.rpmnew") . (excl "*.rpmsave") . (excl "*.augsave") . (excl "*.augnew")