src/tokeniser/tokeniser.c
hubbub_error hubbub_tokeniser_handle_before_attribute_value(
		hubbub_tokeniser *tokeniser)
{
	hubbub_tag *ctag = &tokeniser->context.current_tag;

	size_t len;
	const uint8_t *cptr;
	parserutils_error error;
	uint8_t c;

	error = parserutils_inputstream_peek(tokeniser->input, 
			tokeniser->context.pending, &cptr, &len);

	if (error != PARSERUTILS_OK) {
		if (error == PARSERUTILS_EOF) {
			/** \todo parse error */
			tokeniser->state = STATE_DATA;
			return emit_current_tag(tokeniser);
		} else {
			return hubbub_error_from_parserutils_error(error);
		}
	}

	c = *cptr;

	if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
		tokeniser->context.pending += len;
	} else if (c == '"') {
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_DQ;
	} else if (c == '&') {
		/* Don't consume the '&' -- reprocess in UQ state */
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	} else if (c == '\'') {
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_SQ;
	} else if (c == '>') {
		/** \todo parse error */
		tokeniser->context.pending += len;

		tokeniser->state = STATE_DATA;
		return emit_current_tag(tokeniser);
	} else if (c == '\0') {
		START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
				u_fffd, sizeof(u_fffd));
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	} else {
		if (c == '=') {
			/** \todo parse error */
		}

		START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
				cptr, len);

		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	}

	return HUBBUB_OK;
}
/* this state is only ever triggered by an '=' */
this state is only ever triggered by an '='
this state is only ever triggered by an ' = '
hubbub_error hubbub_tokeniser_handle_before_attribute_value(
		hubbub_tokeniser *tokeniser)
{
	hubbub_tag *ctag = &tokeniser->context.current_tag;
	size_t len;
	const uint8_t *cptr;
	parserutils_error error;
	uint8_t c;
	error = parserutils_inputstream_peek(tokeniser->input, 
			tokeniser->context.pending, &cptr, &len);
	if (error != PARSERUTILS_OK) {
		if (error == PARSERUTILS_EOF) {
			tokeniser->state = STATE_DATA;
			return emit_current_tag(tokeniser);
		} else {
			return hubbub_error_from_parserutils_error(error);
		}
	}
	c = *cptr;
	if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
		tokeniser->context.pending += len;
	} else if (c == '"') {
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_DQ;
	} else if (c == '&') {
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	} else if (c == '\'') {
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_SQ;
	} else if (c == '>') {
		tokeniser->context.pending += len;
		tokeniser->state = STATE_DATA;
		return emit_current_tag(tokeniser);
	} else if (c == '\0') {
		START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
				u_fffd, sizeof(u_fffd));
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	} else {
		if (c == '=') {
		}
		START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
				cptr, len);
		tokeniser->context.pending += len;
		tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
	}
	return HUBBUB_OK;
}
hubbub_error hubbub_tokeniser_handle_before_attribute_value ( hubbub_tokeniser * tokeniser ) { hubbub_tag * ctag = & tokeniser -> context . current_tag ; size_t len ; const uint8_t * cptr ; parserutils_error error ; uint8_t c ; error = parserutils_inputstream_peek ( tokeniser -> input , tokeniser -> context . pending , & cptr , & len ) ; if ( error != PARSERUTILS_OK ) { if ( error == PARSERUTILS_EOF ) { tokeniser -> state = STATE_DATA ; return emit_current_tag ( tokeniser ) ; } else { return hubbub_error_from_parserutils_error ( error ) ; } } c = * cptr ; if ( c == ' \t ' || c == ' \n ' || c == ' \f ' || c == ' ' || c == ' \r ' ) { tokeniser -> context . pending += len ; } else if ( c == ' ' ) { tokeniser -> context . pending += len ; tokeniser -> state = STATE_ATTRIBUTE_VALUE_DQ ; } else if ( c == ' ' ) { tokeniser -> state = STATE_ATTRIBUTE_VALUE_UQ ; } else if ( c == ' \' ' ) { tokeniser -> context . pending += len ; tokeniser -> state = STATE_ATTRIBUTE_VALUE_SQ ; } else if ( c == ' ' ) { tokeniser -> context . pending += len ; tokeniser -> state = STATE_DATA ; return emit_current_tag ( tokeniser ) ; } else if ( c == ' \0 ' ) { START_BUF ( ctag -> attributes [ ctag -> n_attributes - 1 ] . value , u_fffd , sizeof ( u_fffd ) ) ; tokeniser -> context . pending += len ; tokeniser -> state = STATE_ATTRIBUTE_VALUE_UQ ; } else { if ( c == ' ' ) { } START_BUF ( ctag -> attributes [ ctag -> n_attributes - 1 ] . value , cptr , len ) ; tokeniser -> context . pending += len ; tokeniser -> state = STATE_ATTRIBUTE_VALUE_UQ ; } return HUBBUB_OK ; }
this state is only ever triggered by an '='
this state is only ever triggered by an ' = '
/** \todo parse error */ /* Don't consume the '&' -- reprocess in UQ state */ /** \todo parse error */ /** \todo parse error */