function that extracts items inside {}
void print_curly_bracket(const char* string)
{
goto BASE_STATE;
BASE_STATE:
switch(*string++)
{
case '\0': return;
case '{': goto CURLY_STATE;
default: goto BASE_STATE;
}
CURLY_STATE:
switch(*string)
{
case '\0': return;
case '}':
putc('\n', stdout); // ends the entry with newline
string++;
goto BASE_STATE;
default:
putc(*string++, stdout);
goto CURLY_STATE;
}
}