Quick wizard for function tables

Top  Previous  Next

User interface > Main menu > Menu: Help > Wizards > Function-Table-Wizard > Quick wizard for function tables

 

The function table wizard makes the extension of a function table with new functions easier. The wizard appears if you click with the right mouse button on the name of a function table in the list of the class elements.

 

Assistant_FunTable_en

 

Write the label of the node type and the name of the function, which shall handle this type, in the upper two fields. Then, by the Insert button an additional entry for the function table is created:

 

m_ftExpr.add("chars", "Handle_chars");

 

and at the same time a new function is created, which has the same parameters as defined for the function table and a return type, which corresponds to the type of the function table.

In the combo box Kind, you first can chose a frame type for the new function.

If e.g. the actual function table is of the type str_mstrfun with a node parameter, with the iterator frame the following function will be inserted on the element page:

 

Name:                Handle_chars

Type:                str

Parameter:        const node& xnNode

Text:

 

{{

str s;

node pos = xnNode.firstChild();

while(pos != node::npos)

{

s += m_ftExpr.visit(xState, pos);

pos = pos.nextSibling();

}

 

return s;

}}

 

For the Kind value the following text is created:

 

{{

return xnNode.value();

}}

 

For the Kind empty the brackets are created only.

The function frame then can be modified by hand.

 

A simple method to construct a solid linkage of:

 

1.a function table
2.an according function
3.the nodes, which represent the production (the text recognized by the production)

 

is, to name the label by the name of the production. That's why the wizard contains a list of the names of the productions as choice for the label.

If the check box Insert tree nodes in production is activated, in front of the parameters of the production is put an additional node parameter and to the beginning of the text the following code is written:

 

node n("chars");

xNode.addChildLast(n);

 

For the calls of the production the additional parameter must be inserted by hand.

If in the calling production the same code was written by the wizard, the additional parameter mostly is: n:

 

 

 

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German