diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc index 52ecb2d560..e60eb823db 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/ADTandGrammar.rsc @@ -165,7 +165,7 @@ list[&T <: node ] unsetRec(list[&T <: node] args) = [unsetRec(a) | a <- args]; bool isManualLayout(AProduction p) = (p has attributes && atag("manual"()) in p.attributes); -tuple[TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[MODID] extends, map[MODID,TModel] transient_tms, ModuleStatus ms){ +tuple[bool, TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[MODID] extends, map[MODID,TModel] transient_tms, ModuleStatus ms){ try { rel[AType,AProduction] definedProductions = {}; allStarts = {}; @@ -178,9 +178,10 @@ tuple[TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[M = getTModelForModule(m, ms); if(!found) { msg = error("Cannot add grammar or tmodel since `` is not found", ms.moduleLocs[moduleId] ? |unknown:///|); + println(msg); // TODO: Just to record this event; this should probably go to a log file ms.messages[moduleId] ? {} += { msg }; tm1 = tmodel(modelName=qualifiedModuleName, messages=[msg]); - return ; + return ; } } facts = tm1.facts; @@ -317,10 +318,10 @@ tuple[TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[M tm = tmlayouts(tm, definedLayout, allManualLayouts); //println("ADTandGrammar:"); iprintln(g, lineLimit=10000); tm.store[key_grammar] = [g]; - return ; + return ; } catch TypeUnavailable(): { // protect against undefined entities in the grammar that have not yet been reported. - return ; + return ; } } diff --git a/src/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc b/src/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc index cf3fd8fa1b..220ba9e2d2 100644 --- a/src/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc +++ b/src/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc @@ -423,7 +423,8 @@ tuple[map[MODID,TModel], ModuleStatus] prepareForCompilation(set[MODID] componen tm.definitions = ( def.defined : def | Define def <- tm.defines); transient_tms[m] = tm; - = addGrammar(m, m_imports[m], m_extends[m], transient_tms, ms); + = addGrammar(m, m_imports[m], m_extends[m], transient_tms, ms); + if(found) { tm = tm1; } ms.messages[m] = toSet(tm.messages); transient_tms[m] = tm; }