@@ -24,6 +24,8 @@ with Gnatcheck.Options; use Gnatcheck.Options;
2424with Gnatcheck.Output ; use Gnatcheck.Output;
2525with Gnatcheck.String_Utilities ; use Gnatcheck.String_Utilities;
2626
27+ with Langkit_Support.Text ; use Langkit_Support.Text;
28+
2729with Rule_Commands ; use Rule_Commands;
2830with Rules_Factory ; use Rules_Factory;
2931
@@ -1503,6 +1505,7 @@ package body Gnatcheck.Rules.Rule_Table is
15031505 Rule_Set : Rule_Sets.Set;
15041506 Previous : Rule_Info;
15051507 Has_Previous : Boolean := False;
1508+ Args : Rule_Argument_Vectors.Vector;
15061509 begin
15071510 Info (" <?xml version="" 1.0"" ?>" );
15081511 Info (" <gnatcheck>" );
@@ -1549,6 +1552,7 @@ package body Gnatcheck.Rules.Rule_Table is
15491552 for Rule of Rule_Set loop
15501553 Rule.XML_Rule_Help (Rule, Level + 1 );
15511554 end loop ;
1555+ Rule_Set.Clear;
15521556 end ;
15531557
15541558 Info (Level * Indent_String & " </category>" );
@@ -1563,6 +1567,47 @@ package body Gnatcheck.Rules.Rule_Table is
15631567 -- What about warnings and style checks???
15641568
15651569 Restrictions_Help (Level => 1 );
1570+
1571+ -- Display all rule instances
1572+ Info (Indent_String & " <instances>" );
1573+
1574+ -- Use the rule ordered set to sort the rules by their name
1575+ for Rule of All_Rules loop
1576+ Rule_Set.Include (Rule);
1577+ end loop ;
1578+
1579+ for Rule of Rule_Set loop
1580+ if not Rule.Instances.Is_Empty then
1581+ Info
1582+ (2 * Indent_String & " <rule name="" " & Rule_Name (Rule) & " "" >" );
1583+
1584+ for Instance of Rule.Instances loop
1585+ Instance.Map_Parameters (Args);
1586+ Info
1587+ (3 * Indent_String & " <instance name="" " &
1588+ Instance_Name (Instance.all ) & " "" " &
1589+ (if Args.Is_Empty then " />" else " >" ));
1590+
1591+ if not Args.Is_Empty then
1592+ for Arg of Args loop
1593+ Info
1594+ (4 * Indent_String & " <arg name="" " &
1595+ To_String (To_Text (Arg.Name)) & " "" value="" " &
1596+ Escape_Quotes (To_String (To_Text (Arg.Value))) &
1597+ " "" />" );
1598+ end loop ;
1599+ Info (3 * Indent_String & " </instance>" );
1600+ end if ;
1601+ Args.Clear;
1602+ end loop ;
1603+
1604+ Info (2 * Indent_String & " </rule>" );
1605+ end if ;
1606+ end loop ;
1607+
1608+ Info (Indent_String & " </instances>" );
1609+
1610+ -- Close the XML help
15661611 Info (" </gnatcheck>" );
15671612 end XML_Help ;
15681613
0 commit comments