Semantic action

Top  Previous  Next

Scripts > Token definitions > Input mask for a token > Semantic action

 

The field Semantic action is used for c++ instructions that specify how the parser reacts to the recognition of the token. Even if a token is often used in the grammar, this reaction must be specified only once. For example, like a bilingual dictionary the translation of a token text can be given here:

 

Text:        "Hello world"

Action: out << "Hallo Welt";

 

For the syntax of the instruction the same is applied as described for semantic actions in productions.

 

If you don't use braces, the project options for double braces are applied.

 

For token actions no nodes will be created in the syntax tree. So the tree becomes clearer.

 

It isn't possible to define a transitional action for a token if an action is assigned to it as described here.



This page belongs to the TextTransformer Documentation

Home  Content  German