Improvement: '{' and '}' in strings

Top  Previous  Next

Examples > Guard > Improvement: '{' and '}' in strings

 

A complication arises, if there are quoted braces, e.g. "{" or "[{}]". These characters would be interpreted wrongly as opening or closing braces. The alternatives inside of a block therefore have to be extended by strings:

 

STRING        "([^"]|\\")*"

 

The block production and accordingly the outer_block production now look as follows:

 

"{"

{{ print_at_enter(xState); }}

(

block   {{ out << xState.lp_copy(); }}

| STRING  {{ out << xState.copy(); }}

| SKIP    {{ out << xState.copy(); }}

)*

"}"

{{ print_at_exit(xState); }}

 

 

 

By means of this improvement also the code can be parsed, which is produced from the guard project.

 



This page belongs to the TextTransformer Documentation

Home  Content  German