Skip to content

Commit 3c72fbe

Browse files
authored
Merge pull request #283 from ydah/improve-comment
[Doc] Improve documentation for usage of racc
2 parents 2d89b0d + f21081a commit 3c72fbe

File tree

2 files changed

+38
-23
lines changed

2 files changed

+38
-23
lines changed

README.rdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
Any kind of bug report is welcome.
5353
If you find a bug of Racc, please report an issue at
5454
https://github.com/ruby/racc/issues. Your grammar file,
55-
debug output generated by "racc -g", are helpful.
55+
debug output generated by "racc -t", are helpful.
5656

5757

5858
Minero Aoki

lib/racc/parser.rb

+37-22
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,63 @@ class ParseError < StandardError; end
2525
# == Command-line Reference
2626
#
2727
# racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
28-
# [-e<var>rubypath</var>] [--executable=<var>rubypath</var>]
28+
# [-t] [--debug]
29+
# [-g]
2930
# [-v] [--verbose]
3031
# [-O<var>filename</var>] [--log-file=<var>filename</var>]
31-
# [-g] [--debug]
32+
# [-e<var>rubypath</var>] [--executable=<var>rubypath</var>]
3233
# [-E] [--embedded]
34+
# [-F] [--frozen]
35+
# [--line-convert-all]
3336
# [-l] [--no-line-convert]
34-
# [-c] [--line-convert-all]
3537
# [-a] [--no-omit-actions]
38+
# [--superclass=<var>classname</var>]
3639
# [-C] [--check-only]
3740
# [-S] [--output-status]
38-
# [--version] [--copyright] [--help] <var>grammarfile</var>
41+
# [-P]
42+
# [-D<var>flags</var>]
43+
# [--version] [--runtime-version] [--copyright] [--help] <var>grammarfile</var>
3944
#
4045
# [+grammarfile+]
4146
# Racc grammar file. Any extension is permitted.
4247
# [-o+outfile+, --output-file=+outfile+]
4348
# A filename for output. default is <+filename+>.tab.rb
49+
# [-t, --debug]
50+
# Add debug code to parser class. To display debugging information,
51+
# use this '-t' option and set @yydebug true in parser class.
52+
# [-g]
53+
# This option is obsolete. Use '-t' instead.
54+
# [-v, --verbose]
55+
# Verbose mode. create +filename+.output file, like yacc's y.output file.
4456
# [-O+filename+, --log-file=+filename+]
4557
# Place logging output in file +filename+.
4658
# Default log file name is <+filename+>.output.
4759
# [-e+rubypath+, --executable=+rubypath+]
48-
# output executable file(mode 755). where +path+ is the Ruby interpreter.
49-
# [-v, --verbose]
50-
# verbose mode. create +filename+.output file, like yacc's y.output file.
51-
# [-g, --debug]
52-
# add debug code to parser class. To display debugging information,
53-
# use this '-g' option and set @yydebug true in parser class.
60+
# Output executable file(mode 755). where +path+ is the Ruby interpreter.
5461
# [-E, --embedded]
5562
# Output parser which doesn't need runtime files (racc/parser.rb).
5663
# [-F, --frozen]
5764
# Output parser which declares frozen_string_literals: true
65+
# [--line-convert-all]
66+
# Convert line number of actions, inner, header and footer.
67+
# [-l, --no-line-convert]
68+
# Turns off line number converting.
69+
# [-a, --no-omit-actions]
70+
# Call all actions, even if an action is empty.
71+
# [--superclass=+classname+]
72+
# Uses +classname+ instead of Racc::Parser as the superclass of the generated parser.
5873
# [-C, --check-only]
5974
# Check syntax of racc grammar file and quit.
6075
# [-S, --output-status]
6176
# Print messages time to time while compiling.
62-
# [-l, --no-line-convert]
63-
# turns off line number converting.
64-
# [-c, --line-convert-all]
65-
# Convert line number of actions, inner, header and footer.
66-
# [-a, --no-omit-actions]
67-
# Call all actions, even if an action is empty.
77+
# [-P]
78+
# Enables generator profile mode.
79+
# [-D +flags+]
80+
# Do not use this option. Flags for Racc debugging.
6881
# [--version]
69-
# print Racc version and quit.
82+
# Print Racc version and quit.
83+
# [--runtime-version]
84+
# Print Racc runtime version and quit.
7085
# [--copyright]
7186
# Print copyright and quit.
7287
# [--help]
@@ -129,14 +144,14 @@ class ParseError < StandardError; end
129144
#
130145
# == Debugging
131146
#
132-
# When debugging, "-v" or/and the "-g" option is helpful.
147+
# When debugging, "-v" or/and the "-t" option is helpful.
133148
#
134149
# "-v" creates verbose log file (.output).
135-
# "-g" creates a "Verbose Parser".
150+
# "-t" creates a "Verbose Parser".
136151
# Verbose Parser prints the internal status when parsing.
137152
# But it's _not_ automatic.
138-
# You must use -g option and set +@yydebug+ to +true+ in order to get output.
139-
# -g option only creates the verbose parser.
153+
# You must use -t option and set +@yydebug+ to +true+ in order to get output.
154+
# -t option only creates the verbose parser.
140155
#
141156
# === Racc reported syntax error.
142157
#
@@ -152,7 +167,7 @@ class ParseError < StandardError; end
152167
#
153168
# === Generated parsers does not work correctly
154169
#
155-
# Try "racc -g xxxx.y".
170+
# Try "racc -t xxxx.y".
156171
# This command let racc generate "debugging parser".
157172
# Then set @yydebug=true in your parser.
158173
# It produces a working log of your parser.

0 commit comments

Comments
 (0)