From 469605e872aeca50c7556708de5d50d7e7935d83 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 24 Nov 2015 11:54:14 +0200 Subject: Implement support for documentation inside classes --- cli/header.cxx | 24 +++-- cli/html.cxx | 78 ++++++++------ cli/man.cxx | 36 +++---- cli/options.cxx | 13 ++- cli/options.hxx | 28 ++++- cli/options.ixx | 8 ++ cli/parser.cxx | 25 +++-- cli/runtime-header.cxx | 21 +++- cli/runtime-inline.cxx | 12 +++ cli/source.cxx | 283 +++++++++++++++++++++++++++---------------------- doc/cli.1 | 13 +-- doc/cli.xhtml | 19 ++-- doc/language.txt | 10 +- 13 files changed, 354 insertions(+), 216 deletions(-) diff --git a/cli/header.cxx b/cli/header.cxx index 35097af..d5ab674 100644 --- a/cli/header.cxx +++ b/cli/header.cxx @@ -189,16 +189,21 @@ namespace // if (usage != ut_none) { + string up (cli + "::usage_para"); + string const& ost (options.ostream_type ()); + os << "// Print usage information." << endl << "//" << endl; - os << "static void" << endl - << "print_usage (" << options.ostream_type () << "&);" + os << "static " << up << endl + << "print_usage (" << ost << "&," << endl + << up << " = " << up << "::none);" << endl; if (usage == ut_both) - os << "static void" << endl - << "print_long_usage (" << options.ostream_type () << "&);" + os << "static " << up << endl + << "print_long_usage (" << ost << "&," << endl + << up << " = " << up << "::none);" << endl; } @@ -336,15 +341,18 @@ generate_header (context& ctx) const string& qn (ctx.options.page_usage ()); string n (ctx.escape (ctx.substitute (ctx.ns_open (qn, false)))); + string up (ctx.cli + "::usage_para"); string const& ost (ctx.options.ostream_type ()); - os << "void" << endl - << n << "usage (" << ost << "&);" + os << up << endl + << n << "usage (" << ost << "&," << endl + << up << " = " << up << "::none);" << endl; if (ctx.usage == ut_both) - os << "void" << endl - << n << "long_usage (" << ost << "&);" + os << up << endl + << n << "long_usage (" << ost << "&," << endl + << up << " = " << up << "::none);" << endl; ctx.ns_close (qn, false); diff --git a/cli/html.cxx b/cli/html.cxx index 0394a3a..6659bf6 100644 --- a/cli/html.cxx +++ b/cli/html.cxx @@ -114,7 +114,7 @@ namespace struct doc: traversal::doc, context { - doc (context& c) : context (c) {} + doc (context& c, bool& l): context (c), list_ (l) {} virtual void traverse (type& ds) @@ -129,24 +129,34 @@ namespace size_t n (ds.size ()); const string& d (n == 1 ? ds[0] : n == 2 ? ds[1] : ds[2]); - if (d.empty ()) - return; - std::set arg_set; if (n > 1) translate_arg (ds[0], arg_set); string s (format (ot_html, escape_html (translate (d, arg_set)), true)); + if (s.empty ()) + return; + + if (list_) + { + os << " " << endl + << endl; + list_ = false; + } + wrap_lines (os, s, 2); os << endl << endl; } + + private: + bool& list_; // True if we are currently in
. }; struct option: traversal::option, context { - option (context& c) : context (c) {} + option (context& c, bool& l): context (c), list_ (l) {} virtual void traverse (type& o) @@ -158,6 +168,14 @@ namespace if (options.suppress_undocumented () && doc.empty ()) return; + if (!list_) + { + os << "
" << endl; + list_ = true; + } + else + os << endl; // Separate from the previous
. + names& n (o.named ()); os << "
"; @@ -212,69 +230,63 @@ namespace d = format (ot_html, escape_html (translate (d, arg_set)), false); wrap_lines (os, "
" + d + "
", 4); - os << endl - << endl; + os << endl; } + + private: + bool& list_; // True if we are currently in
. }; // // struct class_: traversal::class_, context { - class_ (context& c) - : context (c), option_ (c) - { - *this >> inherits_base_ >> *this; - names_option_ >> option_; - } + class_ (context& c): context (c) {} virtual void traverse (type& c) { if (!options.exclude_base () && !options.include_base_last ()) - inherits (c, inherits_base_); + inherits (c); - if (!c.names_empty ()) - { - os << "
" << endl; - names (c, names_option_); - os << "
" << endl - << endl; - } + names (c); if (!options.exclude_base () && options.include_base_last ()) - inherits (c, inherits_base_); + inherits (c); } - - private: - traversal::inherits inherits_base_; - - option option_; - traversal::names names_option_; }; } void generate_html (context& ctx) { + bool list (false); + traversal::cli_unit unit; traversal::names unit_names; traversal::namespace_ ns; - doc dc (ctx); + doc dc (ctx, list); class_ cl (ctx); - unit >> unit_names; unit_names >> dc; unit_names >> ns; unit_names >> cl; traversal::names ns_names; - ns >> ns_names; ns_names >> dc; ns_names >> ns; ns_names >> cl; + traversal::inherits cl_inherits; + cl >> cl_inherits >> cl; + + option op (ctx, list); + traversal::names cl_names; + cl >> cl_names; + cl_names >> dc; + cl_names >> op; + if (ctx.options.class_ ().empty ()) unit.dispatch (ctx.unit); else @@ -298,4 +310,8 @@ generate_html (context& ctx) } } } + + if (list) + ctx.os << "
" << endl + << endl; } diff --git a/cli/man.cxx b/cli/man.cxx index 2d5cce7..606fec6 100644 --- a/cli/man.cxx +++ b/cli/man.cxx @@ -85,15 +85,15 @@ namespace size_t n (ds.size ()); const string& d (n == 1 ? ds[0] : n == 2 ? ds[1] : ds[2]); - if (d.empty ()) - return; - std::set arg_set; if (n > 1) translate_arg (ds[0], arg_set); string s (format (ot_man, translate (d, arg_set), true)); + if (s.empty ()) + return; + wrap_lines (os, s); os << endl; } @@ -175,30 +175,19 @@ namespace // struct class_: traversal::class_, context { - class_ (context& c) - : context (c), option_ (c) - { - *this >> inherits_base_ >> *this; - names_option_ >> option_; - } + class_ (context& c): context (c) {} virtual void traverse (type& c) { if (!options.exclude_base () && !options.include_base_last ()) - inherits (c, inherits_base_); + inherits (c); - names (c, names_option_); + names (c); if (!options.exclude_base () && options.include_base_last ()) - inherits (c, inherits_base_); + inherits (c); } - - private: - traversal::inherits inherits_base_; - - option option_; - traversal::names names_option_; }; } @@ -210,19 +199,26 @@ generate_man (context& ctx) traversal::namespace_ ns; doc dc (ctx); class_ cl (ctx); - unit >> unit_names; unit_names >> ns; unit_names >> dc; unit_names >> cl; traversal::names ns_names; - ns >> ns_names; ns_names >> ns; ns_names >> dc; ns_names >> cl; + traversal::inherits cl_inherits; + cl >> cl_inherits >> cl; + + option op (ctx); + traversal::names cl_names; + cl >> cl_names; + cl_names >> dc; + cl_names >> op; + if (ctx.options.class_ ().empty ()) unit.dispatch (ctx.unit); else diff --git a/cli/options.cxx b/cli/options.cxx index 7d7f9cb..6869a60 100644 --- a/cli/options.cxx +++ b/cli/options.cxx @@ -1210,9 +1210,14 @@ options (::cli::scanner& s, _parse (s, opt, arg); } -void options:: -print_usage (::std::ostream& os) +::cli::usage_para options:: +print_usage (::std::ostream& os, ::cli::usage_para p) { + CLI_POTENTIALLY_UNUSED (os); + + if (p == ::cli::usage_para::text) + os << ::std::endl; + os << "--help Print usage information and exit." << ::std::endl; os << "--version Print version and exit." << ::std::endl; @@ -1384,6 +1389,10 @@ print_usage (::std::ostream& os) os << "--options-file Read additional options from with each" << ::std::endl << " option appearing on a separate line optionally" << ::std::endl << " followed by space and an option value." << ::std::endl; + + p = ::cli::usage_para::option; + + return p; } typedef diff --git a/cli/options.hxx b/cli/options.hxx index 65dae49..0612882 100644 --- a/cli/options.hxx +++ b/cli/options.hxx @@ -28,6 +28,27 @@ namespace cli { + class usage_para + { + public: + enum value + { + none, + text, + option + }; + + usage_para (value); + + operator value () const + { + return v_; + } + + private: + value v_; + }; + class unknown_mode { public: @@ -38,7 +59,7 @@ namespace cli fail }; - unknown_mode (value v); + unknown_mode (value); operator value () const { @@ -666,8 +687,9 @@ class options // Print usage information. // - static void - print_usage (::std::ostream&); + static ::cli::usage_para + print_usage (::std::ostream&, + ::cli::usage_para = ::cli::usage_para::none); // Implementation details. // diff --git a/cli/options.ixx b/cli/options.ixx index 9759dd2..24dc37b 100644 --- a/cli/options.ixx +++ b/cli/options.ixx @@ -11,6 +11,14 @@ namespace cli { + // usage_para + // + inline usage_para:: + usage_para (value v) + : v_ (v) + { + } + // unknown_mode // inline unknown_mode:: diff --git a/cli/parser.cxx b/cli/parser.cxx index 164a3c0..aee5c04 100644 --- a/cli/parser.cxx +++ b/cli/parser.cxx @@ -224,9 +224,8 @@ def_unit () } cerr << *path_ << ':' << t.line () << ':' << t.column () << ": error: " - << "expected namespace, class, or documentation declaration or " - << "instead of " << t - << endl; + << "expected namespace, class, or documentation instead of " + << t << endl; throw error (); } catch (error const&) @@ -588,8 +587,8 @@ namespace_def () if (t.punctuation () != token::p_rcbrace) { cerr << *path_ << ':' << t.line () << ':' << t.column () << ": error: " - << "expected namespace, class, or documentation declaration or '}' " - << "instead of " << t << endl; + << "expected namespace, class, documentation, or '}' instead of " + << t << endl; throw error (); } } @@ -684,7 +683,7 @@ class_def () auto_restore new_scope (scope_, n); - // decl-seq + // class-decl-seq // t = lexer_->next (); @@ -692,8 +691,16 @@ class_def () { try { - if (!option_def (t)) - break; + if (t.type () == token::t_string_lit || + t.punctuation () == token::p_lcbrace) + { + scope_doc (t); + } + else + { + if (!option_def (t)) + break; + } t = lexer_->next (); } @@ -707,7 +714,7 @@ class_def () if (t.punctuation () != token::p_rcbrace) { cerr << *path_ << ':' << t.line () << ':' << t.column () << ": error: " - << "expected option declaration or '}' instead of " << t << endl; + << "expected option, documentation, or '}' instead of " << t << endl; throw error (); } diff --git a/cli/runtime-header.cxx b/cli/runtime-header.cxx index 42f7063..98a2e5d 100644 --- a/cli/runtime-header.cxx +++ b/cli/runtime-header.cxx @@ -40,6 +40,25 @@ generate_runtime_header (context& ctx) ctx.ns_open (ctx.cli); + // usage_para + // + if (!ctx.options.suppress_usage ()) + os << "class usage_para" + << "{" + << "public:" << endl + << "enum value" + << "{" + << "none," << endl + << "text," << endl + << "option" << endl + << "};" + << "usage_para (value);" + << endl + << "operator value () const {return v_;}" // Can't generate outside. + << "private:" << endl + << "value v_;" + << "};"; + // unknown_mode // os << "class unknown_mode" @@ -51,7 +70,7 @@ generate_runtime_header (context& ctx) << "stop," << endl << "fail" << endl << "};" - << "unknown_mode (value v);" + << "unknown_mode (value);" << endl << "operator value () const {return v_;}" // Can't generate outside. << "private:" << endl diff --git a/cli/runtime-inline.cxx b/cli/runtime-inline.cxx index 15efa8d..ce53575 100644 --- a/cli/runtime-inline.cxx +++ b/cli/runtime-inline.cxx @@ -16,6 +16,18 @@ generate_runtime_inline (context& ctx) ctx.ns_open (ctx.cli); + // usage_para + // + if (!ctx.options.suppress_usage ()) + os << "// usage_para" << endl + << "//" << endl + + << inl << "usage_para::" << endl + << "usage_para (value v)" << endl + << ": v_ (v)" + << "{" + << "}"; + // unknown_mode // os << "// unknown_mode" << endl diff --git a/cli/source.cxx b/cli/source.cxx index 29f671e..2cb317d 100644 --- a/cli/source.cxx +++ b/cli/source.cxx @@ -11,8 +11,6 @@ using namespace std; namespace { - // - // struct option_init: traversal::option, context { option_init (context& c) : context (c), comma_ (false) {} @@ -292,6 +290,73 @@ namespace } } + enum paragraph {para_unknown, para_text, para_option}; + + struct doc: traversal::doc, context + { + doc (context& c, usage_type u, paragraph& p) + : context (c), usage_ (u), para_ (p) {} + + virtual void + traverse (type& ds) + { + if (ds.name ().compare (0, 3, "doc") != 0) // Ignore doc variables. + return; + + // Figure out which documentation string we should use. + // + // n = 1 - common doc string + // n = 2 - arg string, common doc string + // n > 2 - arg string, short string, long string + // + size_t n (ds.size ()); + string d; + + if (usage == ut_both && usage_ == ut_long) + { + d = n > 2 // Have both short and long? + ? ds[2] // Then use long. + : (n == 1 ? ds[0] : ds[1]); // Else, use common. + } + else // Short or long. + { + d = n > 2 // Have both short and long? + ? ds[1] // Then use short, + : (n == 1 ? ds[0] : ds[1]); // Else, use common (no first sentence). + } + + std::set arg_set; + if (n > 1 && options.ansi_color ()) + translate_arg (ds[0], arg_set); + + d = format (ot_plain, translate (d, arg_set), true); + + if (d.empty ()) + return; + + string up (cli + "::usage_para"); + + if (para_ == para_unknown) + os << "if (p != " << up << "::none)" << endl + << "os << ::std::endl;" + << endl + << "os << \""; + else + os << "os << std::endl" << endl + << " << \""; + + wrap_lines (os, d); + os << ";" + << endl; + + para_ = para_text; + } + + private: + usage_type usage_; + paragraph& para_; + }; + struct option_length: traversal::option, context { option_length (context& c, size_t& l) @@ -355,8 +420,8 @@ namespace // struct option_usage: traversal::option, context { - option_usage (context& c, size_t l, usage_type u) - : context (c), length_ (l), usage_ (u) {} + option_usage (context& c, size_t l, usage_type u, paragraph& p) + : context (c), length_ (l), usage_ (u), para_ (p) {} virtual void traverse (type& o) @@ -373,7 +438,18 @@ namespace size_t l (0); names& n (o.named ()); - os << "os << \""; + string up (cli + "::usage_para"); + + if (para_ == para_unknown) + os << "if (p == " << up << "::text)" << endl + << "os << ::std::endl;" + << endl + << "os << \""; + else if (para_ == para_text) + os << "os << std::endl" << endl + << " << \""; + else + os << "os << \""; for (names::name_iterator i (n.name_begin ()); i != n.name_end (); ++i) { @@ -452,6 +528,8 @@ namespace os << ";" << endl; + + para_ = para_option; } private: @@ -475,6 +553,7 @@ namespace private: size_t length_; usage_type usage_; + paragraph& para_; }; // @@ -521,7 +600,7 @@ namespace os << "// " << escape (c.name ()) << " base" << endl << "//" << endl - << fq_name (c) << "::print_" << t << "usage (os);" + << "p = " << fq_name (c) << "::print_" << t << "usage (os, p);" << endl; } @@ -745,39 +824,53 @@ namespace } } - // If len is 0 then it means we have no options to print. - // - os << "void " << name << "::" << endl - << "print_usage (" << - options.ostream_type () << "&" << (len != 0 || b ? " os)" : ")") - << "{"; + string up (cli + "::usage_para"); + string const& ost (options.ostream_type ()); + + os << up << " " << name << "::" << endl + << "print_usage (" << ost << "& os, " << up << " p)" + << "{" + << "CLI_POTENTIALLY_UNUSED (os);" + << endl; { - base_usage bu (*this, usage == ut_both ? ut_short : usage); + usage_type u (usage == ut_both ? ut_short : usage); + + base_usage bu (*this, u); traversal::inherits i (bu); if (b && !options.include_base_last ()) inherits (c, i); - // Print option usage. - // - option_usage ou (*this, len, usage == ut_both ? ut_short : usage); - traversal::names n (ou); + paragraph p (para_unknown); + + doc dc (*this, u, p); + option_usage ou (*this, len, u, p); + traversal::names n; + n >> dc; + n >> ou; + names (c, n); + if (p != para_unknown) + os << "p = " << up << (p == para_text ? "::text;" : "::option;") + << endl; + if (b && options.include_base_last ()) inherits (c, i); } - os << "}"; + os << "return p;" + << "}"; // Long version. // if (usage == ut_both) { - os << "void " << name << "::" << endl - << "print_long_usage (" << - options.ostream_type () << "&" << (len != 0 || b ? " os)" : ")") - << "{"; + os << up << " " << name << "::" << endl + << "print_long_usage (" << ost << "& os, " << up << " p)" + << "{" + << "CLI_POTENTIALLY_UNUSED (os);" + << endl; base_usage bu (*this, ut_long); traversal::inherits i (bu); @@ -785,14 +878,25 @@ namespace if (b && !options.include_base_last ()) inherits (c, i); - option_usage ou (*this, len, ut_long); - traversal::names n (ou); + paragraph p (para_unknown); + + doc dc (*this, ut_long, p); + option_usage ou (*this, len, ut_long, p); + traversal::names n; + n >> dc; + n >> ou; + names (c, n); + if (p != para_unknown) + os << "p = " << up << (p == para_text ? "::text;" : "::option;") + << endl; + if (b && options.include_base_last ()) inherits (c, i); - os << "}"; + os << "return p;" + << "}"; } } @@ -986,68 +1090,6 @@ namespace // Page usage. // - enum paragraph {para_none, para_text, para_option}; - - struct doc: traversal::doc, context - { - doc (context& c, usage_type u, paragraph& p) - : context (c), usage_ (u), para_ (p) {} - - virtual void - traverse (type& ds) - { - if (ds.name ().compare (0, 3, "doc") != 0) // Ignore doc variables. - return; - - // Figure out which documentation string we should use. - // - // n = 1 - common doc string - // n = 2 - arg string, common doc string - // n > 2 - arg string, short string, long string - // - size_t n (ds.size ()); - string d; - - if (usage == ut_both && usage_ == ut_long) - { - d = n > 2 // Have both short and long? - ? ds[2] // Then use long. - : (n == 1 ? ds[0] : ds[1]); // Else, use common. - } - else // Short or long. - { - d = n > 2 // Have both short and long? - ? ds[1] // Then use short, - : (n == 1 ? ds[0] : ds[1]); // Else, use common (no first sentence). - } - - std::set arg_set; - if (n > 1 && options.ansi_color ()) - translate_arg (ds[0], arg_set); - - d = format (ot_plain, translate (d, arg_set), true); - - if (d.empty ()) - return; - - if (para_ == para_none) // First. - os << "os << \""; - else - os << "os << ::std::endl" << endl - << " << \""; - - wrap_lines (os, d); - os << ";" - << endl; - - para_ = para_text; - } - - private: - usage_type usage_; - paragraph& para_; - }; - struct class_usage: traversal::class_, context { class_usage (context& c, usage_type u, paragraph& p) @@ -1056,35 +1098,17 @@ namespace virtual void traverse (type& c) { - // Figure out if this class has any documentation by calculating - // the option length. If it is 0, then we don't have any. - // - size_t len (0); - { - option_length olt (*this, len); - traversal::class_ ct; - traversal::inherits i; - traversal::names n; - - if (!options.exclude_base ()) // Go into bases unless --exclude-base. - ct >> i >> ct; - - ct >> n >> olt; - ct.traverse (c); - } - - if (len == 0) - return; - - if (para_ == para_text) - os << "os << ::std::endl;"; + string p ( + para_ == para_unknown + ? "p" + : cli + "::usage_para::" + (para_ == para_text ? "text" : "option")); const char* t (usage != ut_both || usage_ == ut_short ? "" : "long_"); - - os << fq_name (c) << "::print_" << t << "usage (os);" + os << "p = " << fq_name (c) << "::print_" << t << "usage (os, " << + p << ");" << endl; - para_ = para_option; + para_ = para_unknown; } private: @@ -1125,22 +1149,23 @@ generate_source (context& ctx) string n (ctx.escape (ctx.substitute (ctx.ns_open (qn, false)))); usage u (ctx.usage); + string up (ctx.cli + "::usage_para"); string const& ost (ctx.options.ostream_type ()); { - os << "void" << endl - << n << "usage (" << ost << "& os)" + os << up << endl + << n << "usage (" << ost << "& os, " << up << " p)" << "{" << "CLI_POTENTIALLY_UNUSED (os);" << endl; - paragraph para (para_none); + paragraph p (para_unknown); traversal::cli_unit unit; traversal::names unit_names; traversal::namespace_ ns; - doc dc (ctx, u == ut_both ? ut_short : u, para); - class_usage cl (ctx, u == ut_both ? ut_short : u, para); + doc dc (ctx, u == ut_both ? ut_short : u, p); + class_usage cl (ctx, u == ut_both ? ut_short : u, p); unit >> unit_names; unit_names >> dc; @@ -1156,26 +1181,31 @@ generate_source (context& ctx) unit.dispatch (ctx.unit); - os << "}"; + if (p != para_unknown) + os << "p = " << up << (p == para_text ? "::text;" : "::option;") + << endl; + + os << "return p;" + << "}"; } // Long version. // if (u == ut_both) { - os << "void" << endl - << n << "long_usage (" << ost << "& os)" + os << up << endl + << n << "long_usage (" << ost << "& os, " << up << " p)" << "{" << "CLI_POTENTIALLY_UNUSED (os);" << endl; - paragraph para (para_none); + paragraph p (para_unknown); traversal::cli_unit unit; traversal::names unit_names; traversal::namespace_ ns; - doc dc (ctx, ut_long, para); - class_usage cl (ctx, ut_long, para); + doc dc (ctx, ut_long, p); + class_usage cl (ctx, ut_long, p); unit >> unit_names; unit_names >> dc; @@ -1191,7 +1221,12 @@ generate_source (context& ctx) unit.dispatch (ctx.unit); - os << "}"; + if (p != para_unknown) + os << "p = " << up << (p == para_text ? "::text;" : "::option;") + << endl; + + os << "return p;" + << "}"; } ctx.ns_close (qn, false); diff --git a/doc/cli.1 b/doc/cli.1 index a50a1bc..1a89aed 100644 --- a/doc/cli.1 +++ b/doc/cli.1 @@ -112,10 +112,9 @@ documentation string in usage\. By default, in this situation only the first sentence from the long string is used\. .IP "\fB--short-usage\fR" If specified together with \fB--long-usage\fR, generate both short and long -usage versions\. In this mode, the usage printing functions are called -\fBprint_short_usage()\fR and \fBprint_long_usage()\fR and for the long usage -the long documentation string is always used, even if the short version is -provided\. +usage versions\. In this mode, the long usage printing function is called +\fBprint_long_usage()\fR and in its implementation the long documentation +string is always used, even if the short version is provided\. .IP "\fB--page-usage\fR \fIname\fR" Generate the combined usage printing code for the entire page\. Specifically, this will include all the namespace-level documentation as well as usage for @@ -134,8 +133,7 @@ documentation variable expansion, for example: .fi If both \fB--long-usage\fR and \fB--short-usage\fR options are specified, then -two functions are generated with the \fB*short_usage()\fR and -\fB*long_usage()\fR suffixes\. +the long usage function has the \fB*long_usage()\fR suffix\. .IP "\fB--option-length\fR \fIlen\fR" Indent option descriptions \fIlen\fR characters when printing usage\. This is useful when you have multiple options classes, potentially in separate files, @@ -148,6 +146,9 @@ However, if you pipe such output through \fBless\fR(1)\fR, it will display them correctly\. .IP "\fB--exclude-base\fR" Exclude base class information from usage and documentation\. +.IP "\fB--include-base-last\fR" +Include base class information after derived for usage and documentation\. By +default, base classes are included first\. .IP "\fB--class\fR \fIfq-name\fR" Generate the man page or HTML documentation only for the \fIfq-name\fR options class\. The \fIfq-name\fR name should be a fully-qualified options class name, diff --git a/doc/cli.xhtml b/doc/cli.xhtml index 92f237b..4d80b83 100644 --- a/doc/cli.xhtml +++ b/doc/cli.xhtml @@ -153,11 +153,10 @@
--short-usage
If specified together with --long-usage, generate - both short and long usage versions. In this mode, the usage printing - functions are called print_short_usage() and - print_long_usage() and for the long usage the long - documentation string is always used, even if the short version is - provided.
+ both short and long usage versions. In this mode, the long usage printing + function is called print_long_usage() and in its + implementation the long documentation string is always used, even if the + short version is provided.
--page-usage name
Generate the combined usage printing code for the entire page. @@ -175,9 +174,8 @@ --page-usage print_$name$_ # print_foo_usage() if name is foo

