]> Kevux Git Server - fll/commitdiff
Regression: Some IKI vocabularies are missing their first character.
authorKevin Day <thekevinday@gmail.com>
Tue, 1 Mar 2022 02:49:52 +0000 (20:49 -0600)
committerKevin Day <thekevinday@gmail.com>
Tue, 1 Mar 2022 02:49:52 +0000 (20:49 -0600)
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.

level_0/f_iki/c/iki.c

index a09643ada8e7b8aac27edce53b1fd07a761d4017..869ee0a649b182fef35fa46fca0d1154d9a60839 100644 (file)
@@ -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) {