|Top Previous Next|
Scripts > Productions > ANY > Options
This section is only for specialists. It is recommended to the normal user to leave the default setting "no failure alternative for ANY" in the project options and to skip this section.
In the project options you can choose, whether the context of the production which uses an ANY symbol is taken into account at the calculation of its token set or not.
1. no failure alternative
In accordance with this option the alternatives of a production which uses the ANY symbol, is taken into account at the calculation of the token set of this symbol. Example:
Produktion1 ::= ANY | "a"
Produktion2 ::= "b"
Produktion3 ::= Produktion1 | Produktion2
Because Produktion2 is an alternative to Produktion1 "b" is an alternative of ANY. ANY therefore recognizes all tokens apart from "a" and "b".
This option is the default for new projects since it might correspond to the intuitions of the user.
There is a problem in a special case, though. If the ANY symbol is in an nullable structure at the end of a production and this has different successors in different contexts, an unexpected behavior can result.
Any ::= ANY+
Production ::= "a" Any "b" | "c" Any "d"
In this case the text "a d b" isn't parsed. The first alternative would let expect this but because of the second "d" is excluded from the set of the tokens recognized by ANY
In such cases the TextTransformer generates a warning.
2. failure alternative
The calculation of the tokens recognized by ANY is more simple and therefore is a little faster if the context isn't taken into account. However, this has the serious disadvantage that e.g. Produktion3 above doesn't compile. ANY then recognizes all tokens apart from "a" and therefore is in conflict with Produktion2.
This option can make sense to guarantee compatibility with Coco/R projects since ANY is calculated this way there.
This page belongs to the TextTransformer Documentation
|Home Content German|