My agentic slop goes here. Not intended for anyone else!

more

Changed files
+29 -18
yaml
ocaml-yamle
lib
tests
+24 -18
yaml/ocaml-yamle/lib/scanner.ml
···
let buf = Buffer.create 256 in
let trailing_breaks = Buffer.create 16 in
-
(* Skip to content indentation, skipping empty lines *)
let rec skip_to_content_indent () =
if !content_indent > 0 then begin
-
(* Explicit indent - skip exactly content_indent spaces *)
let spaces_skipped = ref 0 in
while !spaces_skipped < !content_indent && Input.next_is (( = ) ' ') t.input do
incr spaces_skipped;
···
Buffer.add_char trailing_breaks '\n';
Input.consume_break t.input;
skip_to_content_indent ()
end else if Input.next_is_blank t.input then begin
(* Line has spaces beyond content_indent - check if rest is only blanks *)
let idx = ref 0 in
···
skip_to_content_indent ()
| _ ->
(* Has content *)
-
())
-
end
end else begin
(* Implicit indent - skip empty lines without consuming spaces *)
if Input.next_is_break t.input then begin
···
Input.consume_break t.input;
skip_to_content_indent ()
| _ ->
-
(* Has content - don't consume anything *)
-
()
-
end
end
in
(* Read content *)
let rec read_lines () =
-
skip_to_content_indent ();
(* Check if we're at content *)
if Input.is_eof t.input then ()
else if Input.at_document_boundary t.input then ()
else begin
-
(* Count leading spaces *)
-
let line_indent = ref 0 in
while Input.next_is (( = ) ' ') t.input do
-
incr line_indent;
ignore (Input.next t.input)
done;
-
(* For explicit indent, line_indent is extra beyond content_indent *)
-
if !content_indent > 0 then
-
line_indent := !content_indent + !line_indent;
(* Determine content indent from first content line (implicit case) *)
if !content_indent = 0 then begin
-
if !line_indent <= base_indent then begin
(* No content - restore position conceptually *)
()
end else
-
content_indent := !line_indent
end;
-
if !line_indent < !content_indent then begin
(* Dedented - done with content *)
()
end else begin
···
(* Add extra indentation for literal *)
if literal then begin
-
for _ = !content_indent + 1 to !line_indent do
Buffer.add_char buf ' '
done
end;
···
let buf = Buffer.create 256 in
let trailing_breaks = Buffer.create 16 in
+
(* Skip to content indentation, skipping empty lines.
+
Returns the number of spaces actually skipped (important for detecting dedentation). *)
let rec skip_to_content_indent () =
if !content_indent > 0 then begin
+
(* Explicit indent - skip up to content_indent spaces *)
let spaces_skipped = ref 0 in
while !spaces_skipped < !content_indent && Input.next_is (( = ) ' ') t.input do
incr spaces_skipped;
···
Buffer.add_char trailing_breaks '\n';
Input.consume_break t.input;
skip_to_content_indent ()
+
end else if !spaces_skipped < !content_indent then begin
+
(* Line starts with fewer spaces than content_indent - dedented *)
+
!spaces_skipped
end else if Input.next_is_blank t.input then begin
(* Line has spaces beyond content_indent - check if rest is only blanks *)
let idx = ref 0 in
···
skip_to_content_indent ()
| _ ->
(* Has content *)
+
!content_indent)
+
end else
+
!content_indent
end else begin
(* Implicit indent - skip empty lines without consuming spaces *)
if Input.next_is_break t.input then begin
···
Input.consume_break t.input;
skip_to_content_indent ()
| _ ->
+
(* Has content - don't consume anything, return 0 as we haven't skipped *)
+
0
+
end else
+
(* Not at break or blank - return 0 *)
+
0
end
in
(* Read content *)
let rec read_lines () =
+
let spaces_skipped = skip_to_content_indent () in
(* Check if we're at content *)
if Input.is_eof t.input then ()
else if Input.at_document_boundary t.input then ()
else begin
+
(* Count additional leading spaces beyond what was skipped *)
+
let extra_spaces = ref 0 in
while Input.next_is (( = ) ' ') t.input do
+
incr extra_spaces;
ignore (Input.next t.input)
done;
+
(* Calculate actual line indentation *)
+
let line_indent = spaces_skipped + !extra_spaces in
(* Determine content indent from first content line (implicit case) *)
if !content_indent = 0 then begin
+
if line_indent <= base_indent then begin
(* No content - restore position conceptually *)
()
end else
+
content_indent := line_indent
end;
+
if line_indent < !content_indent then begin
(* Dedented - done with content *)
()
end else begin
···
(* Add extra indentation for literal *)
if literal then begin
+
for _ = !content_indent + 1 to line_indent do
Buffer.add_char buf ' '
done
end;
+5
yaml/ocaml-yamle/tests/dune
···
(name debug_seq)
(modules debug_seq)
(libraries yamle))
···
(name debug_seq)
(modules debug_seq)
(libraries yamle))
+
+
(executable
+
(name debug_seq_events)
+
(modules debug_seq_events)
+
(libraries yamle))