Permalink
Browse files

must provide own lenses to ensure accuracy of tests

  • Loading branch information...
1 parent 63b0989 commit 69147a1f03eb7ded944ebd13a10855e37679d127 @ppadron committed Nov 18, 2009
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/loadpath/hosts.aug
@@ -0,0 +1,24 @@
+(* Parsing /etc/hosts *)
+
+module Hosts =
+ autoload xfm
+
+ let sep_tab = Util.del_ws_tab
+ let sep_spc = Util.del_ws_spc
+
+ let eol = del /[ \t]*\n/ "\n"
+ let indent = del /[ \t]*/ ""
+
+ let comment = Util.comment
+ let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
+
+ let word = /[^# \n\t]+/
+ let record = [ seq "host" . indent .
+ [ label "addr" . store word ] . sep_tab .
+ [ label "canonical" . store word ] .
+ [ label "alias" . sep_spc . store word ]*
+ . (comment|eol) ]
+
+ let lns = ( empty | comment | record ) *
+
+ let xfm = transform lns (incl "/etc/hosts")

0 comments on commit 69147a1

Please sign in to comment.