Browse Source

Minor tweaks again; mainly affecting the parser

Yentl Van Tendeloo 8 years ago
parent
commit
d1be97e5c1

+ 0 - 6
bootstrap/model_management.alc

@@ -238,12 +238,6 @@ Element function model_split(src_model : Element, target_metamodel : Element, re
 					// Source/target not in the queue, but we need it to split!
 					// This is an error as it indicates problems with links crossing different formalisms
 					log("ERROR: source/target of link to be included is not included!")
-					log("Source: " + src)
-					log("  type: " + read_type(src_model, src))
-					log("Destination: " + dst)
-					log("  type: " + read_type(src_model, dst))
-					log("For link: " + name)
-					log("  type: " + type)
 					return create_node()!
 				else:
 					// Still source or destination in the queue, so we wait for that

+ 1 - 1
bootstrap/primitives.alc

@@ -320,7 +320,7 @@ Element function dict_copy(d : Element):
 	keys = dict_keys(d)
 	while (read_nr_out(keys) > 0):
 		key = set_pop(keys)
-		dict_add(result, key, dict_read_node(d, key))
+		dict_add_fast(result, key, dict_read_node(d, key))
 
 	return result!
 

+ 1 - 4
interface/HUTN/hutn_compiler/compiler.py

@@ -25,7 +25,7 @@ def do_parse(inputfile, grammarfile):
                 new_grammar = False
             else:
                 # Will be catched immediately
-                raise Exception("Pickle is invalid!")
+                raise Exception()
         except:
             result = parser = Parser(Grammar(), hide_implicit = True).parse(read(grammarfile))
             if result['status'] != Parser.Constants.Success:
@@ -46,9 +46,6 @@ def do_parse(inputfile, grammarfile):
 
     picklefile = inputfile + ".pickle"
     try:
-        if new_grammar:
-            # Stop anyway, as the grammar is new
-            raise Exception()
         if os.path.getmtime(picklefile) > os.path.getmtime(inputfile):
             # Pickle is more recent than inputfile, so use it
             result = pickle.load(open(picklefile, 'rb'))

+ 12 - 0
kernel/modelverse_kernel/compiled.py

@@ -133,3 +133,15 @@ def dict_eq(a, b, **remainder):
 
     result, = yield [("CNV", [a_dict == b_dict])]
     raise PrimitiveFinished(result)
+
+def string_substr(a, b, c, **remainder):
+    a_val, b_val, c_val = yield [("RV", [a]),
+                                 ("RV", [b]),
+                                 ("RV", [c])]
+    try:
+        new_value = a_val[b_val:c_val]
+    except:
+        new_value = ""
+    
+    result, = yield [("CNV", [new_value])]
+    raise PrimitiveFinished(result)