@@ -111,6 +111,8 @@ package body LSP_Gen.Outputs is
111111 and then Tipe.Union.an_array.element.Value.Union.Kind = reference
112112 and then Model.Is_Enumeration
113113 (Tipe.Union.an_array.element.Value.Union.reference.name)
114+ and then not Model.Is_Custom_Enumeration
115+ (Tipe.Union.an_array.element.Value.Union.reference.name)
114116 and then not Tipe.Union.an_array.element.Value.Union.reference.name
115117 .Starts_With (" MarkupKind" ));
116118
@@ -158,12 +160,12 @@ package body LSP_Gen.Outputs is
158160 New_Line;
159161 Put_Line (" with Ada.Containers;" );
160162 Put_Line (" with Interfaces;" );
163+ Put_Line (" with VSS.Strings;" );
161164 Put_Line (" with LSP.Output_Tools;" );
162165 New_Line;
163166
164167 Put_Line (" package body LSP.Outputs is" ); New_Line;
165168 Put_Line (" pragma Warnings (Off, "" is not referenced"" );" );
166- Put_Line (" use type Interfaces.Integer_64;" ); New_Line;
167169 Put_Line (" use type Ada.Containers.Count_Type;" ); New_Line;
168170
169171 for Cursor in Done.Iterate loop
@@ -299,6 +301,23 @@ package body LSP_Gen.Outputs is
299301
300302 if Spec then
301303 Put_Line (" ;" );
304+
305+ elsif Info.supportsCustomValues then
306+ Put_Line (" is" );
307+ Put_Line (" begin" );
308+
309+ case Info.a_type.name is
310+ when LSP_Gen.Entities.Enum.string =>
311+ Put (" Handler.String_Value" );
312+ Put_Line (" (VSS.Strings.Virtual_String (Value));" );
313+
314+ when others =>
315+ Put (" Handler.Integer_Value (LSP.Enumerations." );
316+ Put_Id (Name);
317+ Put_Line (" 'Pos (Value));" );
318+ end case ;
319+
320+ Put_Line (" end;" );
302321 else
303322 Put_Line (" is" );
304323 Put_Line (" begin" );
@@ -609,7 +628,11 @@ package body LSP_Gen.Outputs is
609628 Done : LSP_Gen.Dependencies.Dependency_Map;
610629 Name : VSS.Strings.Virtual_String;
611630 Tipe : LSP_Gen.Entities.AType;
612- Spec : Boolean) is
631+ Spec : Boolean)
632+ is
633+ function Array_Element return LSP_Gen.Entities.AType is
634+ (Tipe.Union.an_array.element.Value);
635+
613636 begin
614637 if Name = " LSPArray" then
615638 return ; -- TBD
@@ -656,15 +679,24 @@ package body LSP_Gen.Outputs is
656679 when an_array =>
657680 Put_Line (" Handler.Start_Array;" );
658681
659- if Name.Ends_With (" _Set" ) then
682+ if Array_Element.Union.Kind = reference
683+ and then Model.Is_Custom_Enumeration
684+ (Array_Element.Union.reference.name)
685+ then
686+ Put_Line
687+ (" for J in Value.First_Index .. Value.Last_Index loop" );
688+ Write_Call (Done, Array_Element, " (J)" );
689+ Put_Line (" end loop;" );
690+
691+ elsif Name.Ends_With (" _Set" ) then
660692 Put_Line (" declare" );
661693 Put (" Set : LSP.Structures." );
662694 Put (Name);
663695 Put_Line (" renames Value;" );
664696 Put_Line (" begin" );
665697 Put_Line (" for Value in Set'Range loop" );
666698 Put_Line (" if Set (Value) then" );
667- Write_Call (Done, Tipe.Union.an_array.element.Value , " " );
699+ Write_Call (Done, Array_Element , " " );
668700 Put_Line (" end if;" );
669701 Put_Line (" end loop;" );
670702 Put_Line (" end;" );
@@ -678,8 +710,7 @@ package body LSP_Gen.Outputs is
678710 (" for J in Value.First_Index .. Value.Last_Index loop" );
679711 end if ;
680712
681- Write_Call
682- (Done, Tipe.Union.an_array.element.Value, " (J)" );
713+ Write_Call (Done, Array_Element, " (J)" );
683714 Put_Line (" end loop;" );
684715 end if ;
685716 Put_Line (" Handler.End_Array;" );
0 commit comments