If both --long-usage and - --short-usage options are specified, then two - functions are generated with the *short_usage() and - *long_usage() suffixes.

+ --short-usage options are specified, then the long + usage function has the *long_usage() suffix.

--option-length len
Indent option descriptions len characters when printing usage. @@ -195,6 +193,10 @@
--exclude-base
Exclude base class information from usage and documentation.
+
--include-base-last
+
Include base class information after derived for usage and + documentation. By default, base classes are included first.
+
--class fq-name
Generate the man page or HTML documentation only for the fq-name options class. The fq-name name should be a @@ -356,7 +358,6 @@ where the --options-file option is specified except that the shell escaping and quoting is not required. Repeat this option to specify more than one options file.

-

DIAGNOSTICS

diff --git a/doc/language.txt b/doc/language.txt index 16eaa0d..cef7da8 100644 --- a/doc/language.txt +++ b/doc/language.txt @@ -47,7 +47,7 @@ namespace-body: decl-seq(opt) class-def: - "class" identifier inheritance-spec(opt) abstract-spec(opt) "{" option-def-seq(opt) "};" + "class" identifier inheritance-spec(opt) abstract-spec(opt) "{" class-decl-seq(opt) "};" inheritance-spec: ":" base-seq @@ -59,9 +59,13 @@ base-seq: abstract-spec: "=" "0" -option-def-seq: +class-decl-seq: + class-decl + class-decl-seq class-decl + +class-decl + scope-doc option-def - option-def-seq option-def option-def: type-spec option-name-seq initializer(opt) option-doc(opt) ";" -- cgit v1.1