rem: case TYPE_SEMICOLON: if (format[0] != ';')
add: case TYPE_COLON: if (format[0] != ':')
context: parsedate_etc(const char *dateString, time_t now, int *_flags){	// preparse date string so that it can be easily compared to our formats		parsed_element elements[MAX_ELEMENTS];	if (preparseDate(dateString, elements) < B_OK) {		*_flags = PARSEDATE_INVALID_DATE;		return B_ERROR;	}	/*for (int32 index = 0; elements[index].type != TYPE_END; index++) {		parsed_element e = elements[index];		char type[32];		sprintf(type, "0x%lx", e.type);		if (e.type & TYPE_UNIT)			strcat(type, " unit");		if (e.type & TYPE_RELATIVE)			strcat(type, " relative");		printf("  %ld: type = %ld (%s), value = %Ld (%s)\n",			index, e.type & TYPE_MASK, type, e.value,			e.value_type == VALUE_NUMERICAL ? "numerical" :			(e.value_type == VALUE_STRING ? "string" : "char"));	}*/	bool optional[MAX_ELEMENTS];	for (int32 index = 0; sFormatsTable[index]; index++) {		// test if this format matches our date string				const char *format = sFormatsTable[index];		uint32 position = 0;		parsed_element *element = elements;		while (element->type != TYPE_END) {			// skip whitespace			while (isspace(format[0]))				format++;			if (format[0] == '[' && format[2] == ']') {				optional[position] = true;				format++;			} else				optional[position] = false;			switch (element->value_type) {				case VALUE_CHAR:					// check the allowed single characters					switch (element->type & TYPE_MASK) {						case TYPE_DOT:							if (format[0] != '.')								goto next_format;							break;						case TYPE_DASH:							if (format[0] != '/' && format[0] != '-')								goto next_format;							break;						case TYPE_COLON:							if (format[0] != ',')								goto next_format;							break;						case TYPE_SEMICOLON:							if (format[0] != ';')								goto next_format;							break;						default:							goto next_format;					}					break;				case VALUE_NUMERICAL:					switch (format[0]) {						case 'd':							if (element->value > 31)								goto next_format;							break;						case 'm':							if (element->value > 12)								goto next_format;							break;						case 'H':						case 'I':							if (element->value > 24)								goto next_format;							break;						case 'M':						case 'S':							if (element->value > 59)								goto next_format;							break;						case 'y':						case 'Y':						case 'T':							break;						default:							goto next_format;					}					break;								case VALUE_STRING:					switch (format[0]) {						case 'a':	// weekday						case 'A':							if ((element->type & TYPE_MASK) != TYPE_WEEKDAY)								goto next_format;							break;						case 'b':	// month						case 'B':							if ((element->type & TYPE_MASK) != TYPE_MONTH)								goto next_format;							break;						case 'p':	// meridian							if ((element->type & TYPE_MASK) != TYPE_MERIDIAN)								goto next_format;							break;						case 'z':	// time zone						case 'Z':							if ((element->type & TYPE_MASK) != TYPE_TIME_ZONE)								goto next_format;							break;						case 'T':							// last/next/this							break;						default:							goto next_format;					}					break;			}			// format matched at this point, check next element			if (optional[position])				format++;			format++;			position++;			element++;			continue;		next_format:			// format didn't match element - let's see if the current			// one is only optional (in which case we can continue)			if (!optional[position])				goto skip_format;							optional[position] = false;			format += 2;			position++;				// skip the closing ']'		}		// check if the format is already empty (since we reached our last element)		while (format[0]) {			if (format[0] == '[')				format += 3;			else if (isspace(format[0]))				format++;			else				break;		}		if (format[0])			goto skip_format;		// made it here? then we seem to have found our guy		return computeDate(sFormatsTable[index], optional, elements, now, _flags);	skip_format:		// check if the next format has the same beginning as the skipped one,		// and if so, skip that one, too.		int32 length = format + 1 - sFormatsTable[index];		while (sFormatsTable[index + 1]			&& !strncmp(sFormatsTable[index], sFormatsTable[index + 1], length))			index++;	}	// didn't find any matching formats	return B_ERROR;}