Parameters and local variables may not be used in a look-ahead production!

Top  Previous  Next

Messages > Parameters and local variables may not be used in a look-ahead production!

 

This error message appears, if parsing with a production is controlled by a semantic code which accesses a variable declared locally or a parameter, but the production is used for a look-ahead at the same time directly or indirectly. This isn't permitted because, to avoid side effects like a doubled output, in look-ahead productions all semantic code is ignored, as far as it doesn't immediately belong to the condition of an IF or WHILE structure.

 

Example:

 

IF( Prod() )

 ...

 

The production Prod is used in an IF structure as a look-ahead production. Prod contains a WHILE structure, iwhich depends on the locally declared variable b.

 

Prod ::=

{{

bool b = true;

}}

           

WHILE ( b )

... {{b = false;}}  

END  

 

 

The use of class variables is tolerated in such cases, however, it can hurt const conditions in the generated code.



This page belongs to the TextTransformer Documentation

Home  Content  German