@@ -339,11 +339,11 @@ let parse_external_attributes
339
339
| "bs.new" | "new" -> {st with new_name = name_from_payload_or_prim ~loc payload}
340
340
| "bs.set_index" | "set_index" ->
341
341
if String. length prim_name_check <> 0 then
342
- Location. raise_errorf ~loc " @set_index this particular external's name needs to be a placeholder empty string" ;
342
+ Location. raise_errorf ~loc " % @set_index this particular external's name needs to be a placeholder empty string" ;
343
343
{st with set_index = true }
344
344
| "bs.get_index" | "get_index" ->
345
345
if String. length prim_name_check <> 0 then
346
- Location. raise_errorf ~loc " @get_index this particular external's name needs to be a placeholder empty string" ;
346
+ Location. raise_errorf ~loc " % @get_index this particular external's name needs to be a placeholder empty string" ;
347
347
{st with get_index = true }
348
348
| "bs.obj" | "obj" -> {st with mk_obj = true }
349
349
| "bs.return" | "return" ->
@@ -428,7 +428,7 @@ let process_obj
428
428
TODO: better error message *)
429
429
} ->
430
430
if String. length prim_name <> 0 then
431
- Location. raise_errorf ~loc " @ @obj expect external names to be empty string" ;
431
+ Location. raise_errorf ~loc " % @obj expect external names to be empty string" ;
432
432
let arg_kinds, new_arg_types_ty, (result_types : Parsetree.object_field list ) =
433
433
Ext_list. fold_right arg_types_ty ( [] , [] , [] )
434
434
(fun param_type ( arg_labels , (arg_types : Ast_compatible.param_type list ), result_types ) ->
@@ -474,15 +474,15 @@ let process_obj
474
474
(Otag ({Asttypes. txt = name; loc}, [] , Ast_literal. type_string ~loc () ) :: result_types)
475
475
| Fn_uncurry_arity _ ->
476
476
Location. raise_errorf ~loc
477
- " The combination of @@ obj, @ @uncurry is not supported yet"
477
+ " The combination of %@ obj, % @uncurry is not supported yet"
478
478
| Extern_unit -> assert false
479
479
| Poly_var _
480
480
->
481
481
Location. raise_errorf ~loc
482
- " @ @obj label %s does not support such arg type" name
482
+ " % @obj label %s does not support such arg type" name
483
483
| Unwrap ->
484
484
Location. raise_errorf ~loc
485
- " @@ obj label %s does not support @unwrap arguments" name
485
+ " %@ obj label %s does not support % @unwrap arguments" name
486
486
end
487
487
| Optional name ->
488
488
let obj_arg_type = get_opt_arg_type ~nolabel: false ty in
@@ -507,18 +507,18 @@ let process_obj
507
507
(Otag ({Asttypes. txt = name; loc}, [] , Ast_comb. to_undefined_type loc @@ Ast_literal. type_string ~loc () ) :: result_types)
508
508
| Arg_cst _
509
509
->
510
- Location. raise_errorf ~loc " @ @as is not supported with optional yet"
510
+ Location. raise_errorf ~loc " % @as is not supported with optional yet"
511
511
| Fn_uncurry_arity _ ->
512
512
Location. raise_errorf ~loc
513
- " The combination of @@ obj, @ @uncurry is not supported yet"
513
+ " The combination of %@ obj, % @uncurry is not supported yet"
514
514
| Extern_unit -> assert false
515
515
| Poly_var _
516
516
->
517
517
Location. raise_errorf ~loc
518
- " @ @obj label %s does not support such arg type" name
518
+ " % @obj label %s does not support such arg type" name
519
519
| Unwrap ->
520
520
Location. raise_errorf ~loc
521
- " @@ obj label %s does not support @unwrap arguments" name
521
+ " %@ obj label %s does not support % @unwrap arguments" name
522
522
end
523
523
in
524
524
new_arg_label::arg_labels,
@@ -535,7 +535,7 @@ let process_obj
535
535
in
536
536
Ast_compatible. mk_fn_type new_arg_types_ty result,
537
537
External_ffi_types. ffi_obj_create arg_kinds
538
- | _ -> Location. raise_errorf ~loc " Attribute found that conflicts with @ @obj"
538
+ | _ -> Location. raise_errorf ~loc " Attribute found that conflicts with % @obj"
539
539
540
540
541
541
let external_desc_of_non_obj
@@ -568,9 +568,9 @@ let external_desc_of_non_obj
568
568
if arg_type_specs_length = 3 then
569
569
Js_set_index {js_set_index_scopes = scopes}
570
570
else
571
- Location. raise_errorf ~loc " Ill defined attribute @set_index (arity of 3)"
571
+ Location. raise_errorf ~loc " Ill defined attribute % @set_index (arity of 3)"
572
572
| {set_index = true ; _} ->
573
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @set_index" )
573
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @set_index" )
574
574
| {get_index = true ;
575
575
val_name = `Nm_na ;
576
576
external_module_name = None ;
@@ -591,10 +591,10 @@ let external_desc_of_non_obj
591
591
if arg_type_specs_length = 2 then
592
592
Js_get_index {js_get_index_scopes = scopes}
593
593
else Location. raise_errorf ~loc
594
- " Ill defined attribute @get_index (arity expected 2 : while %d)" arg_type_specs_length
594
+ " Ill defined attribute % @get_index (arity expected 2 : while %d)" arg_type_specs_length
595
595
596
596
| {get_index = true ; _} ->
597
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @get_index" )
597
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @get_index" )
598
598
| {module_as_val = Some external_module_name ;
599
599
600
600
get_index = false ;
@@ -617,17 +617,17 @@ let external_desc_of_non_obj
617
617
| [] , `Nm_na , _ -> Js_module_as_var external_module_name
618
618
| _ , `Nm_na , _ -> Js_module_as_fn {splice; external_module_name }
619
619
| _ , #bundle_source , #bundle_source ->
620
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @ @module." )
620
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @module." )
621
621
622
622
| _, (`Nm_val _ | `Nm_external _) , `Nm_na
623
623
-> Js_module_as_class external_module_name
624
624
| _, `Nm_payload _ , `Nm_na
625
625
->
626
626
Location. raise_errorf ~loc
627
- " Incorrect FFI attribute found: (@new should not carry a payload here)"
627
+ " Incorrect FFI attribute found: (% @new should not carry a payload here)"
628
628
end
629
629
| {module_as_val = Some _ ; _} ->
630
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @ @module." )
630
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @module." )
631
631
| {call_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name) ;
632
632
splice;
633
633
scopes ;
@@ -649,7 +649,7 @@ let external_desc_of_non_obj
649
649
Js_call {splice; name; external_module_name; scopes }
650
650
| {call_name = #bundle_source ; _ }
651
651
->
652
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @val" )
652
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @val" )
653
653
| {val_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
654
654
external_module_name;
655
655
@@ -676,7 +676,7 @@ let external_desc_of_non_obj
676
676
Js_var { name; external_module_name; scopes}
677
677
| {val_name = #bundle_source ; _ }
678
678
->
679
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @val" )
679
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with % @val" )
680
680
681
681
| {splice ;
682
682
scopes ;
@@ -726,16 +726,16 @@ let external_desc_of_non_obj
726
726
begin match arg_type_specs with
727
727
| [] ->
728
728
Location. raise_errorf
729
- ~loc " Ill defined attribute @send(the external needs to be a regular function call with at least one argument)"
729
+ ~loc " Ill defined attribute % @send(the external needs to be a regular function call with at least one argument)"
730
730
| {arg_type = Arg_cst _ ; arg_label = _} :: _
731
731
->
732
732
Location. raise_errorf
733
- ~loc " Ill defined attribute @send(first argument can't be const)"
733
+ ~loc " Ill defined attribute % @send(first argument can't be const)"
734
734
| _ :: _ ->
735
735
Js_send {splice ; name; js_send_scopes = scopes ; pipe = false }
736
736
end
737
737
| {val_send = #bundle_source ; _ }
738
- -> Location. raise_errorf ~loc " You used a FFI attribute that can't be used with @send"
738
+ -> Location. raise_errorf ~loc " You used a FFI attribute that can't be used with % @send"
739
739
| {val_send_pipe = Some _;
740
740
(* splice = (false as splice); *)
741
741
val_send = `Nm_na ;
@@ -760,7 +760,7 @@ let external_desc_of_non_obj
760
760
pipe = true }
761
761
762
762
| {val_send_pipe = Some _ ; _}
763
- -> Location. raise_errorf ~loc " conflict attributes found with [@ @bs.send.pipe]"
763
+ -> Location. raise_errorf ~loc " conflict attributes found with [%@% @bs.send.pipe]"
764
764
765
765
| {new_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
766
766
external_module_name;
@@ -781,7 +781,7 @@ let external_desc_of_non_obj
781
781
}
782
782
-> Js_new {name; external_module_name; scopes}
783
783
| {new_name = #bundle_source ; _ } ->
784
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with [@@ new] " )
784
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with %@ new" )
785
785
| {set_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
786
786
val_name = `Nm_na ;
787
787
call_name = `Nm_na ;
@@ -801,9 +801,9 @@ let external_desc_of_non_obj
801
801
->
802
802
if arg_type_specs_length = 2 then
803
803
Js_set { js_set_scopes = scopes ; js_set_name = name}
804
- else Location. raise_errorf ~loc " Ill defined attribute [@@ set] (two args required)"
804
+ else Location. raise_errorf ~loc " Ill defined attribute %@ set (two args required)"
805
805
| {set_name = #bundle_source ; _}
806
- -> Location. raise_errorf ~loc " conflict attributes found with [@@ set] "
806
+ -> Location. raise_errorf ~loc " conflict attributes found with %@ set"
807
807
| {get_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
808
808
809
809
val_name = `Nm_na ;
@@ -825,9 +825,9 @@ let external_desc_of_non_obj
825
825
if arg_type_specs_length = 1 then
826
826
Js_get { js_get_name = name; js_get_scopes = scopes }
827
827
else
828
- Location. raise_errorf ~loc " Ill defined attribute [@@ bs.get] (only one argument)"
828
+ Location. raise_errorf ~loc " Ill defined attribute %@ bs.get (only one argument)"
829
829
| {get_name = #bundle_source ; _}
830
- -> Location. raise_errorf ~loc " Attribute found that conflicts with [@@ bs.get] "
830
+ -> Location. raise_errorf ~loc " Attribute found that conflicts with %@ bs.get"
831
831
832
832
| {get_name = `Nm_na ;
833
833
val_name = `Nm_na ;
@@ -863,7 +863,7 @@ let handle_attributes
863
863
*)
864
864
if has_bs_uncurry type_annotation.ptyp_attributes then
865
865
Location. raise_errorf
866
- ~loc " @uncurry can not be applied to the whole definition" ;
866
+ ~loc " % @uncurry can not be applied to the whole definition" ;
867
867
let prim_name_or_pval_name =
868
868
if String. length prim_name = 0 then
869
869
`Nm_val (lazy (Location. prerr_warning loc (Bs_fragile_external pval_name); pval_name))
@@ -874,7 +874,7 @@ let handle_attributes
874
874
if has_bs_uncurry result_type.ptyp_attributes then
875
875
Location. raise_errorf
876
876
~loc: result_type.ptyp_loc
877
- " @uncurry can not be applied to tailed position" ;
877
+ " % @uncurry can not be applied to tailed position" ;
878
878
let no_arguments = arg_types_ty = [] in
879
879
let unused_attrs, external_desc =
880
880
parse_external_attributes no_arguments
@@ -892,7 +892,7 @@ let handle_attributes
892
892
let arg_type = refine_arg_type ~nolabel: true obj in
893
893
begin match arg_type with
894
894
| Arg_cst _ ->
895
- Location. raise_errorf ~loc: obj.ptyp_loc " [ @as] is not supported in @send type "
895
+ Location. raise_errorf ~loc: obj.ptyp_loc " % @as is not supported in % @send type "
896
896
| _ ->
897
897
(* more error checking *)
898
898
[{arg_label = Arg_empty ; arg_type}],
@@ -910,17 +910,17 @@ let handle_attributes
910
910
if i = 0 && splice then
911
911
begin match arg_label with
912
912
| Optional _ ->
913
- Location. raise_errorf ~loc " @ @variadic expect the last type to be a non optional"
913
+ Location. raise_errorf ~loc " % @variadic expect the last type to be a non optional"
914
914
| Labelled _ | Nolabel
915
915
->
916
916
if ty.ptyp_desc = Ptyp_any then
917
- Location. raise_errorf ~loc " @ @variadic expect the last type to be an array" ;
917
+ Location. raise_errorf ~loc " % @variadic expect the last type to be an array" ;
918
918
if spec_of_ptyp true ty <> Nothing then
919
- Location. raise_errorf ~loc " @ @variadic expect the last type to be an array" ;
919
+ Location. raise_errorf ~loc " % @variadic expect the last type to be an array" ;
920
920
match ty.ptyp_desc with
921
921
| Ptyp_constr ({txt = Lident " array" ; _}, [_])
922
922
-> ()
923
- | _ -> Location. raise_errorf ~loc " @ @variadic expect the last type to be an array" ;
923
+ | _ -> Location. raise_errorf ~loc " % @variadic expect the last type to be an array" ;
924
924
end ;
925
925
let (arg_label : External_arg_spec.label_noname ), arg_type, new_arg_types =
926
926
match arg_label with
@@ -931,7 +931,7 @@ let handle_attributes
931
931
(* ?x:([`x of int ] [@string]) does not make sense *)
932
932
Location. raise_errorf
933
933
~loc
934
- " @string does not work with optional when it has arities in label %s" s
934
+ " % @string does not work with optional when it has arities in label %s" s
935
935
| _ ->
936
936
Arg_optional , arg_type,
937
937
param_type :: arg_types end
0 commit comments