this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

more

+29 -14
+2
yaml/ocaml-yamle/lib/error.ml
··· 25 25 | Invalid_tag_directive of string 26 26 | Reserved_directive of string 27 27 | Illegal_flow_key_line (** Key and : must be on same line in flow context *) 28 + | Block_sequence_disallowed (** Block sequence entries not allowed in this context *) 28 29 29 30 (* Parser errors *) 30 31 | Unexpected_token of string ··· 125 126 | Invalid_tag_directive s -> Printf.sprintf "invalid TAG directive: %s" s 126 127 | Reserved_directive s -> Printf.sprintf "reserved directive: %s" s 127 128 | Illegal_flow_key_line -> "key and ':' must be on the same line in flow context" 129 + | Block_sequence_disallowed -> "block sequence entries are not allowed in this context" 128 130 | Unexpected_token s -> Printf.sprintf "unexpected token: %s" s 129 131 | Expected_document_start -> "expected document start '---'" 130 132 | Expected_document_end -> "expected document end '...'"
-2
yaml/ocaml-yamle/lib/parser.ml
··· 404 404 t.state <- pop_state t; 405 405 Event.Mapping_end, tok.span 406 406 | _ -> 407 - Printf.eprintf "DEBUG parser parse_block_mapping_key: unexpected token at %d:%d\n%!" 408 - tok.span.start.line tok.span.start.column; 409 407 Error.raise_span tok.span Expected_key 410 408 411 409 (** Parse block mapping value *)
+17 -12
yaml/ocaml-yamle/lib/scanner.ml
··· 680 680 leading_blanks := true 681 681 end; 682 682 Input.consume_break t.input; 683 - (* Line break allows simple key in both block and flow contexts *) 684 - if in_flow then 685 - t.allow_simple_key <- true; 686 - if not in_flow then 687 - t.allow_simple_key <- true; 683 + (* Note: We do NOT set allow_simple_key here during plain scalar scanning. 684 + Setting it here would incorrectly allow ':' that appears on a continuation 685 + line to become a mapping indicator. The flag will be set properly after 686 + the scalar ends and skip_to_next_token processes line breaks. *) 688 687 (* Skip leading blanks on the next line *) 689 688 while Input.next_is_blank t.input do 690 689 ignore (Input.next t.input) ··· 718 717 String.sub value 0 end_pos 719 718 in 720 719 let span = Span.make ~start ~stop:(Input.mark t.input) in 721 - (value, span) 720 + (* Return value, span, and whether we ended with leading blanks (crossed a line break) *) 721 + (value, span, !leading_blanks) 722 722 723 723 (** Scan block scalar (literal | or folded >) *) 724 724 let scan_block_scalar t literal = ··· 1189 1189 1190 1190 and fetch_block_entry t = 1191 1191 if t.flow_level = 0 then begin 1192 - (* Block entries don't require allow_simple_key to be true, because: 1193 - 1. They're not simple keys themselves 1194 - 2. They can appear after : on the same line (e.g., ": - a") 1195 - So we only check allow_simple_key in contexts where it's truly required. 1196 - For now, we allow block entries in block context. *) 1192 + (* Block entries require allow_simple_key to be true. 1193 + This prevents block sequences on the same line as a mapping value, 1194 + e.g., "key: - a" is invalid. *) 1195 + if not t.allow_simple_key then 1196 + Error.raise_at (Input.mark t.input) Block_sequence_disallowed; 1197 1197 let col = column t in 1198 1198 if roll_indent t col ~sequence:true then begin 1199 1199 let span = Span.point (Input.mark t.input) in ··· 1435 1435 save_simple_key t; 1436 1436 t.allow_simple_key <- false; 1437 1437 t.document_has_content <- true; 1438 - let value, span = scan_plain_scalar t in 1438 + let value, span, ended_with_linebreak = scan_plain_scalar t in 1439 + (* If the plain scalar ended after crossing a line break (leading_blanks = true), 1440 + allow simple keys. This is important because the scanner already consumed the 1441 + line break and leading whitespace when checking for continuation. *) 1442 + if ended_with_linebreak then 1443 + t.allow_simple_key <- true; 1439 1444 emit t span (Token.Scalar { style = Scalar_style.Plain; value }) 1440 1445 1441 1446 (** Check if we need more tokens to resolve simple keys *)
+10
yaml/ocaml-yamle/tests/dune
··· 175 175 (executable (name test_dk4h) (modules test_dk4h) (libraries yamle)) 176 176 (executable (name test_sy6v) (modules test_sy6v) (libraries yamle)) 177 177 (executable (name test_3hfz) (modules test_3hfz) (libraries yamle)) 178 + (executable (name test_5u3a) (modules test_5u3a) (libraries yamle)) 179 + (executable (name test_2cms) (modules test_2cms) (libraries yamle)) 180 + (executable (name test_basic_yaml) (modules test_basic_yaml) (libraries yamle)) 181 + (executable (name test_loader_debug) (modules test_loader_debug) (libraries yamle test_suite_lib)) 182 + (executable (name test_229q_direct) (modules test_229q_direct) (libraries yamle)) 183 + (executable (name debug_from) (modules debug_from) (libraries yamle)) 184 + (executable (name test_2cms_quick) (modules test_2cms_quick) (libraries yamle)) 185 + (executable (name count_tests) (modules count_tests) (libraries test_suite_lib)) 186 + (executable (name test_bs4k) (modules test_bs4k) (libraries yamle)) 187 + (executable (name test_ks4u) (modules test_ks4u) (libraries yamle))