Repository: aredwood/zonefile-parser

Issue:
Cannot parse default ORIGIN with tabs in line
Unable to parse the default ORIGIN if delimiter is using tabs instead of space.

helper.py

```
def default_origin(text:str):
    lines = text.splitlines()
    for line in lines:
        if "$ORIGIN".casefold() in line.casefold():
            origin = line.split(" ")[1]
            return origin
    return None
```

Discussion:
@aredwood: in your use case, are the rest of the records also using tabs? if so can you send a sanitised example over?



Solution patch:
diff --git a/zonefile_parser/helper.py b/zonefile_parser/helper.py
index c3413df..b8b5832 100644
--- a/zonefile_parser/helper.py
+++ b/zonefile_parser/helper.py
@@ -82,7 +82,9 @@ def default_origin(text:str):
     lines = text.splitlines()
     for line in lines:
         if "$ORIGIN".casefold() in line.casefold():
-            origin = line.split(" ")[1]
+            # delimiter exists ater the $ORIGIN
+            delimiter = line.casefold()[7]
+            origin = line.split(delimiter)[1]
             return origin
     return None
 


Test patch:
diff --git a/zonefile_parser/main_test.py b/zonefile_parser/main_test.py
index d5d0a27..68fee22 100644
--- a/zonefile_parser/main_test.py
+++ b/zonefile_parser/main_test.py
@@ -150,4 +150,22 @@ sub     64  IN  CNAME   value.com
         assert (result[1].name == "sub.sub.example.com")
         assert (result[2].name == "sub.example.com")
         assert (result[3].name == "example.com")
-        assert (result[4].name == "example.com")
\ No newline at end of file
+        assert (result[4].name == "example.com")
+
+    # issue 47
+    def test_adaptive_delimiter(self):
+        text = str("""
+$TTL	10d
+$ORIGIN	example.com.
+@	86400	IN	CAA	0	issue	"ca.example.com"
+""")
+        record = zonefile_parser.main.parse(text)[0]
+        assert (record.name == "example.com.")
+        assert (record.ttl == "86400")
+        assert (record.rclass == "IN")
+        assert (record.rtype == "CAA")
+        assert (record.rdata == {
+            "flag":"0",
+            "tag":"issue",
+            "value":"ca.example.com"
+        })
\ No newline at end of file