Parameter declaration

Top  Previous  Next

Scripts > Productions > Input mask for a production > Parameter declaration

 

In the parameter field you can declare parameters for the production. The parameters can be used by the semantic actions. For example:

 

       str& s, int i

 

For such a declaration the project option for double braces "{{...}}" is applied.

By according bracketing it is possible to determine, whether a parameter shall be used inside the interpreter or shall be written to the produced source code or both. 

For example, a string could be declared for use inside the interpreter and a pointer for the produced source code, if you write the following:

 

       {-str& s-} {_int i}

 

It is important, that the parts of interpretable and exportable code result in coherent parameter lists.

 

       {-str& s-} {_int i_} {-double d-}

 

would result in a wrong list, because a comma is missing: str& s double d. Correct versions are:

 

       {-str& s-} {_int i_} {-, double d-} 

       {-str& s,-} {_int i_} {-double d-}

       {-str& s, double d-} {_int i_} 

       {_int i_} {-str& s, double d-}

 

 

Only the interpretable code is type checked by the TextTransformer. Other code will simply be copied into the generated code and the c++ compiler then might find errors.

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German