src/tokeniser/tokeniser.c
hubbub_error hubbub_tokeniser_handle_markup_declaration_open(
		hubbub_tokeniser *tokeniser)
{
	size_t len;
	const uint8_t *cptr;
	parserutils_error error;
	uint8_t c;

	assert(tokeniser->context.pending == 0);

	error = parserutils_inputstream_peek(tokeniser->input, 0, &cptr, &len);

	if (error != PARSERUTILS_OK) {
		if (error == PARSERUTILS_EOF) {
			tokeniser->state = STATE_BOGUS_COMMENT;
			return HUBBUB_OK;
		} else {
			return hubbub_error_from_parserutils_error(error);
		}
	}

	c = *cptr;

	if (c == '-') {
		tokeniser->context.pending = len;
		tokeniser->state = STATE_MATCH_COMMENT;
	} else if ((c & ~0x20) == 'D') {
		tokeniser->context.pending = len;
		tokeniser->context.match_doctype.count = len;
		tokeniser->state = STATE_MATCH_DOCTYPE;
	} else if (tokeniser->process_cdata_section == true && c == '[') {
		tokeniser->context.pending = len;
		tokeniser->context.match_cdata.count = len;
		tokeniser->state = STATE_MATCH_CDATA;
	} else {
		tokeniser->state = STATE_BOGUS_COMMENT;
	}

	return HUBBUB_OK;
}
/* this state always switches to another state straight away */
this state always switches to another state straight away
this state always switches to another state straight away
hubbub_error hubbub_tokeniser_handle_markup_declaration_open(
		hubbub_tokeniser *tokeniser)
{
	size_t len;
	const uint8_t *cptr;
	parserutils_error error;
	uint8_t c;
	assert(tokeniser->context.pending == 0);
	error = parserutils_inputstream_peek(tokeniser->input, 0, &cptr, &len);
	if (error != PARSERUTILS_OK) {
		if (error == PARSERUTILS_EOF) {
			tokeniser->state = STATE_BOGUS_COMMENT;
			return HUBBUB_OK;
		} else {
			return hubbub_error_from_parserutils_error(error);
		}
	}
	c = *cptr;
	if (c == '-') {
		tokeniser->context.pending = len;
		tokeniser->state = STATE_MATCH_COMMENT;
	} else if ((c & ~0x20) == 'D') {
		tokeniser->context.pending = len;
		tokeniser->context.match_doctype.count = len;
		tokeniser->state = STATE_MATCH_DOCTYPE;
	} else if (tokeniser->process_cdata_section == true && c == '[') {
		tokeniser->context.pending = len;
		tokeniser->context.match_cdata.count = len;
		tokeniser->state = STATE_MATCH_CDATA;
	} else {
		tokeniser->state = STATE_BOGUS_COMMENT;
	}
	return HUBBUB_OK;
}
hubbub_error hubbub_tokeniser_handle_markup_declaration_open ( hubbub_tokeniser * tokeniser ) { size_t len ; const uint8_t * cptr ; parserutils_error error ; uint8_t c ; assert ( tokeniser -> context . pending == 0 ) ; error = parserutils_inputstream_peek ( tokeniser -> input , 0 , & cptr , & len ) ; if ( error != PARSERUTILS_OK ) { if ( error == PARSERUTILS_EOF ) { tokeniser -> state = STATE_BOGUS_COMMENT ; return HUBBUB_OK ; } else { return hubbub_error_from_parserutils_error ( error ) ; } } c = * cptr ; if ( c == ' ' ) { tokeniser -> context . pending = len ; tokeniser -> state = STATE_MATCH_COMMENT ; } else if ( ( c & ~ 0x20 ) == ' ' ) { tokeniser -> context . pending = len ; tokeniser -> context . match_doctype . count = len ; tokeniser -> state = STATE_MATCH_DOCTYPE ; } else if ( tokeniser -> process_cdata_section == true && c == ' ' ) { tokeniser -> context . pending = len ; tokeniser -> context . match_cdata . count = len ; tokeniser -> state = STATE_MATCH_CDATA ; } else { tokeniser -> state = STATE_BOGUS_COMMENT ; } return HUBBUB_OK ; }
this state always switches to another state straight away
this state always switches to another state straight away