Kaynağa Gözat

Some minor corrections to code

Yentl Van Tendeloo 8 yıl önce
ebeveyn
işleme
17adfcd3ed
1 değiştirilmiş dosya ile 9 ekleme ve 1 silme
  1. 9 1
      integration/utils.py

+ 9 - 1
integration/utils.py

@@ -280,10 +280,18 @@ def get_constructor(code):
     return constructors
 
 def get_model_constructor(code):
+    # First change multiple spaces to a tab
+    code_fragments = code.split("\n")
+    code_fragments = [i for i in code_fragments if i.strip() != ""]
+    code_fragments = [i.replace("    ", "\t") for i in code_fragments]
+    initial_tabs = min([len(i) - len(i.lstrip("\t")) for i in code_fragments])
+    code_fragments = [i[initial_tabs:] for i in code_fragments]
+    code = "\n".join(code_fragments)
+
     with open("__model.mvc", "w") as f:
         f.write(code)
         f.flush()
 
-    constructors = do_compile("__model.mvc", "interface/HUTN/grammars/actionlanguage.g", "M")
+    constructors = do_compile("__model.mvc", "interface/HUTN/grammars/modelling.g", "M")
 
     return constructors