rdoc 6.5.0 → 6.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.rdoc +1 -1
- data/README.rdoc +2 -2
- data/TODO.rdoc +1 -1
- data/lib/rdoc/alias.rb +0 -1
- data/lib/rdoc/anon_class.rb +0 -1
- data/lib/rdoc/any_method.rb +15 -0
- data/lib/rdoc/attr.rb +0 -1
- data/lib/rdoc/class_module.rb +0 -1
- data/lib/rdoc/comment.rb +20 -41
- data/lib/rdoc/constant.rb +0 -1
- data/lib/rdoc/context/section.rb +0 -1
- data/lib/rdoc/context.rb +1 -1
- data/lib/rdoc/cross_reference.rb +3 -1
- data/lib/rdoc/encoding.rb +1 -17
- data/lib/rdoc/erb_partial.rb +0 -1
- data/lib/rdoc/erbio.rb +2 -7
- data/lib/rdoc/extend.rb +0 -1
- data/lib/rdoc/generator/darkfish.rb +2 -6
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +0 -1
- data/lib/rdoc/generator/pot.rb +1 -0
- data/lib/rdoc/generator/ri.rb +0 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +6 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +38 -13
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +13 -0
- data/lib/rdoc/generator/template/darkfish/js/search.js +3 -3
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +5 -4
- data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
- data/lib/rdoc/ghost_method.rb +0 -1
- data/lib/rdoc/include.rb +0 -1
- data/lib/rdoc/markdown/entities.rb +0 -1
- data/lib/rdoc/markdown/literals.kpeg +0 -2
- data/lib/rdoc/markdown/literals.rb +66 -44
- data/lib/rdoc/markdown.kpeg +3 -3
- data/lib/rdoc/markdown.rb +7 -5
- data/lib/rdoc/markup/attr_changer.rb +0 -1
- data/lib/rdoc/markup/attr_span.rb +0 -1
- data/lib/rdoc/markup/attribute_manager.rb +14 -12
- data/lib/rdoc/markup/attributes.rb +0 -1
- data/lib/rdoc/markup/blank_line.rb +0 -1
- data/lib/rdoc/markup/block_quote.rb +0 -1
- data/lib/rdoc/markup/document.rb +0 -1
- data/lib/rdoc/markup/formatter.rb +1 -2
- data/lib/rdoc/markup/hard_break.rb +0 -1
- data/lib/rdoc/markup/heading.rb +0 -1
- data/lib/rdoc/markup/include.rb +0 -1
- data/lib/rdoc/markup/indented_paragraph.rb +0 -1
- data/lib/rdoc/markup/list.rb +0 -1
- data/lib/rdoc/markup/list_item.rb +0 -1
- data/lib/rdoc/markup/paragraph.rb +0 -1
- data/lib/rdoc/markup/parser.rb +5 -1
- data/lib/rdoc/markup/raw.rb +0 -1
- data/lib/rdoc/markup/regexp_handling.rb +0 -1
- data/lib/rdoc/markup/rule.rb +0 -1
- data/lib/rdoc/markup/table.rb +11 -2
- data/lib/rdoc/markup/to_ansi.rb +0 -1
- data/lib/rdoc/markup/to_bs.rb +25 -0
- data/lib/rdoc/markup/to_html.rb +7 -3
- data/lib/rdoc/markup/to_html_crossref.rb +13 -14
- data/lib/rdoc/markup/to_html_snippet.rb +3 -1
- data/lib/rdoc/markup/to_joined_paragraph.rb +2 -3
- data/lib/rdoc/markup/to_label.rb +0 -1
- data/lib/rdoc/markup/to_markdown.rb +4 -5
- data/lib/rdoc/markup/to_rdoc.rb +11 -4
- data/lib/rdoc/markup/to_table_of_contents.rb +0 -1
- data/lib/rdoc/markup/to_test.rb +0 -1
- data/lib/rdoc/markup/to_tt_only.rb +0 -1
- data/lib/rdoc/markup/verbatim.rb +0 -1
- data/lib/rdoc/meta_method.rb +0 -1
- data/lib/rdoc/method_attr.rb +0 -1
- data/lib/rdoc/mixin.rb +0 -1
- data/lib/rdoc/normal_class.rb +0 -1
- data/lib/rdoc/normal_module.rb +0 -1
- data/lib/rdoc/options.rb +4 -2
- data/lib/rdoc/parser/c.rb +33 -22
- data/lib/rdoc/parser/changelog.rb +15 -1
- data/lib/rdoc/parser/markdown.rb +0 -2
- data/lib/rdoc/parser/rd.rb +0 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +11 -1
- data/lib/rdoc/parser/ruby.rb +18 -6
- data/lib/rdoc/parser/ruby_tools.rb +0 -2
- data/lib/rdoc/parser/text.rb +0 -1
- data/lib/rdoc/parser.rb +4 -2
- data/lib/rdoc/rd/block_parser.rb +650 -4
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rd/inline.rb +0 -1
- data/lib/rdoc/rd/inline_parser.rb +649 -3
- data/lib/rdoc/rdoc.rb +2 -4
- data/lib/rdoc/require.rb +0 -1
- data/lib/rdoc/ri/driver.rb +10 -9
- data/lib/rdoc/ri/store.rb +0 -1
- data/lib/rdoc/single_class.rb +0 -1
- data/lib/rdoc/stats/quiet.rb +0 -1
- data/lib/rdoc/stats/verbose.rb +0 -2
- data/lib/rdoc/store.rb +29 -19
- data/lib/rdoc/task.rb +28 -2
- data/lib/rdoc/text.rb +10 -0
- data/lib/rdoc/token_stream.rb +1 -2
- data/lib/rdoc/top_level.rb +3 -1
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +12 -0
- metadata +8 -8
@@ -1,11 +1,655 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# DO NOT MODIFY!!!!
|
4
|
-
# This file is automatically generated by Racc 1.
|
5
|
-
# from Racc grammar file "".
|
4
|
+
# This file is automatically generated by Racc 1.8.0
|
5
|
+
# from Racc grammar file "inline_parser.ry".
|
6
6
|
#
|
7
7
|
|
8
|
-
|
8
|
+
###### racc/parser.rb begin
|
9
|
+
unless $".find {|p| p.end_with?('/racc/parser.rb')}
|
10
|
+
$".push "#{__dir__}/racc/parser.rb"
|
11
|
+
#--
|
12
|
+
# Copyright (c) 1999-2006 Minero Aoki
|
13
|
+
#
|
14
|
+
# This program is free software.
|
15
|
+
# You can distribute/modify this program under the same terms of ruby.
|
16
|
+
#
|
17
|
+
# As a special exception, when this code is copied by Racc
|
18
|
+
# into a Racc output file, you may use that output file
|
19
|
+
# without restriction.
|
20
|
+
#++
|
21
|
+
|
22
|
+
unless $".find {|p| p.end_with?('/racc/info.rb')}
|
23
|
+
$".push "#{__dir__}/racc/info.rb"
|
24
|
+
|
25
|
+
module Racc
|
26
|
+
VERSION = '1.8.0'
|
27
|
+
Version = VERSION
|
28
|
+
Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
module Racc
|
35
|
+
class ParseError < StandardError; end
|
36
|
+
end
|
37
|
+
unless defined?(::ParseError)
|
38
|
+
ParseError = Racc::ParseError # :nodoc:
|
39
|
+
end
|
40
|
+
|
41
|
+
# Racc is a LALR(1) parser generator.
|
42
|
+
# It is written in Ruby itself, and generates Ruby programs.
|
43
|
+
#
|
44
|
+
# == Command-line Reference
|
45
|
+
#
|
46
|
+
# racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
|
47
|
+
# [-e<var>rubypath</var>] [--executable=<var>rubypath</var>]
|
48
|
+
# [-v] [--verbose]
|
49
|
+
# [-O<var>filename</var>] [--log-file=<var>filename</var>]
|
50
|
+
# [-g] [--debug]
|
51
|
+
# [-E] [--embedded]
|
52
|
+
# [-l] [--no-line-convert]
|
53
|
+
# [-c] [--line-convert-all]
|
54
|
+
# [-a] [--no-omit-actions]
|
55
|
+
# [-C] [--check-only]
|
56
|
+
# [-S] [--output-status]
|
57
|
+
# [--version] [--copyright] [--help] <var>grammarfile</var>
|
58
|
+
#
|
59
|
+
# [+grammarfile+]
|
60
|
+
# Racc grammar file. Any extension is permitted.
|
61
|
+
# [-o+outfile+, --output-file=+outfile+]
|
62
|
+
# A filename for output. default is <+filename+>.tab.rb
|
63
|
+
# [-O+filename+, --log-file=+filename+]
|
64
|
+
# Place logging output in file +filename+.
|
65
|
+
# Default log file name is <+filename+>.output.
|
66
|
+
# [-e+rubypath+, --executable=+rubypath+]
|
67
|
+
# output executable file(mode 755). where +path+ is the Ruby interpreter.
|
68
|
+
# [-v, --verbose]
|
69
|
+
# verbose mode. create +filename+.output file, like yacc's y.output file.
|
70
|
+
# [-g, --debug]
|
71
|
+
# add debug code to parser class. To display debugging information,
|
72
|
+
# use this '-g' option and set @yydebug true in parser class.
|
73
|
+
# [-E, --embedded]
|
74
|
+
# Output parser which doesn't need runtime files (racc/parser.rb).
|
75
|
+
# [-F, --frozen]
|
76
|
+
# Output parser which declares frozen_string_literals: true
|
77
|
+
# [-C, --check-only]
|
78
|
+
# Check syntax of racc grammar file and quit.
|
79
|
+
# [-S, --output-status]
|
80
|
+
# Print messages time to time while compiling.
|
81
|
+
# [-l, --no-line-convert]
|
82
|
+
# turns off line number converting.
|
83
|
+
# [-c, --line-convert-all]
|
84
|
+
# Convert line number of actions, inner, header and footer.
|
85
|
+
# [-a, --no-omit-actions]
|
86
|
+
# Call all actions, even if an action is empty.
|
87
|
+
# [--version]
|
88
|
+
# print Racc version and quit.
|
89
|
+
# [--copyright]
|
90
|
+
# Print copyright and quit.
|
91
|
+
# [--help]
|
92
|
+
# Print usage and quit.
|
93
|
+
#
|
94
|
+
# == Generating Parser Using Racc
|
95
|
+
#
|
96
|
+
# To compile Racc grammar file, simply type:
|
97
|
+
#
|
98
|
+
# $ racc parse.y
|
99
|
+
#
|
100
|
+
# This creates Ruby script file "parse.tab.y". The -o option can change the output filename.
|
101
|
+
#
|
102
|
+
# == Writing A Racc Grammar File
|
103
|
+
#
|
104
|
+
# If you want your own parser, you have to write a grammar file.
|
105
|
+
# A grammar file contains the name of your parser class, grammar for the parser,
|
106
|
+
# user code, and anything else.
|
107
|
+
# When writing a grammar file, yacc's knowledge is helpful.
|
108
|
+
# If you have not used yacc before, Racc is not too difficult.
|
109
|
+
#
|
110
|
+
# Here's an example Racc grammar file.
|
111
|
+
#
|
112
|
+
# class Calcparser
|
113
|
+
# rule
|
114
|
+
# target: exp { print val[0] }
|
115
|
+
#
|
116
|
+
# exp: exp '+' exp
|
117
|
+
# | exp '*' exp
|
118
|
+
# | '(' exp ')'
|
119
|
+
# | NUMBER
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# Racc grammar files resemble yacc files.
|
123
|
+
# But (of course), this is Ruby code.
|
124
|
+
# yacc's $$ is the 'result', $0, $1... is
|
125
|
+
# an array called 'val', and $-1, $-2... is an array called '_values'.
|
126
|
+
#
|
127
|
+
# See the {Grammar File Reference}[rdoc-ref:lib/racc/rdoc/grammar.en.rdoc] for
|
128
|
+
# more information on grammar files.
|
129
|
+
#
|
130
|
+
# == Parser
|
131
|
+
#
|
132
|
+
# Then you must prepare the parse entry method. There are two types of
|
133
|
+
# parse methods in Racc, Racc::Parser#do_parse and Racc::Parser#yyparse
|
134
|
+
#
|
135
|
+
# Racc::Parser#do_parse is simple.
|
136
|
+
#
|
137
|
+
# It's yyparse() of yacc, and Racc::Parser#next_token is yylex().
|
138
|
+
# This method must returns an array like [TOKENSYMBOL, ITS_VALUE].
|
139
|
+
# EOF is [false, false].
|
140
|
+
# (TOKENSYMBOL is a Ruby symbol (taken from String#intern) by default.
|
141
|
+
# If you want to change this, see the grammar reference.
|
142
|
+
#
|
143
|
+
# Racc::Parser#yyparse is little complicated, but useful.
|
144
|
+
# It does not use Racc::Parser#next_token, instead it gets tokens from any iterator.
|
145
|
+
#
|
146
|
+
# For example, <code>yyparse(obj, :scan)</code> causes
|
147
|
+
# calling +obj#scan+, and you can return tokens by yielding them from +obj#scan+.
|
148
|
+
#
|
149
|
+
# == Debugging
|
150
|
+
#
|
151
|
+
# When debugging, "-v" or/and the "-g" option is helpful.
|
152
|
+
#
|
153
|
+
# "-v" creates verbose log file (.output).
|
154
|
+
# "-g" creates a "Verbose Parser".
|
155
|
+
# Verbose Parser prints the internal status when parsing.
|
156
|
+
# But it's _not_ automatic.
|
157
|
+
# You must use -g option and set +@yydebug+ to +true+ in order to get output.
|
158
|
+
# -g option only creates the verbose parser.
|
159
|
+
#
|
160
|
+
# === Racc reported syntax error.
|
161
|
+
#
|
162
|
+
# Isn't there too many "end"?
|
163
|
+
# grammar of racc file is changed in v0.10.
|
164
|
+
#
|
165
|
+
# Racc does not use '%' mark, while yacc uses huge number of '%' marks..
|
166
|
+
#
|
167
|
+
# === Racc reported "XXXX conflicts".
|
168
|
+
#
|
169
|
+
# Try "racc -v xxxx.y".
|
170
|
+
# It causes producing racc's internal log file, xxxx.output.
|
171
|
+
#
|
172
|
+
# === Generated parsers does not work correctly
|
173
|
+
#
|
174
|
+
# Try "racc -g xxxx.y".
|
175
|
+
# This command let racc generate "debugging parser".
|
176
|
+
# Then set @yydebug=true in your parser.
|
177
|
+
# It produces a working log of your parser.
|
178
|
+
#
|
179
|
+
# == Re-distributing Racc runtime
|
180
|
+
#
|
181
|
+
# A parser, which is created by Racc, requires the Racc runtime module;
|
182
|
+
# racc/parser.rb.
|
183
|
+
#
|
184
|
+
# Ruby 1.8.x comes with Racc runtime module,
|
185
|
+
# you need NOT distribute Racc runtime files.
|
186
|
+
#
|
187
|
+
# If you want to include the Racc runtime module with your parser.
|
188
|
+
# This can be done by using '-E' option:
|
189
|
+
#
|
190
|
+
# $ racc -E -omyparser.rb myparser.y
|
191
|
+
#
|
192
|
+
# This command creates myparser.rb which `includes' Racc runtime.
|
193
|
+
# Only you must do is to distribute your parser file (myparser.rb).
|
194
|
+
#
|
195
|
+
# Note: parser.rb is ruby license, but your parser is not.
|
196
|
+
# Your own parser is completely yours.
|
197
|
+
module Racc
|
198
|
+
|
199
|
+
unless defined?(Racc_No_Extensions)
|
200
|
+
Racc_No_Extensions = false # :nodoc:
|
201
|
+
end
|
202
|
+
|
203
|
+
class Parser
|
204
|
+
|
205
|
+
Racc_Runtime_Version = ::Racc::VERSION
|
206
|
+
Racc_Runtime_Core_Version_R = ::Racc::VERSION
|
207
|
+
|
208
|
+
begin
|
209
|
+
if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
210
|
+
require 'jruby'
|
211
|
+
require 'racc/cparse-jruby.jar'
|
212
|
+
com.headius.racc.Cparse.new.load(JRuby.runtime, false)
|
213
|
+
else
|
214
|
+
require 'racc/cparse'
|
215
|
+
end
|
216
|
+
|
217
|
+
unless new.respond_to?(:_racc_do_parse_c, true)
|
218
|
+
raise LoadError, 'old cparse.so'
|
219
|
+
end
|
220
|
+
if Racc_No_Extensions
|
221
|
+
raise LoadError, 'selecting ruby version of racc runtime core'
|
222
|
+
end
|
223
|
+
|
224
|
+
Racc_Main_Parsing_Routine = :_racc_do_parse_c # :nodoc:
|
225
|
+
Racc_YY_Parse_Method = :_racc_yyparse_c # :nodoc:
|
226
|
+
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C # :nodoc:
|
227
|
+
Racc_Runtime_Type = 'c' # :nodoc:
|
228
|
+
rescue LoadError
|
229
|
+
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
230
|
+
Racc_YY_Parse_Method = :_racc_yyparse_rb
|
231
|
+
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
|
232
|
+
Racc_Runtime_Type = 'ruby'
|
233
|
+
end
|
234
|
+
|
235
|
+
def Parser.racc_runtime_type # :nodoc:
|
236
|
+
Racc_Runtime_Type
|
237
|
+
end
|
238
|
+
|
239
|
+
def _racc_setup
|
240
|
+
@yydebug = false unless self.class::Racc_debug_parser
|
241
|
+
@yydebug = false unless defined?(@yydebug)
|
242
|
+
if @yydebug
|
243
|
+
@racc_debug_out = $stderr unless defined?(@racc_debug_out)
|
244
|
+
@racc_debug_out ||= $stderr
|
245
|
+
end
|
246
|
+
arg = self.class::Racc_arg
|
247
|
+
arg[13] = true if arg.size < 14
|
248
|
+
arg
|
249
|
+
end
|
250
|
+
|
251
|
+
def _racc_init_sysvars
|
252
|
+
@racc_state = [0]
|
253
|
+
@racc_tstack = []
|
254
|
+
@racc_vstack = []
|
255
|
+
|
256
|
+
@racc_t = nil
|
257
|
+
@racc_val = nil
|
258
|
+
|
259
|
+
@racc_read_next = true
|
260
|
+
|
261
|
+
@racc_user_yyerror = false
|
262
|
+
@racc_error_status = 0
|
263
|
+
end
|
264
|
+
|
265
|
+
# The entry point of the parser. This method is used with #next_token.
|
266
|
+
# If Racc wants to get token (and its value), calls next_token.
|
267
|
+
#
|
268
|
+
# Example:
|
269
|
+
# def parse
|
270
|
+
# @q = [[1,1],
|
271
|
+
# [2,2],
|
272
|
+
# [3,3],
|
273
|
+
# [false, '$']]
|
274
|
+
# do_parse
|
275
|
+
# end
|
276
|
+
#
|
277
|
+
# def next_token
|
278
|
+
# @q.shift
|
279
|
+
# end
|
280
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
281
|
+
def do_parse
|
282
|
+
#{Racc_Main_Parsing_Routine}(_racc_setup(), false)
|
283
|
+
end
|
284
|
+
RUBY
|
285
|
+
|
286
|
+
# The method to fetch next token.
|
287
|
+
# If you use #do_parse method, you must implement #next_token.
|
288
|
+
#
|
289
|
+
# The format of return value is [TOKEN_SYMBOL, VALUE].
|
290
|
+
# +token-symbol+ is represented by Ruby's symbol by default, e.g. :IDENT
|
291
|
+
# for 'IDENT'. ";" (String) for ';'.
|
292
|
+
#
|
293
|
+
# The final symbol (End of file) must be false.
|
294
|
+
def next_token
|
295
|
+
raise NotImplementedError, "#{self.class}\#next_token is not defined"
|
296
|
+
end
|
297
|
+
|
298
|
+
def _racc_do_parse_rb(arg, in_debug)
|
299
|
+
action_table, action_check, action_default, action_pointer,
|
300
|
+
_, _, _, _,
|
301
|
+
_, _, token_table, * = arg
|
302
|
+
|
303
|
+
_racc_init_sysvars
|
304
|
+
tok = act = i = nil
|
305
|
+
|
306
|
+
catch(:racc_end_parse) {
|
307
|
+
while true
|
308
|
+
if i = action_pointer[@racc_state[-1]]
|
309
|
+
if @racc_read_next
|
310
|
+
if @racc_t != 0 # not EOF
|
311
|
+
tok, @racc_val = next_token()
|
312
|
+
unless tok # EOF
|
313
|
+
@racc_t = 0
|
314
|
+
else
|
315
|
+
@racc_t = (token_table[tok] or 1) # error token
|
316
|
+
end
|
317
|
+
racc_read_token(@racc_t, tok, @racc_val) if @yydebug
|
318
|
+
@racc_read_next = false
|
319
|
+
end
|
320
|
+
end
|
321
|
+
i += @racc_t
|
322
|
+
unless i >= 0 and
|
323
|
+
act = action_table[i] and
|
324
|
+
action_check[i] == @racc_state[-1]
|
325
|
+
act = action_default[@racc_state[-1]]
|
326
|
+
end
|
327
|
+
else
|
328
|
+
act = action_default[@racc_state[-1]]
|
329
|
+
end
|
330
|
+
while act = _racc_evalact(act, arg)
|
331
|
+
;
|
332
|
+
end
|
333
|
+
end
|
334
|
+
}
|
335
|
+
end
|
336
|
+
|
337
|
+
# Another entry point for the parser.
|
338
|
+
# If you use this method, you must implement RECEIVER#METHOD_ID method.
|
339
|
+
#
|
340
|
+
# RECEIVER#METHOD_ID is a method to get next token.
|
341
|
+
# It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
|
342
|
+
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
343
|
+
def yyparse(recv, mid)
|
344
|
+
#{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), false)
|
345
|
+
end
|
346
|
+
RUBY
|
347
|
+
|
348
|
+
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
349
|
+
action_table, action_check, action_default, action_pointer,
|
350
|
+
_, _, _, _,
|
351
|
+
_, _, token_table, * = arg
|
352
|
+
|
353
|
+
_racc_init_sysvars
|
354
|
+
|
355
|
+
catch(:racc_end_parse) {
|
356
|
+
until i = action_pointer[@racc_state[-1]]
|
357
|
+
while act = _racc_evalact(action_default[@racc_state[-1]], arg)
|
358
|
+
;
|
359
|
+
end
|
360
|
+
end
|
361
|
+
recv.__send__(mid) do |tok, val|
|
362
|
+
unless tok
|
363
|
+
@racc_t = 0
|
364
|
+
else
|
365
|
+
@racc_t = (token_table[tok] or 1) # error token
|
366
|
+
end
|
367
|
+
@racc_val = val
|
368
|
+
@racc_read_next = false
|
369
|
+
|
370
|
+
i += @racc_t
|
371
|
+
unless i >= 0 and
|
372
|
+
act = action_table[i] and
|
373
|
+
action_check[i] == @racc_state[-1]
|
374
|
+
act = action_default[@racc_state[-1]]
|
375
|
+
end
|
376
|
+
while act = _racc_evalact(act, arg)
|
377
|
+
;
|
378
|
+
end
|
379
|
+
|
380
|
+
while !(i = action_pointer[@racc_state[-1]]) ||
|
381
|
+
! @racc_read_next ||
|
382
|
+
@racc_t == 0 # $
|
383
|
+
unless i and i += @racc_t and
|
384
|
+
i >= 0 and
|
385
|
+
act = action_table[i] and
|
386
|
+
action_check[i] == @racc_state[-1]
|
387
|
+
act = action_default[@racc_state[-1]]
|
388
|
+
end
|
389
|
+
while act = _racc_evalact(act, arg)
|
390
|
+
;
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
}
|
395
|
+
end
|
396
|
+
|
397
|
+
###
|
398
|
+
### common
|
399
|
+
###
|
400
|
+
|
401
|
+
def _racc_evalact(act, arg)
|
402
|
+
action_table, action_check, _, action_pointer,
|
403
|
+
_, _, _, _,
|
404
|
+
_, _, _, shift_n,
|
405
|
+
reduce_n, * = arg
|
406
|
+
nerr = 0 # tmp
|
407
|
+
|
408
|
+
if act > 0 and act < shift_n
|
409
|
+
#
|
410
|
+
# shift
|
411
|
+
#
|
412
|
+
if @racc_error_status > 0
|
413
|
+
@racc_error_status -= 1 unless @racc_t <= 1 # error token or EOF
|
414
|
+
end
|
415
|
+
@racc_vstack.push @racc_val
|
416
|
+
@racc_state.push act
|
417
|
+
@racc_read_next = true
|
418
|
+
if @yydebug
|
419
|
+
@racc_tstack.push @racc_t
|
420
|
+
racc_shift @racc_t, @racc_tstack, @racc_vstack
|
421
|
+
end
|
422
|
+
|
423
|
+
elsif act < 0 and act > -reduce_n
|
424
|
+
#
|
425
|
+
# reduce
|
426
|
+
#
|
427
|
+
code = catch(:racc_jump) {
|
428
|
+
@racc_state.push _racc_do_reduce(arg, act)
|
429
|
+
false
|
430
|
+
}
|
431
|
+
if code
|
432
|
+
case code
|
433
|
+
when 1 # yyerror
|
434
|
+
@racc_user_yyerror = true # user_yyerror
|
435
|
+
return -reduce_n
|
436
|
+
when 2 # yyaccept
|
437
|
+
return shift_n
|
438
|
+
else
|
439
|
+
raise '[Racc Bug] unknown jump code'
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
elsif act == shift_n
|
444
|
+
#
|
445
|
+
# accept
|
446
|
+
#
|
447
|
+
racc_accept if @yydebug
|
448
|
+
throw :racc_end_parse, @racc_vstack[0]
|
449
|
+
|
450
|
+
elsif act == -reduce_n
|
451
|
+
#
|
452
|
+
# error
|
453
|
+
#
|
454
|
+
case @racc_error_status
|
455
|
+
when 0
|
456
|
+
unless arg[21] # user_yyerror
|
457
|
+
nerr += 1
|
458
|
+
on_error @racc_t, @racc_val, @racc_vstack
|
459
|
+
end
|
460
|
+
when 3
|
461
|
+
if @racc_t == 0 # is $
|
462
|
+
# We're at EOF, and another error occurred immediately after
|
463
|
+
# attempting auto-recovery
|
464
|
+
throw :racc_end_parse, nil
|
465
|
+
end
|
466
|
+
@racc_read_next = true
|
467
|
+
end
|
468
|
+
@racc_user_yyerror = false
|
469
|
+
@racc_error_status = 3
|
470
|
+
while true
|
471
|
+
if i = action_pointer[@racc_state[-1]]
|
472
|
+
i += 1 # error token
|
473
|
+
if i >= 0 and
|
474
|
+
(act = action_table[i]) and
|
475
|
+
action_check[i] == @racc_state[-1]
|
476
|
+
break
|
477
|
+
end
|
478
|
+
end
|
479
|
+
throw :racc_end_parse, nil if @racc_state.size <= 1
|
480
|
+
@racc_state.pop
|
481
|
+
@racc_vstack.pop
|
482
|
+
if @yydebug
|
483
|
+
@racc_tstack.pop
|
484
|
+
racc_e_pop @racc_state, @racc_tstack, @racc_vstack
|
485
|
+
end
|
486
|
+
end
|
487
|
+
return act
|
488
|
+
|
489
|
+
else
|
490
|
+
raise "[Racc Bug] unknown action #{act.inspect}"
|
491
|
+
end
|
492
|
+
|
493
|
+
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
|
494
|
+
|
495
|
+
nil
|
496
|
+
end
|
497
|
+
|
498
|
+
def _racc_do_reduce(arg, act)
|
499
|
+
_, _, _, _,
|
500
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
501
|
+
nt_base, reduce_table, _, _,
|
502
|
+
_, use_result, * = arg
|
503
|
+
|
504
|
+
state = @racc_state
|
505
|
+
vstack = @racc_vstack
|
506
|
+
tstack = @racc_tstack
|
507
|
+
|
508
|
+
i = act * -3
|
509
|
+
len = reduce_table[i]
|
510
|
+
reduce_to = reduce_table[i+1]
|
511
|
+
method_id = reduce_table[i+2]
|
512
|
+
void_array = []
|
513
|
+
|
514
|
+
tmp_t = tstack[-len, len] if @yydebug
|
515
|
+
tmp_v = vstack[-len, len]
|
516
|
+
tstack[-len, len] = void_array if @yydebug
|
517
|
+
vstack[-len, len] = void_array
|
518
|
+
state[-len, len] = void_array
|
519
|
+
|
520
|
+
# tstack must be updated AFTER method call
|
521
|
+
if use_result
|
522
|
+
vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
|
523
|
+
else
|
524
|
+
vstack.push __send__(method_id, tmp_v, vstack)
|
525
|
+
end
|
526
|
+
tstack.push reduce_to
|
527
|
+
|
528
|
+
racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
|
529
|
+
|
530
|
+
k1 = reduce_to - nt_base
|
531
|
+
if i = goto_pointer[k1]
|
532
|
+
i += state[-1]
|
533
|
+
if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
|
534
|
+
return curstate
|
535
|
+
end
|
536
|
+
end
|
537
|
+
goto_default[k1]
|
538
|
+
end
|
539
|
+
|
540
|
+
# This method is called when a parse error is found.
|
541
|
+
#
|
542
|
+
# ERROR_TOKEN_ID is an internal ID of token which caused error.
|
543
|
+
# You can get string representation of this ID by calling
|
544
|
+
# #token_to_str.
|
545
|
+
#
|
546
|
+
# ERROR_VALUE is a value of error token.
|
547
|
+
#
|
548
|
+
# value_stack is a stack of symbol values.
|
549
|
+
# DO NOT MODIFY this object.
|
550
|
+
#
|
551
|
+
# This method raises ParseError by default.
|
552
|
+
#
|
553
|
+
# If this method returns, parsers enter "error recovering mode".
|
554
|
+
def on_error(t, val, vstack)
|
555
|
+
raise ParseError, sprintf("parse error on value %s (%s)",
|
556
|
+
val.inspect, token_to_str(t) || '?')
|
557
|
+
end
|
558
|
+
|
559
|
+
# Enter error recovering mode.
|
560
|
+
# This method does not call #on_error.
|
561
|
+
def yyerror
|
562
|
+
throw :racc_jump, 1
|
563
|
+
end
|
564
|
+
|
565
|
+
# Exit parser.
|
566
|
+
# Return value is +Symbol_Value_Stack[0]+.
|
567
|
+
def yyaccept
|
568
|
+
throw :racc_jump, 2
|
569
|
+
end
|
570
|
+
|
571
|
+
# Leave error recovering mode.
|
572
|
+
def yyerrok
|
573
|
+
@racc_error_status = 0
|
574
|
+
end
|
575
|
+
|
576
|
+
# For debugging output
|
577
|
+
def racc_read_token(t, tok, val)
|
578
|
+
@racc_debug_out.print 'read '
|
579
|
+
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
|
580
|
+
@racc_debug_out.puts val.inspect
|
581
|
+
@racc_debug_out.puts
|
582
|
+
end
|
583
|
+
|
584
|
+
def racc_shift(tok, tstack, vstack)
|
585
|
+
@racc_debug_out.puts "shift #{racc_token2str tok}"
|
586
|
+
racc_print_stacks tstack, vstack
|
587
|
+
@racc_debug_out.puts
|
588
|
+
end
|
589
|
+
|
590
|
+
def racc_reduce(toks, sim, tstack, vstack)
|
591
|
+
out = @racc_debug_out
|
592
|
+
out.print 'reduce '
|
593
|
+
if toks.empty?
|
594
|
+
out.print ' <none>'
|
595
|
+
else
|
596
|
+
toks.each {|t| out.print ' ', racc_token2str(t) }
|
597
|
+
end
|
598
|
+
out.puts " --> #{racc_token2str(sim)}"
|
599
|
+
racc_print_stacks tstack, vstack
|
600
|
+
@racc_debug_out.puts
|
601
|
+
end
|
602
|
+
|
603
|
+
def racc_accept
|
604
|
+
@racc_debug_out.puts 'accept'
|
605
|
+
@racc_debug_out.puts
|
606
|
+
end
|
607
|
+
|
608
|
+
def racc_e_pop(state, tstack, vstack)
|
609
|
+
@racc_debug_out.puts 'error recovering mode: pop token'
|
610
|
+
racc_print_states state
|
611
|
+
racc_print_stacks tstack, vstack
|
612
|
+
@racc_debug_out.puts
|
613
|
+
end
|
614
|
+
|
615
|
+
def racc_next_state(curstate, state)
|
616
|
+
@racc_debug_out.puts "goto #{curstate}"
|
617
|
+
racc_print_states state
|
618
|
+
@racc_debug_out.puts
|
619
|
+
end
|
620
|
+
|
621
|
+
def racc_print_stacks(t, v)
|
622
|
+
out = @racc_debug_out
|
623
|
+
out.print ' ['
|
624
|
+
t.each_index do |i|
|
625
|
+
out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
|
626
|
+
end
|
627
|
+
out.puts ' ]'
|
628
|
+
end
|
629
|
+
|
630
|
+
def racc_print_states(s)
|
631
|
+
out = @racc_debug_out
|
632
|
+
out.print ' ['
|
633
|
+
s.each {|st| out.print ' ', st }
|
634
|
+
out.puts ' ]'
|
635
|
+
end
|
636
|
+
|
637
|
+
def racc_token2str(tok)
|
638
|
+
self.class::Racc_token_to_s_table[tok] or
|
639
|
+
raise "[Racc Bug] can't convert token #{tok} to string"
|
640
|
+
end
|
641
|
+
|
642
|
+
# Convert internal ID of token symbol to the string.
|
643
|
+
def token_to_str(t)
|
644
|
+
self.class::Racc_token_to_s_table[t]
|
645
|
+
end
|
646
|
+
|
647
|
+
end
|
648
|
+
|
649
|
+
end
|
650
|
+
|
651
|
+
end
|
652
|
+
###### racc/parser.rb end
|
9
653
|
|
10
654
|
require 'strscan'
|
11
655
|
|
@@ -652,6 +1296,7 @@ Racc_arg = [
|
|
652
1296
|
racc_shift_n,
|
653
1297
|
racc_reduce_n,
|
654
1298
|
racc_use_result_var ]
|
1299
|
+
Ractor.make_shareable(Racc_arg) if defined?(Ractor)
|
655
1300
|
|
656
1301
|
Racc_token_to_s_table = [
|
657
1302
|
"$end",
|
@@ -723,6 +1368,7 @@ Racc_token_to_s_table = [
|
|
723
1368
|
"normal_strings",
|
724
1369
|
"verb_string",
|
725
1370
|
"verb_normal_string" ]
|
1371
|
+
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
|
726
1372
|
|
727
1373
|
Racc_debug_parser = false
|
728
1374
|
|
data/lib/rdoc/rdoc.rb
CHANGED
@@ -119,7 +119,7 @@ class RDoc::RDoc
|
|
119
119
|
# +files+.
|
120
120
|
|
121
121
|
def gather_files files
|
122
|
-
files = [
|
122
|
+
files = [@options.root.to_s] if files.empty?
|
123
123
|
|
124
124
|
file_list = normalized_file_list files, true, @options.exclude
|
125
125
|
|
@@ -429,9 +429,7 @@ The internal error was:
|
|
429
429
|
files.reject do |file, *|
|
430
430
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
431
431
|
(file =~ /tags$/i and
|
432
|
-
File.
|
433
|
-
io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
|
434
|
-
})
|
432
|
+
/\A(\f\n[^,]+,\d+$|!_TAG_)/.match?(File.binread(file, 100)))
|
435
433
|
end
|
436
434
|
end
|
437
435
|
|
data/lib/rdoc/require.rb
CHANGED