-"""
-The configuration syntax is the following (TODO: add whitespaces WSP)
-TODO: decide '()' around formulas
-TODO: check escaping in expressions
-TODO: should whitespace (incl. '\\n') be allowed (almost) everywhere?
- can comment be anywhere whitespace can?
-
-FILE = BLOCK
-BLOCK + '\\n' = () | STATEMENT ( STATEMENT-SEP STATEMENT )*
-
-STATEMENT-SEP = ( '\\n' | ';' )
-WSP = ( ' ' | '\\t' | '\\n' | COMMENT )*
-
-COMMENT = re'#[^\\n]*\\n'
-
-STATEMENT = CONDITION | OPERATION | SUBTREE
-
-OPERATION = VARNAME ( '=' | '+=' ) EXPRESSION
-SUBTREE = VARNAME '{' BLOCK '}'
-CONDITION = 'if' FORMULA '{' BLOCK '}'
-
-FORMULA = ( EXPRESSION ( '!=' | '==' ) EXPRESSION ) | '(' AND ')' | '(' OR ')' | NOT
-AND = FORMULA 'and' FORMULA
-OR = FORMULA 'or' FORMULA
-NOT = 'not' FORMULA
-
-EXPRESSION = '"' ( ECHAR | '{' VARNAME '}' )* '"' | re"'[^'\\n]*'"
-ECHAR = re'([^\\{}]|\\\\|\\{|\\}|\\n)*'
-"""
-
-
-
-
-c_tree_sep = u'.'
-c_comment = u'#'
-c_open = u'{'
-c_close = u'}'
-c_if = u'if'
-
-"Variable name regexp, dots (separators) must be separated from edges and each other."
-re_key = re.compile(r'\A([A-Za-z0-9_-]+\.)*[A-Za-z0-9_-]+\Z')
+import types, itertools, re
+import logging as log
+from confparser import VARNAME_re