···
20
-
sequence : bool; (** true if this is a sequence indent *)
25
-
mutable tokens : Token.spanned Queue.t;
24
+
tokens : Token.spanned Queue.t;
mutable token_number : int;
mutable tokens_taken : int;
mutable stream_started : bool;
···
mutable leading_whitespace : bool; (** True when at start of line (only whitespace seen) *)
mutable document_has_content : bool; (** True if we've emitted content tokens in current document *)
mutable adjacent_value_allowed_at : Position.t option; (** Position where adjacent : is allowed *)
38
-
mutable pending_value : bool; (** True if we've emitted a KEY and are waiting for VALUE *)
mutable flow_mapping_stack : bool list; (** Stack of whether each flow level is a mapping *)
···
leading_whitespace = true; (* Start at beginning of stream *)
document_has_content = false;
adjacent_value_allowed_at = None;
58
-
pending_value = false;
···
(** Roll the indentation level *)
176
-
let roll_indent t col ~sequence =
173
+
let roll_indent t col =
if t.flow_level = 0 && col > current_indent t then begin
178
-
t.indent_stack <- { indent = col; needs_block_end = true; sequence } :: t.indent_stack;
175
+
t.indent_stack <- { indent = col; needs_block_end = true } :: t.indent_stack;
···
if not t.allow_simple_key then
Error.raise_at (Input.mark t.input) Block_sequence_disallowed;
1264
-
if roll_indent t col ~sequence:true then begin
1261
+
if roll_indent t col then begin
let span = Span.point (Input.mark t.input) in
emit t span Token.Block_sequence_start
···
if not t.allow_simple_key then
Error.raise_at (Input.mark t.input) Expected_key;
1305
-
if roll_indent t col ~sequence:false then begin
1302
+
if roll_indent t col then begin
let span = Span.point (Input.mark t.input) in
emit t span Token.Block_mapping_start
···
let span = Span.make ~start ~stop:(Input.mark t.input) in
1324
-
emit t span Token.Key;
1325
-
t.pending_value <- true (* We've emitted a KEY, now waiting for VALUE *)
1321
+
emit t span Token.Key
(* : followed by whitespace in block, or whitespace/flow indicator in flow, or adjacent value *)
···
if insert_pos >= Array.length tokens then
Queue.add key_token t.tokens;
t.token_number <- t.token_number + 1;
1369
-
t.pending_value <- true; (* We've inserted a KEY token, now waiting for VALUE *)
(* Roll indent for implicit block mapping *)
if t.flow_level = 0 then begin
let col = sk.sk_position.column in
1373
-
if roll_indent t col ~sequence:false then begin
1368
+
if roll_indent t col then begin
let span = Span.point sk.sk_position in
(* Insert block mapping start before key *)
let bm_token = { Token.token = Token.Block_mapping_start; span } in
···
if not t.allow_simple_key then
Error.raise_at (Input.mark t.input) Expected_key;
1396
-
if roll_indent t col ~sequence:false then begin
1391
+
if roll_indent t col then begin
let span = Span.point (Input.mark t.input) in
emit t span Token.Block_mapping_start
···
skip_whitespace_and_comment t;
let span = Span.make ~start ~stop:(Input.mark t.input) in
1431
-
emit t span Token.Value;
1432
-
t.pending_value <- false (* We've emitted a VALUE, no longer pending *)
1426
+
emit t span Token.Value
and fetch_anchor_or_alias t ~is_alias =