From: Kevin Day Date: Tue, 1 Mar 2022 02:49:52 +0000 (-0600) Subject: Regression: Some IKI vocabularies are missing their first character. X-Git-Tag: 0.5.9~113 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=ff45da75be1d41564c247e68813dca9d3e828e48;p=fll Regression: Some IKI vocabularies are missing their first character. The previous bugfix (4f0c01eb) failed to check for additional problems introduced by the changes. I should focus on writing unit tests for fl_read() shortly. --- diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index a09643a..869ee0a 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -136,11 +136,7 @@ extern "C" { } if (buffer->string[range->start] == f_iki_syntax_separator_s.string[0]) { - if (range->start == found_vocabulary.start) { - ++range->start; - - break; - } + if (range->start == found_vocabulary.start) break; vocabulary_delimited = F_false; found_vocabulary.stop = range->start - 1; @@ -153,12 +149,18 @@ extern "C" { // 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]) { - quote = buffer->string[range->start++]; + quote = buffer->string[range->start]; + } + else { - break; + // 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; } + + break; } - else if (buffer->string[range->start] == f_iki_syntax_slash_s.string[0]) { + + if (buffer->string[range->start] == f_iki_syntax_slash_s.string[0]) { bool separator_found = F_false; vocabulary_slash_first = range->start; @@ -185,12 +187,13 @@ extern "C" { 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]) { vocabulary_delimited = F_true; - quote = buffer->string[range->start++]; + quote = buffer->string[range->start]; } break; } - else if (buffer->string[range->start] == f_iki_syntax_separator_s.string[0]) { + + 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]) { @@ -221,7 +224,7 @@ extern "C" { // Process potentially valid content. if (quote) { - found_content = range->start; + found_content = ++range->start; while (range->start <= range->stop && range->start < buffer->used) {