Top  Previous  Next

Scripts > Productions > EXIT


If the parser meats the key word EXIT, the analysis of the text will be interrupted. The break is done in the same manner, as if the interpreter had executed a throw instruction.


EXIT can be followed by the additional key word OK. This signalizes a regular interruption. Without OK an error is signalized.


Because at the EXIT or EXIT OK the program stops immediately, other nodes cannot follow the EXIT or EXIT OK symbol. To connect an action with the EXIT symbol, the action must be written in front of the EXIT:




{{ out << xState.FileName() << " finished" << endl; }}





EXIT can be used in look-ahead parsers to finish the look-ahead. In this case the look-ahead parser is finished regularly without throwing an exception.



In the code, the TextTransformer generates, EXIT is realized by throwing an exception, if UseExcept is not set to false and if not a sub parser or look-ahead parser is just executed.


throw tetra::CTT_Exit("EXIT, true);


This exception is not catched automatically in the generated code.

This page belongs to the TextTransformer Documentation

Home  Content  German