if (!data) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!buffer->used) {
- return F_data_not;
- }
-
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
-
- if (range->start >= buffer->used) {
- return F_data_not_eos;
- }
+ if (!buffer->used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+ if (range->start >= buffer->used) return F_data_not_eos;
f_status_t status = F_none;
f_array_length_t width_max = 0;
const f_array_length_t delimits_used = data->delimits.used;
uint8_t quote = 0;
-
bool vocabulary_delimited = F_false;
do {
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_utf_fragment || F_status_set_fine(status) == F_complete_not_utf) {
- if (state.flag & f_iki_state_flag_utf_fail_on_valid_not_e) {
- break;
- }
+ if (state.flag & f_iki_state_flag_utf_fail_on_valid_not_e) break;
status = F_false;
}
}
if (status == F_true) {
- found_vocabulary.start = range->start++;
+ found_vocabulary.start = range->start;
+ found_vocabulary.stop = range->start;
+ vocabulary_delimited = F_false;
+
+ status = f_utf_buffer_increment(*buffer, range, 1);
+ if (F_status_is_error(status)) break;
+
+ status = F_true;
break;
}
}
if (buffer->string[range->start] == f_iki_syntax_separator_s.string[0]) {
- if (range->start == found_vocabulary.start) break;
-
- vocabulary_delimited = F_false;
- found_vocabulary.stop = range->start - 1;
-
do {
status = f_utf_buffer_increment(*buffer, range, 1);
- } while (F_status_is_fine(status) && buffer->string[range->start] == f_iki_syntax_placeholder_s.string[0]);
+ } while (F_status_is_fine(status) && buffer->string[range->start] == f_iki_syntax_placeholder_s.string[0] && range->start <= range->stop && range->start < buffer->used);
- if (F_status_is_error(status)) break;
+ if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used) break;
// Found a valid vocabulary name.
if (buffer->string[range->start] == f_iki_syntax_quote_single_s.string[0] || buffer->string[range->start] == f_iki_syntax_quote_double_s.string[0]) {
+ status = F_true;
quote = buffer->string[range->start];
}
else {
-
- // This is not a valid IKI vocabulary, so reset the position to the separator where the outerloop will then increment past it.
- range->start = found_vocabulary.stop + 1;
+ status = F_false;
}
break;
if (separator_found) {
if (buffer->string[range->start] == f_iki_syntax_quote_single_s.string[0] || buffer->string[range->start] == f_iki_syntax_quote_double_s.string[0]) {
+ status = F_true;
vocabulary_delimited = F_true;
quote = buffer->string[range->start];
}
+ else {
+ status = F_next;
+ }
break;
}
+
+
if (buffer->string[range->start] == f_iki_syntax_separator_s.string[0]) {
separator_found = F_true;
}
else if (buffer->string[range->start] != f_iki_syntax_slash_s.string[0]) {
+ status = F_next;
+
break;
}
if (F_status_is_error(status)) break;
} // while
- if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used) break;
+ if (status == F_true) break;
+ if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used || status == F_next) break;
}
else {
width_max = buffer->used - range->start;
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_utf_fragment || F_status_set_fine(status) == F_complete_not_utf) {
- if (state.flag & f_iki_state_flag_utf_fail_on_valid_not_e) {
- break;
- }
+ if (state.flag & f_iki_state_flag_utf_fail_on_valid_not_e) break;
status = F_false;
}
}
}
+ if (status == F_true) {
+ found_vocabulary.stop = range->start;
+ }
+
// Not a valid IKI vocabulary name.
- if (status != F_true) break;
+ else {
+ status = f_utf_buffer_increment(*buffer, range, 1);
+ if (F_status_is_error(status)) break;
+
+ status = F_next;
+
+ break;
+ }
}
status = f_utf_buffer_increment(*buffer, range, 1);
if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used) break;
+ if (status == F_next) {
+ quote = 0;
+ vocabulary_delimited = F_false;
+
+ continue;
+ }
+
// Process potentially valid content.
if (quote) {
found_content = ++range->start;
vocabulary_delimited = F_false;
quote = 0;
- ++range->start;
-
break;
}
data->content.array[data->content.used].start = found_content;
data->content.array[data->content.used++].stop = range->start - 1;
- if (++range->start > range->stop) {
- return F_none_stop;
- }
-
- if (range->start >= buffer->used) {
- return F_none_eos;
- }
+ if (++range->start > range->stop) return F_none_stop;
+ if (range->start >= buffer->used) return F_none_eos;
return F_none;
}
data->content.array[data->content.used].start = found_content;
data->content.array[data->content.used++].stop = range->start - 1;
- if (++range->start > range->stop) {
- return F_none_stop;
- }
-
- if (range->start >= buffer->used) {
- return F_none_eos;
- }
+ if (++range->start > range->stop) return F_none_stop;
+ if (range->start >= buffer->used) return F_none_eos;
return F_none;
}
if (F_status_is_error(status)) break;
} // while
- if (F_status_is_error(status)) break;
-
quote = 0;
}
- else {
- vocabulary_delimited = F_false;
- }
if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used) break;
return status;
}
- if (range->start > range->stop) {
- return F_data_not_stop;
- }
+ if (range->start > range->stop) return F_data_not_stop;
return F_data_not_eos;
}