From 796b2d796a7e05788d707f178383dc22f384563b Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Wed, 25 Mar 2015 12:23:05 +0200 Subject: [PATCH 2/2] Dns_Zone: allow whitespace at the end of the line --- lenses/dns_zone.aug | 4 ++-- lenses/tests/test_dns_zone.aug | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/lenses/dns_zone.aug b/lenses/dns_zone.aug index 77c3485..4db194c 100644 --- a/lenses/dns_zone.aug +++ b/lenses/dns_zone.aug @@ -16,8 +16,8 @@ module Dns_Zone = autoload xfm -let eol = del /(([ \t\n]*;[^\n]*)?\n)+/ "\n" -let opt_eol = del /(([ \t\n]*;[^\n]*)?\n)*/ "" +let eol = del /([ \t\n]*(;[^\n]*)?\n)+/ "\n" +let opt_eol = del /([ \t\n]*(;[^\n]*)?\n)*/ "" let ws = del /[ \t]+|(([ \t\n]*;[^\n]*)?\n)+[ \t]*/ " " let opt_ws = del /(([ \t\n]*;[^\n]*)?\n)*[ \t]*/ "" diff --git a/lenses/tests/test_dns_zone.aug b/lenses/tests/test_dns_zone.aug index 07ff583..2537c4d 100644 --- a/lenses/tests/test_dns_zone.aug +++ b/lenses/tests/test_dns_zone.aug @@ -353,3 +353,32 @@ bar TXT \"ab cd\\\\ef\\\"gh\" { "$ORIGIN" = "example.com." } { "foo" { "1" { "type" = "TXT" } { "rdata" = "abc\\\\def\\\"ghi" } } } { "bar" { "1" { "type" = "TXT" } { "rdata" = "\"ab cd\\\\ef\\\"gh\"" } } } + + +(* Whitespace at the end of the line *) +test lns get " +$ORIGIN example.com. \n@ IN SOA ns root.example.com. (1 2 3 4 5) \t +foo 1D IN A 10.1.2.3\t +" = + { "$ORIGIN" = "example.com." } + { "@" + { "1" + { "class" = "IN" } + { "type" = "SOA" } + { "mname" = "ns" } + { "rname" = "root.example.com." } + { "serial" = "1" } + { "refresh" = "2" } + { "retry" = "3" } + { "expiry" = "4" } + { "minimum" = "5" } + } + } + { "foo" + { "1" + { "ttl" = "1D" } + { "class" = "IN" } + { "type" = "A" } + { "rdata" = "10.1.2.3" } + } + } -- 2.1.0