ANY

Top  Previous  Next

Scripts > Productions > ANY

 

The symbol ANY denotes a single token from the set of all tokens used in the project which isn't used in the same production as an alternative to this ANY symbol. It can conveniently be used to parse structures that contain

arbitrary text.  For example, the content of an exportable action can be skipped by:

 

"{_" ANY* "_}"

 

In this example the closing "_}" is an implicit alternative of the repeated ANY symbol. This means that ANY matches any terminal except "_}".

 

 

ANY recognizes only tokens which at least occur once explicitely within the rules dependent on the start rule: This point applies to every parse-system separately.

The following text will be recognized by the example above, if the literal tokens "int", "=" and ";" and an ID token for identifiers and a NUMBER token for numbers occur in the rule dependences

 

{_ int i = 3; _}

 

then is recognized as

 

"{_" ANY ANY ANY ANY ANY "_}"

 

whereby ANY represents the corresponding tokens respectively

 

"{_" "int" ID "=" NUMBER ";" "_}"

 

It is no problem, if "int" doesn't occur in the rules, because "int" could be recognized as ID too. But if NUMBER would not be used in the rule (depending from the start rule), it had to be introduced here as an explicit alternative:

 

"{_" (ANY | NUMBER )* "_}"

 

Otherwise the text would not be parsed.

 

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German