Package eu.bandm.tools.d2d2.base
Class Navigate
java.lang.Object
eu.bandm.tools.d2d2.base.Navigate
Auxiliary static methods for model navigation and inquiry.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Worker for updating the local attribute cache.static class
Expand all character set expressions from the d2d definition language to an extensional representation asCharSet
.static class
Replaces hard every referring identifier which is local to some declared object by the normalized identifier, as valid on module level.static class
Visits all definitions and their defined expressions which are reachable from given start points. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Predicate<Definition>
Returns whether a definition is of reg exp type (tags or chars) and has been defined as "public".static final Location<XMLDocumentIdentifier>
A null value of the given type.Delivers an unresolved reference expression which contains the given name. -
Method Summary
Modifier and TypeMethodDescriptionallPublicXRegExp
(Module mod) Delivers all definitons in the given module which are of reg exp type and and have been defined as "public".allXRegExp
(Module mod) Delivers all definitons in the given module which are of reg exp type.static Reference
co_resolve
(Definition def) Delivers a resolved reference expression which points to the given definition.static void
collectAttributes
(XRegExp host) Every XRegExp has a local cache with definitions which are realized as attributes.Collects the docu entry keys which appear in all defintions which appear in a given document parse result.static String
expandModulePath
(ImportItem item) Deliver the absolute path name for a module which is given by a reference to a module name from some nested scope.static String
findImplicit
(TagsRegExp def) Find the reference marked as#implicit
, iff it is the first in a sequence (possibly length 1) on the top of the content model of the given regexp.findImplicit
(TagsRegExp def, boolean instantiated) Find the reference marked as#implicit
, iff it is the first in a sequence (possibly length 1) on the top of the content model of the given regexp.static @Opt Definition
findInDefinitions
(Module mod, String name) Look for a definition in a module, including local defs.static @Opt Definition
findInDefinitions
(Module mod, String[] names) Look for a definition in a module, including local defs.findXRegExp
(Module mod, String name) Looks for a XRegExp with the given name.Delivers the ascending list of containing modules.static Module
getModule
(SourceItem si) Find the module which contains a given definition, or the argument itself, if it is a module.static Module
static boolean
hasPublicXRegExp
(Module mod) Delivers whehter a given (raw) module has at least one public XRegExp.static Expression
Delivers the expression which is meant to be inserted by an insertion expression which contains only one single (resolved) reference expression.static boolean
isEmptyXRegExp
(Definition def) Returns whether a definition is of reg exp type (tags or chars) and has empty contents.static boolean
isLocalModule
(Module mod) static final void
Shortcut formatting a String with arguemnts.static void
Dump the internal text parsing result object for debugging.static void
printUdom
(PrintStream p, Udom u) Dump the internal text parsing result object for debugging.static String
qname
(SourceItem si) Return the qualified name which represents nesting of local definitions up to (and excluding) the module level.static String
Recompose a compound identifier by joining it withChars.STRING_NAMING_LEVEL_SEPARATOR
= ".",static Expression
Returns the argument if it is not an insertion, otherwise the XRegExp referred to by its only content, a resolved reference.singleReference
(Insertion ins) Returns the only reference which is the argument of the insertion, otherwise null.static String[]
Decompose a compound identifier by splitting it withChars.STRING_NAMING_LEVEL_SEPARATOR
= ".",
-
Field Details
-
isPublicRegExp
Returns whether a definition is of reg exp type (tags or chars) and has been defined as "public". -
locnull
A null value of the given type. -
makeRef
Delivers an unresolved reference expression which contains the given name.
-
-
Method Details
-
PP
Shortcut formatting a String with arguemnts. -
getModule
Find the module which contains a given definition, or the argument itself, if it is a module.- Returns:
- the module a definition or import item is contained in,
or the argument itself, in case it is a module itself.
(Must be public for "../postproc".)
-
getTopmostModule
- Returns:
- the top-most static (source text level) module, a definition or import item is contained in, or the argument itself, in case it is a top-level module itself.
-
getAllModules
Delivers the ascending list of containing modules. -
isLocalModule
- Returns:
- whether the module has been defined in the prefix of a text document file as a local module.
-
qname
Return the qualified name which represents nesting of local definitions up to (and excluding) the module level. -
expandModulePath
Deliver the absolute path name for a module which is given by a reference to a module name from some nested scope. "childs" and "siblings" of the referring module are considered first. If none is found, the name is considered to be absolute.- Returns:
- the expanded module name = path from top level module to module. This is additionally stored in the field "absolutePath" of the argument.
-
findImplicit
Find the reference marked as#implicit
, iff it is the first in a sequence (possibly length 1) on the top of the content model of the given regexp. This version can only be applied to a Definition in a ResolvedModule. -
findImplicit
Find the reference marked as#implicit
, iff it is the first in a sequence (possibly length 1) on the top of the content model of the given regexp.- Parameters:
instantiated
- if appleid to a Definition in a ResolvedModule.
-
findXRegExp
Looks for a XRegExp with the given name. -
isEmptyXRegExp
Returns whether a definition is of reg exp type (tags or chars) and has empty contents. -
extractSuffix
- Returns:
- The part after the last
Chars.STRING_NAMING_LEVEL_SEPARATOR
= ".", or the whole String if none is contained.
-
findInDefinitions
Look for a definition in a module, including local defs. -
findInDefinitions
Look for a definition in a module, including local defs. -
reJoin
Recompose a compound identifier by joining it withChars.STRING_NAMING_LEVEL_SEPARATOR
= ".",- Parameters:
names
- a non-empty array of identifiers (in the sense of the grammar).
-
split
Decompose a compound identifier by splitting it withChars.STRING_NAMING_LEVEL_SEPARATOR
= ".",- Parameters:
name
- a non-empty string- Returns:
- a non-empty array of identifiers (in the sense of the d2d definition grammar).
-
allXRegExp
Delivers all definitons in the given module which are of reg exp type. -
hasPublicXRegExp
Delivers whehter a given (raw) module has at least one public XRegExp. -
allPublicXRegExp
Delivers all definitons in the given module which are of reg exp type and and have been defined as "public". -
co_resolve
Delivers a resolved reference expression which points to the given definition. -
insertedExpression
Delivers the expression which is meant to be inserted by an insertion expression which contains only one single (resolved) reference expression. That returned expression is the value of the referred definition. All insertions in a ResolvedModule are of this type (synthetic). -
resolveInsertion
Returns the argument if it is not an insertion, otherwise the XRegExp referred to by its only content, a resolved reference. All insertions in a ResolvedModule are of this type (synthetic). -
singleReference
Returns the only reference which is the argument of the insertion, otherwise null. -
docuTargetsOfAllUsedTags
Collects the docu entry keys which appear in all defintions which appear in a given document parse result. -
printUdom
Dump the internal text parsing result object for debugging. -
printUdom
Dump the internal text parsing result object for debugging. -
collectAttributes
Every XRegExp has a local cache with definitions which are realized as attributes. It caches additionally their optionality. This function updates this cache, if necessary.
-