소스 검색

Added possibility to overrite 'construct_function'.

Taddeus Kroes 14 년 전
부모
커밋
775db0cb2c
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      line.py

+ 10 - 1
line.py

@@ -203,7 +203,16 @@ def generate_line(root):
                 else:
                     content[node] = construct_nary(node)
             else:
-                content[node] = construct_function(node)
+                result = None
+
+                if hasattr(node, 'construct_function'):
+                    children = [content[c] for c in node]
+                    result = node.construct_function(children)
+
+                if result == None:
+                    result = construct_function(node)
+
+                content[node] = result
 
             # Add negations
             content[node] = '-' * node.negated + content[node]