Function-Table-Wizard

Top  Previous  Next

User interface > Main menu > Menu: Help > Wizards > Function-Table-Wizard

 

The function table wizard exists in a small version and in an extended version. The small Quick-Wizard for the extension of an existing function table with single functions appears, if you click with the right mouse button on the name of a function table in the list of the class elements. The extended wizard, which is described below, can be invoked either from the quick wizard or as an item of the help menu.

 

By means of the function table wizard new tables can be created and existing tables can be extended, whereby it is possible to create whole groups of correspondences of labels and function names at once. In cooperation with the tree wizard it is even possible to insert code for the generation of a complete parse tree for a complete project in all productions automatically. This possibility should be executed only once for a project since a repeat leads to name conflicts.

 

The names of the created functions and the name of the function table are derived from a base-name:

 

FTWizard_Basename_en

 

 

If the beginning "m_ft" of the name for the function table is changed afterwards. the wizard wiil not work correctly with this table any more.

 

 

Background:

 

One of the paradigms for transformation programs to create in a first step a parse tree which then can be used in various ways for the generation of output. Tree nodes in the parse tree represent productions and tokens.

The function table wizard is supporting a recommendable scheme to design such trees in the TextTransformer. In accordance with this scheme the names of the respective productions or tokens are used as labels of the nodes.

Special tables can be created in the TextTransformer: the function tables, which assign functions to the labels of the nodes. This relation is thus indirectly at the same time a relation of functions to the productions or tokens. Each of these functions serves for the processing of the accompanying node and with that for the processing of the production or the token.

 

Different tokens or productions frequently are treated in the same way. E.g. many of the texts recognized by tokens have to be output again unchanged. Different tokens or productions can therefore be processed with the same function. If a special token requires, however, a special treatment, then a special function is written for its node.

 

 

Example:

 

Name of the script

Label of the node

Function

normal1

normal1

Handle_Default

normal2

normal2

Handle_Default

special1a

special1a

Handle_special1

special1b

special1b

Handle_special1

special2

special2

Handle_special2

 

The inititialization of the function table m_ft looks like:

 

m_ft.add("", "Handle_Default");

m_ft.add("special1a", "Handle_special1");

m_ft.add("special1b", "Handle_special1");

m_ft.add("special2", "Handle_special2");

 

The corresponding nodes must be created and added to the complete parse tree in the scripts. A reference on the last node of the parse tree is submitted to the script as a parameter:

 

 

Parameter:

node& xNode

Text:

node n("normal1");

xNode.addChildLast(n);

 

or

 

Parameter:

node& xNode

Text:

node n("special2");

xNode.addChildLast(n);

 

Accordingly for the other scripts.

When a script is called, an additional parameter has to be passed now:

 

normal1[n]

special2[n]

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German