summaryrefslogtreecommitdiff
path: root/reconfigure/parsers/bind9.py
diff options
context:
space:
mode:
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 = '};'