summaryrefslogtreecommitdiff
path: root/reconfigure/parsers/bind9.py
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:26 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:26 +0200
commitff1408420159488a106492ccd11dd234967029b6 (patch)
tree473420cee1c5229a427ec4cafead1aa6c0a26800 /reconfigure/parsers/bind9.py
Imported Upstream version 0.1.29
Diffstat (limited to 'reconfigure/parsers/bind9.py')
-rw-r--r--reconfigure/parsers/bind9.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/reconfigure/parsers/bind9.py b/reconfigure/parsers/bind9.py
new file mode 100644
index 0000000..d5c8e01
--- /dev/null
+++ b/reconfigure/parsers/bind9.py
@@ -0,0 +1,20 @@
+from reconfigure.nodes import *
+from reconfigure.parsers.nginx import NginxParser
+
+
+class BIND9Parser (NginxParser):
+ """
+ A parser for named.conf
+ """
+
+ tokens = [
+ (r"[\w_]+\s*?.*?{", lambda s, t: ('section_start', t)),
+ (r"[\w\d_:]+?.*?;", lambda s, t: ('option', t)),
+ (r"\s", lambda s, t: 'whitespace'),
+ (r"$^", lambda s, t: 'newline'),
+ (r"\#.*?\n", lambda s, t: ('comment', t)),
+ (r"//.*?\n", lambda s, t: ('comment', t)),
+ (r"/\*.*?\*/", lambda s, t: ('comment', t)),
+ (r"\};", lambda s, t: 'section_end'),
+ ]
+ token_section_end = '};'