Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -178,9 +178,10 @@ tuple[TModel, ModuleStatus] addGrammar(MODID moduleId, set[MODID] imports, set[M
<found, tm1, ms> = getTModelForModule(m, ms);
if(!found) {
msg = error("Cannot add grammar or tmodel since `<moduleId2moduleName(m)>` 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 <tm1, ms>;
return <false, tm1, ms>;
}
}
facts = tm1.facts;
Expand Down Expand Up @@ -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 <tm, ms>;
return <true, tm, ms>;
} catch TypeUnavailable(): {
// protect against undefined entities in the grammar that have not yet been reported.
return <tmodel(), ms>;
return <false, tmodel(), ms>;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/org/rascalmpl/compiler/lang/rascalcore/check/Import.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
<tm, ms> = addGrammar(m, m_imports[m], m_extends[m], transient_tms, ms);
<found, tm1, 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;
}
Expand Down
Loading