소스 검색

Added workaround to find the grammar in all situations

Yentl Van Tendeloo 9 년 전
부모
커밋
ae11ebf72f
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      interface/HUTN/hutn_compiler/model_visitor.py
  2. 1 0
      interface/HUTN/test/modelling_language/expected/petrinets_constraints

+ 3 - 1
interface/HUTN/hutn_compiler/model_visitor.py

@@ -1,5 +1,6 @@
 from visitor import Visitor
 from compiler import main as do_compile
+import os
 
 def jsonstr(s):
     return '"%s"' % s
@@ -104,4 +105,5 @@ class ModelVisitor(Visitor):
             with open(".constraint.alc", 'w') as f:
                 f.write(constraint)
                 f.flush()
-            self.constructors.extend(['"add_constraint"', jsonstr(self.current_model), jsonstr(self.current_element)] + do_compile(".constraint.alc", "interface/HUTN/grammars/actionlanguage.g", "CS"))
+            directory = os.path.realpath(__file__).rsplit(os.sep, 1)[0]
+            self.constructors.extend(['"add_constraint"', jsonstr(self.current_model), jsonstr(self.current_element)] + do_compile(".constraint.alc", directory + "/../grammars/actionlanguage.g", "CS"))

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
interface/HUTN/test/modelling_language/expected/petrinets_constraints