Bläddra i källkod

Updated grammar to allow for exports and added initialize_SCD to test

Yentl Van Tendeloo 9 år sedan
förälder
incheckning
5e88e418b0

+ 1 - 0
bootstrap/bootstrap.py

@@ -158,6 +158,7 @@ def bootstrap():
     include "library.alc"
     include "conformance_scd.alc"
     include "modelling.alc"
+    include "metamodels.alc"
 
     Void function __main():
     \tInteger interface

+ 1 - 0
bootstrap/modelling.alc

@@ -414,6 +414,7 @@ Void function construct_model():
 		elif (command == "import_node"):
 			Element m
 			m = import_node(input())
+			log("Imported node " + cast_e2s(m))
 			dict_add(global_models, input(), m)
 		else:
 			log("Modelling error: did not understand command " + command)

+ 1 - 1
integration/test_constructors_models_compiled.py

@@ -35,5 +35,5 @@ def conformance_check(node):
 
 class TestConstructorsModelsCompiled(unittest.TestCase):
     def test_constructors_petrinets(self):
-        commands = model_compile("interface/HUTN/test/modelling_language/code/petrinets.mvc") + conformance_check("models/PetriNets") + ['"return"', 'false']
+        commands = ['"model"' ,'"initialize_SCD"', '"models/SimpleClassDiagrams"', '"exit"'] + model_compile("interface/HUTN/test/modelling_language/code/petrinets.mvc") + conformance_check("models/PetriNets") + ['"return"', 'false']
         self.assertTrue(run_barebone(commands, ["OK"], 1))

+ 1 - 1
interface/HUTN/grammars/modelling.g

@@ -1,5 +1,5 @@
 grammar{
-    start: (import | model | NEWLINE)+;
+    start: (import | export | model | NEWLINE)+;
 
     import: IMPORT MV_URL AS MODEL_ID;
     export: EXPORT MODEL_ID TO MV_URL;

+ 3 - 1
interface/HUTN/test/modelling_language/code/petrinets.mvc

@@ -1,4 +1,4 @@
-import /formalisms/SimpleClassDiagrams as SCD
+import models/SimpleClassDiagrams as SCD
 
 SCD PetriNets{
     Class Place{
@@ -12,3 +12,5 @@ SCD PetriNets{
         weight : Natural
     }
 }
+
+export PetriNets to models/PetriNets