Skip to content

Commit

Permalink
must provide own lenses to ensure accuracy of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Padron committed Nov 18, 2009
1 parent 63b0989 commit 69147a1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 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.