usage.cc 6.28 KB
Newer Older
1
#include "main.ih"
2

3 4 5 6 7 8 9 10 11 12 13 14 15 16
namespace {

char const *a_optionsDescription = R"( [OPTIONS] file
Where:
  [OPTIONS] - zero or more optional arguments (int options between
              parentheses. Short options require arguments if their long
              option variants do too).

   --analyze-only (-A): 
           only analyze the grammar; except for possibly the verbose grammar
           description file no files are written.

   --baseclass-header=<header> (-b):
           filename holding the base class definition.
17

18 19 20
   --baseclass-preinclude=<header> (-H):
           preinclude header in the base-class header file.  Use [header] to
           include <header>, otherwise \"header\" will be included.
21

22 23
   --baseclass-skeleton=<skeleton> (-B):
           location of the baseclass header skeleton.
24

25 26
   --class-header=<header> (-c):
           filename holding the parser class definition.
27

28 29
   --class-name=<name>:
           the name of the generated C++ class.
30

31 32
   --class-skeleton=<skeleton> (-C):
           location of the class header skeleton.
33

34 35
   --construction:
           write details about the grammar analysis to stdout.
36

37 38 39
   --debug:
           generates debug output statements in the generated parse
           function's source.
40

41 42 43
   --default-actions=<off|quiet|warn|std> (-d):
           unless 'off', add a $$ = $1 action block to production rules not
           defining final action blocks.
44

45 46 47
   --error-verbose:
           the parse function will dump the parser's state stack to stdout
           when a syntactic error is reported
48

49 50
   --filenames=<filename> (-f):
           filename of output files (overruling the default filename).
51

52 53
   --flex:
           use the traditional `flex' interface.
54

55 56
   --help (-h):
           produce this information (and terminate).
57

58 59
   --implementation-header=<header> (-i):
           filename holding the implementation header.
60

61 62
   --implementation-skeleton=<skeleton> (-I):
           location of the implementation header skeleton.
63

64 65 66
   --insert-stype:
           show selected semantic values in the output generated by
           --debug. Ignored unless --debug was specified.
67

68 69
   --max-inclusion-depth=<value>:
           sets the maximum number of nested grammar files (default: 10).
70

71 72
   --namespace=<namespace> (-n):
           define the parser in the mentioned namespace.
73

74 75
   --no-baseclass-header:
           don't create the parser's base class header.
76

77 78 79
   --no-decoration (-D):
           do not include the user-defined actions when generating the
           parser's tt(parse) member.
80

81 82 83
   --no-lines:
           don't put #line directives in generated output, overruling the 
           %lines directive.
84

85 86
   --no-parse-member:
           don't create the member parse().
87

88 89 90
   --own-debug:
           bisonc++ displays the actions of its parser while processing
           its input file(s) (implies --verbose).
91

92 93 94
   --own-tokens (-T):
           bisonc++ displays the tokens and corresponding matched text,
           received from its lexcial scanner.
95

96 97
   --parsefun-skeleton=<parserskel> (-P):
           location of the parse function's skeleton.
98

99 100
   --parsefun-source=<source> (-p):
           filename holding the parse function's source.
101

102 103
   --polymorphic-code-skeleton=<skeleton> (-L):
           location of the non-inline polymorphic functions skeleton.
104

105 106
   --polymorphic-skeleton=<skeleton> (-M):
           location of the polymorphic semantic values skeleton.
107

108 109 110
   --print-tokens (-t):
           the print() member of the generated parser class displays the
           tokens and their corresponding matched text.
111

112 113 114 115
   --prompt:
           in combination with --debug: show a prompt before performing the
           next parse-cycle (caveat: the lexical scanner should not read from
           the standard input).
116

117 118 119
   --required-tokens=<value>:
           minimum number of successfully processed tokens between errors
           (default: 0).
120

121 122 123
   --scanner=<header-file> (-s):
           include `header-file' declaring the class Scanner, and call
           d_scanner.yylex() from Parser::lex().
124

125 126 127
   --scanner-class-name=<scanner class name>:
           specifies the name of the scanner class: this option is only
           interpreted if --scanner (or %scanner) is also used.
128

129 130
   --scanner-debug:
           extensive display of the actions of bisonc++'s scanner
131

132 133 134
   --scanner-matched-text-function=<function call>:
           specifies the function to call returning the text matched by the
           lexical scanner when returning a token
135

136 137 138 139
   --scanner-token-function=<scanner token function>:
           specifies the function to call by the parser's lex() function
           returning the next token returned by the lexcial scanner (by
           default d_scanner.yylex() when --scanner is used)
140

141 142 143
   --show-filenames:
           show the names of the used/generated files on the standard error
           stream.
144

145 146
   --skeleton-directory=<skeleton-directory> (-S):
           location of the skeleton directory.
147

148 149 150 151 152
   --tag-mismatches=<off|on>:
           unless 'off', issue a warning if no $$ statement was detected in an
           action block, or if no default $$ = $1 action can be added to a
           production rule without final action block, or if run-time a
           tag-mismatch is observed.
153

154 155 156
   --target-directory=<pathname>:
           pathname defines the directory where generated files should be
           written. By default this is the directory where bisonc++ is called.
157

158 159 160
   --thread-safe:
           provide thread-safe access by polymorphic semantic values to the
           generated code's error-counter.
161

162
   --usage: produce this information (and terminate).
163

164 165
   --verbose (-V):
           generate verbose description of the analyzed grammar. 
166

167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
   --version (-v):
)";


}   // anonymous namespace

void usage(string const &program_name)
{
    cout << 
    "\n" <<
    program_name << " by Frank B. Brokken (f.b.brokken@rug.nl)\n"
    "\n"
    "LALR(1) Parser Generator V "  << version << "\n"
    "Copyright (c) GPL " << year << ". NO WARRANTY.\n"
    "Designed after `bison++' (1.21.9-1) by Alain Coetmeur "
                                                "<coetmeur@icdc.fr>\n"
    "\n"
    "Usage: " << program_name << a_optionsDescription <<
185 186 187
    "           display " << program_name << "'s version and terminate.\n"

                                                                    << endl;
188 189
}

190 191 192