Actions

Top  Previous  Next

User interface > Main menu > Menu: Help > Wizards > New project wizard > Actions

 

For the parsers created by the wizard, actions can be generated automatically, which consist in copying the recognized text mostly. These actions then can be modified with little effort, so that the output text gets the desired form.

 

Direct output

 

For every token an action is created, which writes the recognized text section together with the ignored characters directly in the output. E.g.:

 

Token1 {{ out << xState.copy();}}

Token2 {{ out << xState.copy();}}

 

The direct output is the most efficient way to process the text and therefore should be chosen if possible. The order of the text sections stays with it unchanged, though. 

 

Writing into string variables

 

For every token an action is created, which writes the recognized text section together with the ignored characters into string variables. E.g.:

 

Token1 {{ s1 = xState.copy();}}

Token2 {{ s2 = xState.copy();}}

 

The recognized text sections are duplicated here, and then can be written in an arbitrary order, however. E.g.:

 

out << s2 << s1;

 

Creating a parse tree

 

For every token an action is created, which writes the recognized text section together with the ignored characters into node variables. E.g.:

 

Token1 {{ nRule.add("Token1", xState.copy());}}

Token2 {{ nRule.add("Token2", xState.copy());}}

 

A parse tree allows versatile and multiple further processing of its nodes. It, however, isn't trivial, to write correct routines for this processing.

 

Creating a DOM

 

With this option a parse-tree is produced like above, but from dnode's instead of from node's. A XML document finally is written in the output.

 

 

No actions

 

Is then advisable to write the code for the actions by hand if only a small portion of the recognized text shall be put out or if the above methods shall be combined with each other.

 



This page belongs to the TextTransformer Documentation

Home  Content  German