module analysis::typepal::ConfigurableScopeGraph
rascal-0.40.16
typepal-0.14.8
Usage
import analysis::typepal::ConfigurableScopeGraph;
Source code
http://github.com/usethesource/typepal/src/analysis/typepal/ConfigurableScopeGraph.rsc
Dependencies
extend analysis::typepal::Exception;
extend analysis::typepal::ISolver;
import IO;
import Set;
import Map;
import util::Reflective;
import String;
extend ParseTree;
function defaultGetMinAType
AType defaultGetMinAType()
function defaultGetMaxAType
AType defaultGetMaxAType()
function defaultGetLub
AType defaultGetLub(AType atype1, AType atype2)
function defaultIsSubType
bool defaultIsSubType(AType atype1, AType atype2)
function defaultMayOverload
bool defaultMayOverload (set[loc] _, map[loc, Define] _)
function defaultInstantiateTypeParameters
AType defaultInstantiateTypeParameters(Tree _, AType def, AType ins, AType act, Solver _)
function defaultGetTypeNamesAndRole
tuple[list[str] typeNames, set[IdRole] idRoles] defaultGetTypeNamesAndRole(AType _)
function defaultGetTypeInNamelessType
AType defaultGetTypeInNamelessType(AType _, Tree _, loc _, Solver _)
function defaultGetTypeInTypeFromDefine
AType defaultGetTypeInTypeFromDefine(Define _, str _, set[IdRole] _, Solver _)
function defaultNormalizeName
str defaultNormalizeName(str s)
function defaultReportUnused
bool defaultReportUnused (loc _, TModel _)
function reduceToURIChars
str reduceToURIChars(str s)
function defaultLogicalLoc
loc defaultLogicalLoc(Define def, str _modelName, PathConfig _pcfg)
data TypePalConfig
data TypePalConfig (
Accept (loc def, Use use, Solver s) isAcceptableSimple
= defaultIsAcceptableSimple,
Accept (loc def, Use use, Solver s) isAcceptableQualified
= defaultIsAcceptableQualified,
Accept (loc defScope, loc def, Use use, PathRole pathRole, Solver s) isAcceptablePath
= defaultIsAcceptablePath
)
data TypePalConfig (
bool verbose = false,
PathConfig typepalPathConfig = pathConfig(),
AType() getMinAType
= AType (){ throw TypePalUsage("`getMinAType()` called but is not specified in TypePalConfig"); },
AType() getMaxAType
= AType (){ throw TypePalUsage("`getMaxAType()` called but is not specified in TypePalConfig"); },
bool (AType t1, AType t2) isSubType
= bool (AType atype1, AType atype2) { throw TypePalUsage("`subtype(<atype1>, <atype2>)` called but `isSubType` is not specified in TypePalConfig"); },
AType (AType t1, AType t2) getLub
= AType (AType atype1, AType atype2){ throw TypePalUsage("`lub(<atype1>, <atype2>)` called but `getLub` is not specified in TypePalConfig"); },
bool (set[loc] defs, map[loc, Define] defines) mayOverload
= bool (set[loc] _, map[loc, Define] _) { return false; },
bool (IdRole idRole) isInferrable
= bool(IdRole _) { return false; },
str(str) normalizeName
= str (str s) { return replaceAll(s, "\\", ""); },
AType (Tree selector, AType def, AType ins, AType act, Solver s) instantiateTypeParameters
= AType(Tree _, AType _, AType _, AType act, Solver _){ return act; },
tuple[list[str] typeNames, set[IdRole] idRoles] (AType atype) getTypeNamesAndRole
= tuple[list[str] typeNames, set[IdRole] idRoles](AType _){
throw TypePalUsage("`useViaType` used without definition of `getTypeNamesAndRole`");
},
AType (Define containerDef, str selectorName, set[IdRole] idRolesSel, Solver s) getTypeInTypeFromDefine
= AType (Define _, str _, set[IdRole] _, Solver _) { throw NoBinding(); },
AType(AType containerType, Tree selector, loc scope, Solver s) getTypeInNamelessType
= AType(AType _, Tree _, loc _, Solver _){
throw TypePalUsage("`useViaType` used without definition of `getTypeInNamelessType`");
},
TModel(map[str,Tree] namedTrees, TModel tm) preSolver = TModel(map[str,Tree] _, TModel tm) { return tm; },
void (map[str,Tree] namedTrees, Solver s) postSolver = void(map[str,Tree] _, Solver _) { return ; },
bool(loc def, TModel tm) reportUnused = defaultReportUnused,
loc (Define def, str modelName, PathConfig pcfg) createLogicalLoc = defaultLogicalLoc
)
data Accept
data Accept
= acceptBinding()
| ignoreContinue()
| ignoreSkipPath()
;
function defaultIsAcceptableSimple
Accept defaultIsAcceptableSimple(loc candidate, Use use, Solver _)
function defaultIsAcceptablePath
Accept defaultIsAcceptablePath(loc defScope, loc def, Use use, PathRole _, Solver _)
function defaultIsAcceptableQualified
Accept defaultIsAcceptableQualified(loc _, Use _, Solver _)
function checkPaths
default bool checkPaths(TModel tm, loc from, loc to, PathRole pathRole, bool(TModel,loc) pred)
function existsPath
bool existsPath(TModel tm, loc from, loc to, PathRole pathRole)
data ScopeGraph
data ScopeGraph
= scopegraph(
set[loc] (Use u) lookup,
void (Solver s) setSolver
)
;
function newScopeGraph
ScopeGraph newScopeGraph(TModel tm, TypePalConfig config)