jweinst1
6/25/2018 - 3:53 AM

function that extracts items inside {}

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;
    }

}