Package eu.bandm.tools.d2d2.base
Class FirstCalculator
Sets up constants in each
Expression
, which cache
structural properties of the syntax for later parsing.
- The ".firsts : String -> (Expression+int)" director map (this points to sub-expressions of an ALT or PERM or to starting position numbers of a SEQU!)
- whether character data is accepted
- whether epsilon accepted
(
Expression.canProduceEpsilon
is initialized to false and overwritten here to true, if appropriate.)
Visiting starts with the (externally requested) top-level module and follows ONLY references (to declarations contained anywhere!)
ATTENTION: Does NOT visit the expressions X in "import _ from _ ^ ( X / _)
"
The "result" mechanism of VisitReachable is not used.
-
Field Summary
Modifier and TypeFieldDescription(package private) TagsRegExp
Required for error diagnosis only.protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>>
EvidentFields inherited from class eu.bandm.tools.d2d2.base.Navigate.VisitReachable
done, result, todo
Fields inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_debug_stream, partial
-
Constructor Summary
ConstructorDescriptionEvidentFirstCalculator
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, @Opt ModuleRegistry modreg) Evident -
Method Summary
Modifier and TypeMethodDescriptionvoid
Fill the director maps to the disjunction of all directors of the components.void
action
(CharsRegExp def) No operation necessary.void
Only mark as visited.void
action
(Enumeration def) No operation necessary.void
Mark as visited and set the director maps.void
Copy the directors into the compound expression "x" from its component.void
Mark as visited and set the director maps.void
Fill the director maps to the disjunction of all directors of the components.void
Copy the directors into the compound expression "x" from its component.void
Put "tag->expr" into the directors map for later parsing.void
Fill the director maps of a sequence expression, depending on the possible epsilon-results of its components.void
Copy the directors into the compound expression "x" from its component.void
action
(TagsRegExp def) Memorize location (for messages) and descend into the expression.protected void
addFromTo
(Expression from, Expression to, boolean isalt) "From" is the component expression FROM which the director map is copied inTO the map ruling the compond expression called "to".dprotected void
Copy the directors into a compound expression "x" from its component.protected void
error
(Location<XMLDocumentIdentifier> loc, String txt, Object... args) Evidentprotected void
hint
(Location<XMLDocumentIdentifier> loc, String txt, Object... args) Evident(package private) boolean
isDone
(Expression exp) If not yet visited, create the director map objects.static void
liftFirstsToSeq
(Expression exp, Seq ns) All directors from "exp" are lifted into the directory maps of "ns", to point to the "exp"-expression.protected void
LL1_violation
(String s, Expression from, Expression to) Signal the fact that a tag is already contained in the domain of the (non-weak) director map.protected void
makeGenericHints
(Module module, List<String> names) Emit a sequence of hints pointing to the sequence of import commands, when (erroneously) a definition is referred which is marked with "#GENERIC
".protected void
warning
(Location<XMLDocumentIdentifier> loc, String txt, Object... args) EvidentMethods inherited from class eu.bandm.tools.d2d2.base.Navigate.VisitReachable
markToDo, markToDo, process, process, processAll, processPublic
Methods inherited from class eu.bandm.tools.d2d2.model.SinglePhase
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, follow_definitions, follow_defInstances, follow_docu, follow_firsts, follow_globalSubsts, follow_imports, follow_itemDocu, follow_localdefs, follow_localSubsts, follow_modules, follow_namespaces, follow_obligates, follow_on, follow_rawModules, follow_text, follow_weakfirsts, follow_xattributes
Methods inherited from class eu.bandm.tools.d2d2.model.MATCH_ONLY_00
_visitor_trace, action, action, action, action, action, compile, followAll_definitions, followAll_defInstances, followAll_docu, followAll_firsts, followAll_globalSubsts, followAll_imports, followAll_itemDocu, followAll_localdefs, followAll_localSubsts, followAll_modules, followAll_namespaces, followAll_obligates, followAll_on, followAll_rawModules, followAll_text, followAll_weakfirsts, followAll_xattributes, foreignObject, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, nomatch
-
Field Details
-
msg
Evident -
currentdef
TagsRegExp currentdefRequired for error diagnosis only.
-
-
Constructor Details
-
FirstCalculator
Evident -
FirstCalculator
public FirstCalculator(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, @Opt @Opt ModuleRegistry modreg) Evident- Parameters:
modreg
- ModuleRegistry only needed by "makeGenericHints" for displaying the chain of imported source texts.
-
-
Method Details
-
error
Evident -
warning
Evident -
hint
Evident -
action
Memorize location (for messages) and descend into the expression.- Overrides:
action
in classSinglePhase
-
action
No operation necessary.- Overrides:
action
in classSinglePhase
-
action
No operation necessary.- Overrides:
action
in classSinglePhase
-
isDone
If not yet visited, create the director map objects.- Returns:
- whether visited before.
-
action
Only mark as visited.- Overrides:
action
in classSinglePhase
-
action
Mark as visited and set the director maps.- Overrides:
action
in classSinglePhase
-
action
Mark as visited and set the director maps. Insertions can only be in ResolvedModule as synthetic ones, containing only one Reference- Overrides:
action
in classSinglePhase
-
makeGenericHints
Emit a sequence of hints pointing to the sequence of import commands, when (erroneously) a definition is referred which is marked with "#GENERIC
".- Parameters:
module
- the raw module in which a import statement appearsnames
- the sequence of identifiers = import keys plus one definition tag
-
action
Put "tag->expr" into the directors map for later parsing. References can refer to Tags, Chars and Enumerations definitions.Attention: Use the name of the referred declaration object, which is a kind of "d2d-tag" with possibly local scope. Do not use the referring source text, which already has been normalized to module level scope.
- Overrides:
action
in classSinglePhase
-
copyMult
Copy the directors into a compound expression "x" from its component. -
action
Copy the directors into the compound expression "x" from its component.- Overrides:
action
in classSinglePhase
-
action
Copy the directors into the compound expression "x" from its component.- Overrides:
action
in classSinglePhase
-
action
Copy the directors into the compound expression "x" from its component.- Overrides:
action
in classSinglePhase
-
LL1_violation
Signal the fact that a tag is already contained in the domain of the (non-weak) director map. -
addFromTo
"From" is the component expression FROM which the director map is copied inTO the map ruling the compond expression called "to".d -
action
Fill the director maps to the disjunction of all directors of the components.- Overrides:
action
in classSinglePhase
-
action
Fill the director maps to the disjunction of all directors of the components.- Overrides:
action
in classSinglePhase
-
action
Fill the director maps of a sequence expression, depending on the possible epsilon-results of its components.- Overrides:
action
in classSinglePhase
-
liftFirstsToSeq
All directors from "exp" are lifted into the directory maps of "ns", to point to the "exp"-expression.
-