Parameter

Top  Previous  Next

Scripts > Class elements and c++ instructions > Input mask for class elements > Parameter

 

Depending on the activation of the variable check box in the toolbar of an interpreter script

 

Variable

 

the parameter field is invisible or visible.

For the syntax the same essentially applies, what is said for the parameters of productions.

 

 

Implicit xState parameter

 

A problem exists, if a call to a method shall be valid as well for the interpreter as for the generated c++ code. In the declarations of methods of the generated parser class an xState parameter is inserted automatically at the first position. For example:

 

void Method(state_type& xState);

 

To make the use of the interpreter more comfortable, you need not write the xState parameter in a call of this method. The interpreter always can access the state of the parser:

 

{- Method( ); -}

 

In the interpreter this code will be parsed and the missing parameter is added automatically. But if the code is exported, it simply will be copied, so that this parameter must be set explicitly.

 

{_  Method(xState); _}

 

If the semantic code shall be valid internally and externally xState has to be set:

 

{= Method(xState); =}

 

Since version 0.9.8.1 the xState parameter is inserted into the generated code automatically, if the Only copy option is not set, and if the method is not called within a part of code, which only can be exported.

 

In the project options you can activate a warning, which will appear, if such a state parameter is missing.

 



This page belongs to the TextTransformer Documentation

Home  Content  German