Package eu.bandm.tools.umod
Class UMod2format.Compiler
java.lang.Object
eu.bandm.tools.tdom.runtime.BaseVisitor
eu.bandm.tools.formatfrontends.absy.Visitor
eu.bandm.tools.formatfrontends.GenericCompiler
eu.bandm.tools.umod.UMod2format.Compiler
- All Implemented Interfaces:
PCDataVisitor
- Enclosing class:
- UMod2format
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected Format
Keeps track of the data object which is currently rendered to a Format.protected UMod.Forest
Needed for find the class definitions (/types) of fields referred to.protected UMod.Type
The aggregate type, if current mode is a Mapoid, else the type of the current model (even if it is an item of a Listoid).protected UMod.FieldDef
set byvisit(Element_ref)
and read only for error diagnosisonly byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
protected final Format
protected int
protected Format
set byvisit(Element_ref)
and read only byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
protected UMod.Type
set byvisit(Element_ref)
and read only byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
protected UMod.ClassDef
Needed ONLY for error message generateion.Fields inherited from class eu.bandm.tools.formatfrontends.GenericCompiler
callFunctionForRaisingException, checkedmode, constcache, exprCache, fresult, isdynamic, MODIF_CONST, NAME_CONST_FORMAT_EMPTY, NAME_METHOD_THROW_TAKE_ALTERNATIVE, NAME_VAR_DEFAULT_INDENT, NAME_VAR_FORMAT_RESULT, NAME_VAR_MODE, rec, REF_FORMAT_Format, REF_FORMAT_Formats, targetclass, WRAPPEDCLASS_CompoundConstructor, WRAPPEDCLASS_Format, WRAPPEDCLASS_Function, WRAPPEDCLASS_ListoidFormatter, WRAPPEDCLASS_Lists, WRAPPEDCLASS_MapEntry, WRAPPEDCLASS_MapoidFormatter, WRAPPEDCLASS_Object, WRAPPEDCLASS_TakeAlternativeException, WRAPPEDCLASS_TryerCatcher
Fields inherited from class eu.bandm.tools.tdom.runtime.BaseVisitor
validating
-
Constructor Summary
ConstructorDescriptionCompiler
(UMod.Forest umod0, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) Derived consructor which additionally only sets the current umod model. -
Method Summary
Modifier and TypeMethodDescriptionvoid
compileOnePattern
(UMod.ClassDef cd, GeneratedMethod gm0, String code, String initialModel) Derived method which parses the format code of one class definition into a tdom, then sets the current model and its type, and finally calls the base method.protected void
error
(Locatable<XMLDocumentIdentifier> loc, String text) protected UMod.ClassDef
protected Format
Currently only needed to compileescapeToJava()
in the variant operating directly on the model element.void
A specialization ofGenericCompiler.initTransformerClass()
, because a local field must be accessed.void
makeclassstring
(Locatable<XMLDocumentIdentifier> loc, boolean upcase) protected eu.bandm.tools.formatfrontends.absy.Document_pattern
parseHint
(String hint, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) protected void
void
visit
(eu.bandm.tools.formatfrontends.absy.Element_child element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_clss element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_clssUPCASE element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_from element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_instanceTest el) <!ELEMENT instanceTest (ref, ref?) >
void
visit
(eu.bandm.tools.formatfrontends.absy.Element_mode element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_numberedref element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_ref element) Only sets "subtypefound" to the type of the field and "submodelfound" to the Format of the field getter function.void
visit
(eu.bandm.tools.formatfrontends.absy.Element_supr element) Creates a call to the format converting routine defined for the superclass.
Attention currently: must assume that format of some superclass (if any) has already been translated.void
visit
(eu.bandm.tools.formatfrontends.absy.Element_swtch element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_t_alt el) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_t_choice el) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_t_seq el) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_text element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_thiz element) void
visit
(eu.bandm.tools.formatfrontends.absy.Element_too element) protected void
warning
(Locatable<XMLDocumentIdentifier> loc, String text) Methods inherited from class eu.bandm.tools.formatfrontends.GenericCompiler
checkconst, compileCallToFormatText, compileModeSwitch, compileOnePattern, create_resultfield, error, expr, getMsgReceiver, process_compound, refer, setMsgReceiver, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, warning
Methods inherited from class eu.bandm.tools.formatfrontends.absy.Visitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
Methods inherited from class eu.bandm.tools.tdom.runtime.BaseVisitor
visit
-
Field Details
-
topleveldef
Needed ONLY for error message generateion. -
currentumod
Needed for find the class definitions (/types) of fields referred to. Used only ingetclassdef(UMod.T_reference)
. -
curmodel
Keeps track of the data object which is currently rendered to a Format. -
curtype
The aggregate type, if current mode is a Mapoid, else the type of the current model (even if it is an item of a Listoid). The relation of the java type of the current value ofcurmodel
the value of this field is ...java type of current model value of curtype MapEntry<D,R> T_map/T_multimap anObjectT T_reference / .javaDecl=anObjectT -
subtypefound
set byvisit(Element_ref)
and read only byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
-
submodelfound
set byvisit(Element_ref)
and read only byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
-
modeSelected
-
fieldfound
set byvisit(Element_ref)
and read only for error diagnosisonly byUMod2format.Compiler.Subformat.visit(Element_child)
andvisit(Element_switch)
-
nextSubformatIndex
protected int nextSubformatIndex
-
-
Constructor Details
-
Compiler
Derived consructor which additionally only sets the current umod model. This is needed by the specific oode generation routines.
-
-
Method Details
-
getCurrentModel
Description copied from class:GenericCompiler
Currently only needed to compileescapeToJava()
in the variant operating directly on the model element. Introduced 20170428.- Specified by:
getCurrentModel
in classGenericCompiler
-
error
-
warning
-
initTransformerClass
A specialization ofGenericCompiler.initTransformerClass()
, because a local field must be accessed.- Overrides:
initTransformerClass
in classGenericCompiler
-
compileOnePattern
public void compileOnePattern(UMod.ClassDef cd, GeneratedMethod gm0, String code, String initialModel) Derived method which parses the format code of one class definition into a tdom, then sets the current model and its type, and finally calls the base method. The variables containing the current model and its type are required by the umod-specific oode generation routines. -
parseHint
protected eu.bandm.tools.formatfrontends.absy.Document_pattern parseHint(String hint, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) -
tdomonly
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_t_seq el) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_t_alt el) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_t_choice el) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_instanceTest el) <!ELEMENT instanceTest (ref, ref?) >
- Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
makeclassstring
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_clss element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_clssUPCASE element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
getclassdef
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_thiz element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_mode element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_from element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_too element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_numberedref element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_ref element) Only sets "subtypefound" to the type of the field and "submodelfound" to the Format of the field getter function. Is called from a sub-visitor or from a "$switch" context. Therefore it does not generate any code on its own. If we are in a code context for a Listoid, then "curtype" is set to the type of the listoids elements.- Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_text element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_swtch element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_supr element) Creates a call to the format converting routine defined for the superclass.
Attention currently: must assume that format of some superclass (if any) has already been translated.- Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-
visit
public void visit(eu.bandm.tools.formatfrontends.absy.Element_child element) - Overrides:
visit
in classeu.bandm.tools.formatfrontends.absy.Visitor
-