Skip to content

Commit

Permalink
Merge branch 'call-return'
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed May 7, 2024
2 parents 95fccbf + 8fc7b79 commit 64e1bad
Show file tree
Hide file tree
Showing 30 changed files with 1,321 additions and 719 deletions.
1 change: 1 addition & 0 deletions src/org/rascalmpl/core/library/CheckTestSources.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ tuple[str, int] safeCompile(str \module, RascalCompilerConfig compilerConfig) {
ModuleStatus result = rascalTModelForNames([\module],
compilerConfig,
dummy_compile1);
//iprintln(result.tmodels[\module].facts);
if(!isEmpty(result.tmodels[\module].messages)){
iprintln(result.tmodels[\module].messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,12 @@ TModel addGrammar(str qualifiedModuleName, set[str] imports, set[str] extends, m
}
definedLayout = aadt("$default$", [], layoutSyntax());
//syntaxDefinitions += (definedLayout : choice(definedLayout, {prod(definedLayout, [])}));
if(isEmpty(allLayouts)){
syntaxDefinitions += (AType::layouts("$default$"): choice(AType::layouts("$default$"), {prod(AType::layouts("$default$"), [])}));
// syntaxDefinitions += (definedLayout : choice(definedLayout, {prod(definedLayout, [])}));
} else
if(size(allLayouts) >= 1){
definedLayout = getOneFrom(allLayouts);
}
//syntaxDefinitions += (definedLayout : choice(definedLayout, {prod(definedLayout, [])}));
}
// Add start symbols
Expand All @@ -216,17 +211,34 @@ TModel addGrammar(str qualifiedModuleName, set[str] imports, set[str] extends, m
// Add auxiliary rules for instantiated syntactic ADTs outside the grammar rules
facts = tm.facts;
allADTs = { unset(adt, "alabel") | loc k <- facts, /AType adt:aadt(str _, list[AType] _, _) := facts[k] };
//println("ADTandGrammar, allADTs:"); iprintln(allADTs);
instantiated_in_grammar = { unset(adt, "alabel") | /adt:aadt(str _, list[AType] parameters, SyntaxRole _) := syntaxDefinitions,
!isEmpty(parameters), all(p <- parameters, !isTypeParameter(p))
};
instantiated_in_grammar =
{ unset(adt, "alabel")
| /adt:aadt(str _, list[AType] parameters, SyntaxRole _) := syntaxDefinitions,
!isEmpty(parameters),
all(p <- parameters, !isTypeParameter(p))
};
//println("ADTandGrammar, instantiated_in_grammar:"); iprintln(instantiated_in_grammar);
instantiated = { unset(adt, "alabel") | AType adt <- allADTs, !isEmpty(adt.parameters), all(p <- adt.parameters, !isTypeParameter(p))
};
instantiated =
{ unset(adt, "alabel")
| AType adt <- allADTs,
!isEmpty(adt.parameters),
all(p <- adt.parameters, !isTypeParameter(p))
};
//println("ADTandGrammar, instantiated:"); iprintln(instantiated);
instantiated_outside = instantiated - instantiated_in_grammar;
parameterized_uninstantiated_ADTs = { unset(adt, "alabel") | adt <- allADTs, adt.syntaxRole != dataSyntax(), params := getADTTypeParameters(adt),
!isEmpty(params), all(p <- params, isTypeParameter(p))
};
//println("ADTandGrammar, instantiated_outside:"); iprintln(instantiated_outside);
parameterized_uninstantiated_ADTs =
{ unset(adt, "alabel")
| adt <- allADTs,
adt.syntaxRole != dataSyntax(),
params := getADTTypeParameters(adt),
!isEmpty(params),
all(p <- params, isTypeParameter(p))
};
//println("ADTandGrammar, parameterized_uninstantiated_ADTs:"); iprintln(parameterized_uninstantiated_ADTs);
AType uninstantiate(AType t){
iparams = getADTTypeParameters(t);
Expand All @@ -253,6 +265,7 @@ TModel addGrammar(str qualifiedModuleName, set[str] imports, set[str] extends, m
g = grammar(allStarts, syntaxDefinitions);
g = layouts(g, definedLayout, allManualLayouts);
//println("ADTandGrammar:"); iprintln(g, lineLimit=10000);
//g = expandKeywords(g);
g.rules += (AType::aempty():choice(AType::aempty(), {prod(AType::aempty(),[])}));
tm = tmlayouts(tm, definedLayout, allManualLayouts);
Expand Down
Loading

0 comments on commit 64e1bad

Please sign in to comment.