[A68-RECUTILS][COMMITTED] rec-parser.a68: fix parsing of field names

Jose E. Marchesi jemarch@gnu.org
Fri Apr 4 20:47:03 GMT 2025


---
 src/rec-parser.a68 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/rec-parser.a68 b/src/rec-parser.a68
index e9e568e..a0b42be 100644
--- a/src/rec-parser.a68
+++ b/src/rec-parser.a68
@@ -398,6 +398,26 @@ BEGIN STRING str;
            done
       FI;
 
+      # Field names can be followed by:
+
+        - A blank character or
+        - A tab or
+        - A new line or
+        - The end of the file
+
+        If the field name ends with a new line then it will be part of
+        the field value.
+      #
+
+      IF c := rec parser getc (parser);
+         c /= invalid char
+      THEN (c = " " OR c = tab char | SKIP
+            |: c = newline char | rec parser ungetc (parser, c)
+            |  error OF parser := "invalid character '" + c + "' following field name";
+               res := FALSE;
+               done)
+      FI;
+
       field name := HEAP STRING := str;
 done:
       res
-- 
2.30.2



More information about the Algol68 mailing list