brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 9612cc1 Raw
177 lines · plain
1 2// The fields below describe how the fields of `OptionDefinition` struct are3// initialized by different definitions in the Options.td and this file.4////////////////////////////////////////////////////////////////////////////////5// Field: usage_mask6// Default value: LLDB_OPT_SET_ALL (Option allowed in all groups)7// Set by:8//  - `Group`: Sets a single group to this option.9//             Example: def foo : Option<"foo", "f">, Group<1>;10//  - `Groups`: Sets a given list of group numbers.11//              Example: def foo : Option<"foo", "f">, Groups<[1,4,6]>;12//  - `GroupRange`: Sets an interval of groups. Start and end are inclusive.13//                  Example: def foo : Option<"foo", "f">, GroupRange<1, 4>;14//                           Sets group 1, 2, 3, 4 for the option.15////////////////////////////////////////////////////////////////////////////////16// Field: required17// Default value: false (Not required)18// Set by:19//   - `Required`: Marks the option as required.20//              Example: def foo : Option<"foo", "f">, Required;21////////////////////////////////////////////////////////////////////////////////22// Field: long_option23// Default value: not available (has to be defined in Option)24// Set by:25//   - `Option` constructor: Already set by constructor.26//                           Example: def foo : Option<"long-option", "l">27//                                                           ^28//                                                    long option value29////////////////////////////////////////////////////////////////////////////////30// Field: short_option31// Default value: not available (has to be defined in Option)32// Set by:33//   - `Option` constructor: Already set by constructor.34//                           Example: def foo : Option<"long-option", "l">35//                                                                     ^36//                                                                short option37////////////////////////////////////////////////////////////////////////////////38// Field: option_has_arg39// Default value: OptionParser::eNoArgument (No argument allowed)40// Set by:41//  - `OptionalArg`: Sets the argument type and marks it as optional.42//  - `Arg`: Sets the argument type and marks it as required.43//  - `EnumArg`: Sets the argument type to an enum and marks it as required.44//  - `OptionalEnumArg`: Same as EnumArg but marks it as optional.45// See argument_type field for more info.46////////////////////////////////////////////////////////////////////////////////47// Field: validator48// Default value: 0 (No validator for option)49// Set by:50//  - `Validator`: Sets the value to a given validator (which has to exist in51//                 the surrounding code.52////////////////////////////////////////////////////////////////////////////////53// Field: enum_values54// Default value: {} (No enum associated with this option)55// Set by:56//  - `OptionalEnumArg`:57//  - `EnumArg`: Sets the argument type and assigns it a enum holding the valid58//               values. The enum needs to be a variable in the including code.59//               Marks the option as required (see option_has_arg).60//               Example: def foo : Option<"foo", "f">,61//                          EnumArg<"SortOrder",62//                          "OptionEnumValues(g_sort_option_enumeration)">;63////////////////////////////////////////////////////////////////////////////////64// Field: completion_type65// Default value: CommandCompletions::eNoCompletion (no tab completion)66// Set by:67//  - `Completion`: Gives the option a single completion kind.68//                  Example: def foo : Option<"foo", "f">,69//                             Completion<"DiskFile">;70//                           Sets the completion to eDiskFileCompletion71//72//  - `Completions`: Sets a given kinds of completions.73//                   Example: def foo : Option<"foo", "f">,74//                              Completions<["DiskFile", "DiskDirectory"]>;75//                            Sets the completion to76//                            `eDiskFileCompletion | eDiskDirectoryCompletion`.77////////////////////////////////////////////////////////////////////////////////78// Field: argument_type79// Default value: eArgTypeNone80// Set by:81//  - `OptionalArg`: Sets the argument type and marks it as optional.82//                   Example: def foo : Option<"foo", "f">, OptionalArg<"Pid">;83//                   Sets the argument type to eArgTypePid and marks option as84//                   optional (see option_has_arg).85//  - `Arg`: Sets the argument type and marks it as required.86//           Example: def foo : Option<"foo", "f">, Arg<"Pid">;87//                    Sets the argument type to eArgTypePid and marks option as88//                    required (see option_has_arg).89//  - `OptionalEnumArg`:90//  - `EnumArg`: Sets the argument type and assigns it a enum holding the valid91//               values. The enum needs to be a variable in the including code.92//               Marks the option as required (see option_has_arg).93//               Example: def foo : Option<"foo", "f">,94//                          EnumArg<"SortOrder",95//                          "OptionEnumValues(g_sort_option_enumeration)">;96//               Use `OptionalEnumArg` for having an option enum argument.97////////////////////////////////////////////////////////////////////////////////98// Field: usage_text99// Default value: ""100// Set by:101//  - `Desc`: Sets the description for the given option.102//            Example: def foo : Option<"foo", "f">, Desc<"does nothing.">;103//                     Sets the description to "does nothing.".104 105// Base class for all options.106class Option<string fullname, string shortname> {107  string FullName = fullname;108  string ShortName = shortname;109  // The full associated command/subcommand such as "settings set".110  string Command;111}112 113// Moves the option into a list of option groups.114class Groups<list<int> groups> {115  list<int> Groups = groups;116}117 118// Moves the option in all option groups in a range.119// Start and end values are inclusive.120class GroupRange<int start, int end> {121  int GroupStart = start;122  int GroupEnd = end;123}124// Moves the option in a single option group.125class Group<int group> {126  int GroupStart = group;127  int GroupEnd = group;128}129 130// Sets the description for the option that should be131// displayed to the user.132class Desc<string description> {133  string Description = description;134}135 136// Marks the option as required when calling the137// associated command.138class Required {139  bit Required = 1;140}141 142// Gives the option an optional argument.143class OptionalArg<string type> {144  string ArgType = type;145  bit OptionalArg = 1;146}147 148// Gives the option an required argument.149class Arg<string type> {150  string ArgType = type;151}152 153// Gives the option an required argument.154class EnumArg<string type> {155  string ArgType = type;156}157 158// Gives the option an required argument.159class OptionalEnumArg<string type> {160  string ArgType = type;161  bit OptionalArg = 1;162}163 164// Sets the available completions for the given option.165class Completions<list<string> completions> {166  list<string> Completions = completions;167}168// Sets a single completion for the given option.169class Completion<string completion> {170  list<string> Completions = [completion];171}172 173// Sets the validator for a given option.174class Validator<string validator> {175  string Validator = validator;176}177