rdoc 3.12.2 → 4.0.0.preview2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (200) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +3 -2
  5. data/DEVELOPERS.rdoc +53 -0
  6. data/History.rdoc +159 -25
  7. data/LEGAL.rdoc +12 -0
  8. data/Manifest.txt +56 -3
  9. data/README.rdoc +87 -19
  10. data/Rakefile +11 -2
  11. data/TODO.rdoc +20 -13
  12. data/bin/rdoc +4 -0
  13. data/lib/gauntlet_rdoc.rb +1 -1
  14. data/lib/rdoc.rb +32 -71
  15. data/lib/rdoc/any_method.rb +75 -21
  16. data/lib/rdoc/attr.rb +49 -10
  17. data/lib/rdoc/class_module.rb +182 -32
  18. data/lib/rdoc/code_object.rb +54 -12
  19. data/lib/rdoc/comment.rb +8 -1
  20. data/lib/rdoc/constant.rb +100 -6
  21. data/lib/rdoc/context.rb +93 -41
  22. data/lib/rdoc/context/section.rb +143 -28
  23. data/lib/rdoc/cross_reference.rb +58 -50
  24. data/lib/rdoc/encoding.rb +34 -29
  25. data/lib/rdoc/erb_partial.rb +18 -0
  26. data/lib/rdoc/extend.rb +117 -0
  27. data/lib/rdoc/generator.rb +11 -6
  28. data/lib/rdoc/generator/darkfish.rb +250 -62
  29. data/lib/rdoc/generator/json_index.rb +20 -12
  30. data/lib/rdoc/generator/markup.rb +10 -12
  31. data/lib/rdoc/generator/ri.rb +7 -60
  32. data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
  38. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
  39. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  40. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
  41. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
  42. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
  43. data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
  44. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
  45. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
  46. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  47. data/lib/rdoc/include.rb +12 -3
  48. data/lib/rdoc/markdown.kpeg +1186 -0
  49. data/lib/rdoc/markdown.rb +16336 -0
  50. data/lib/rdoc/markdown/entities.rb +2128 -0
  51. data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
  52. data/lib/rdoc/markdown/literals_1_8.rb +454 -0
  53. data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
  54. data/lib/rdoc/markdown/literals_1_9.rb +417 -0
  55. data/lib/rdoc/markup.rb +69 -10
  56. data/lib/rdoc/markup/attr_changer.rb +2 -5
  57. data/lib/rdoc/markup/attribute_manager.rb +23 -14
  58. data/lib/rdoc/markup/attributes.rb +70 -0
  59. data/lib/rdoc/markup/block_quote.rb +14 -0
  60. data/lib/rdoc/markup/document.rb +20 -4
  61. data/lib/rdoc/markup/formatter.rb +17 -6
  62. data/lib/rdoc/markup/formatter_test_case.rb +93 -24
  63. data/lib/rdoc/markup/hard_break.rb +31 -0
  64. data/lib/rdoc/markup/heading.rb +1 -1
  65. data/lib/rdoc/markup/indented_paragraph.rb +14 -0
  66. data/lib/rdoc/markup/list.rb +23 -4
  67. data/lib/rdoc/markup/list_item.rb +17 -4
  68. data/lib/rdoc/markup/paragraph.rb +14 -0
  69. data/lib/rdoc/markup/parser.rb +107 -60
  70. data/lib/rdoc/markup/raw.rb +4 -4
  71. data/lib/rdoc/markup/special.rb +3 -3
  72. data/lib/rdoc/markup/to_ansi.rb +7 -1
  73. data/lib/rdoc/markup/to_html.rb +42 -14
  74. data/lib/rdoc/markup/to_html_crossref.rb +10 -9
  75. data/lib/rdoc/markup/to_html_snippet.rb +20 -4
  76. data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
  77. data/lib/rdoc/markup/to_label.rb +20 -1
  78. data/lib/rdoc/markup/to_markdown.rb +134 -0
  79. data/lib/rdoc/markup/to_rdoc.rb +36 -5
  80. data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
  81. data/lib/rdoc/markup/to_tt_only.rb +11 -2
  82. data/lib/rdoc/markup/verbatim.rb +19 -0
  83. data/lib/rdoc/method_attr.rb +33 -19
  84. data/lib/rdoc/normal_class.rb +26 -7
  85. data/lib/rdoc/normal_module.rb +10 -5
  86. data/lib/rdoc/options.rb +95 -21
  87. data/lib/rdoc/parser.rb +6 -2
  88. data/lib/rdoc/parser/c.rb +212 -97
  89. data/lib/rdoc/parser/markdown.rb +23 -0
  90. data/lib/rdoc/parser/ruby.rb +115 -35
  91. data/lib/rdoc/parser/ruby_tools.rb +8 -3
  92. data/lib/rdoc/rd.rb +8 -4
  93. data/lib/rdoc/rd/block_parser.rb +1 -1
  94. data/lib/rdoc/rd/block_parser.ry +1 -1
  95. data/lib/rdoc/rdoc.rb +45 -21
  96. data/lib/rdoc/ri/driver.rb +322 -76
  97. data/lib/rdoc/ri/paths.rb +90 -31
  98. data/lib/rdoc/ri/store.rb +2 -353
  99. data/lib/rdoc/ruby_lex.rb +5 -21
  100. data/lib/rdoc/ruby_token.rb +2 -3
  101. data/lib/rdoc/rubygems_hook.rb +21 -9
  102. data/lib/rdoc/servlet.rb +302 -0
  103. data/lib/rdoc/stats.rb +28 -20
  104. data/lib/rdoc/store.rb +881 -0
  105. data/lib/rdoc/task.rb +2 -1
  106. data/lib/rdoc/test_case.rb +103 -1
  107. data/lib/rdoc/text.rb +5 -4
  108. data/lib/rdoc/tom_doc.rb +17 -16
  109. data/lib/rdoc/top_level.rb +43 -285
  110. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
  111. data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
  112. data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
  113. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
  114. data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
  115. data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
  116. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
  117. data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
  118. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
  119. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
  120. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
  121. data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
  122. data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
  123. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
  124. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
  125. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
  126. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
  127. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
  128. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
  129. data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
  130. data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
  131. data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
  132. data/test/test_attribute_manager.rb +7 -4
  133. data/test/test_rdoc_any_method.rb +84 -13
  134. data/test/test_rdoc_attr.rb +59 -9
  135. data/test/test_rdoc_class_module.rb +670 -73
  136. data/test/test_rdoc_code_object.rb +21 -1
  137. data/test/test_rdoc_comment.rb +1 -1
  138. data/test/test_rdoc_constant.rb +132 -0
  139. data/test/test_rdoc_context.rb +84 -18
  140. data/test/test_rdoc_context_section.rb +99 -15
  141. data/test/test_rdoc_cross_reference.rb +1 -1
  142. data/test/test_rdoc_encoding.rb +17 -1
  143. data/test/test_rdoc_extend.rb +94 -0
  144. data/test/test_rdoc_generator_darkfish.rb +45 -19
  145. data/test/test_rdoc_generator_json_index.rb +27 -7
  146. data/test/test_rdoc_generator_markup.rb +3 -3
  147. data/test/test_rdoc_generator_ri.rb +11 -9
  148. data/test/test_rdoc_include.rb +12 -0
  149. data/test/test_rdoc_markdown.rb +977 -0
  150. data/test/test_rdoc_markdown_test.rb +1891 -0
  151. data/test/test_rdoc_markup.rb +1 -1
  152. data/test/test_rdoc_markup_attribute_manager.rb +2 -2
  153. data/test/test_rdoc_markup_attributes.rb +39 -0
  154. data/test/test_rdoc_markup_document.rb +16 -1
  155. data/test/test_rdoc_markup_formatter.rb +7 -4
  156. data/test/test_rdoc_markup_hard_break.rb +31 -0
  157. data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
  158. data/test/test_rdoc_markup_paragraph.rb +15 -1
  159. data/test/test_rdoc_markup_parser.rb +152 -89
  160. data/test/test_rdoc_markup_to_ansi.rb +23 -2
  161. data/test/test_rdoc_markup_to_bs.rb +24 -0
  162. data/test/test_rdoc_markup_to_html.rb +50 -19
  163. data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
  164. data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
  165. data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
  166. data/test/test_rdoc_markup_to_label.rb +63 -1
  167. data/test/test_rdoc_markup_to_markdown.rb +352 -0
  168. data/test/test_rdoc_markup_to_rdoc.rb +22 -2
  169. data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
  170. data/test/test_rdoc_markup_to_tt_only.rb +20 -0
  171. data/test/test_rdoc_markup_verbatim.rb +13 -0
  172. data/test/test_rdoc_method_attr.rb +5 -0
  173. data/test/test_rdoc_normal_class.rb +24 -5
  174. data/test/test_rdoc_normal_module.rb +1 -1
  175. data/test/test_rdoc_options.rb +21 -6
  176. data/test/test_rdoc_parser.rb +24 -0
  177. data/test/test_rdoc_parser_c.rb +151 -26
  178. data/test/test_rdoc_parser_markdown.rb +55 -0
  179. data/test/test_rdoc_parser_rd.rb +2 -2
  180. data/test/test_rdoc_parser_ruby.rb +468 -109
  181. data/test/test_rdoc_parser_simple.rb +2 -2
  182. data/test/test_rdoc_rd_block_parser.rb +0 -4
  183. data/test/test_rdoc_rdoc.rb +110 -22
  184. data/test/test_rdoc_ri_driver.rb +415 -80
  185. data/test/test_rdoc_ri_paths.rb +122 -13
  186. data/test/test_rdoc_ruby_lex.rb +5 -61
  187. data/test/test_rdoc_ruby_token.rb +19 -0
  188. data/test/test_rdoc_rubygems_hook.rb +64 -43
  189. data/test/test_rdoc_servlet.rb +429 -0
  190. data/test/test_rdoc_stats.rb +83 -24
  191. data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
  192. data/test/test_rdoc_task.rb +2 -2
  193. data/test/test_rdoc_text.rb +37 -11
  194. data/test/test_rdoc_tom_doc.rb +59 -62
  195. data/test/test_rdoc_top_level.rb +71 -113
  196. data/test/xref_test_case.rb +7 -9
  197. metadata +122 -39
  198. metadata.gz.sig +0 -0
  199. data/CVE-2013-0256.rdoc +0 -49
  200. data/lib/rdoc/markup/attribute.rb +0 -51
@@ -0,0 +1,18 @@
1
+ %% name = RDoc::Markdown::Literals
2
+
3
+ %% header {
4
+ # :markup: markdown
5
+
6
+ ##
7
+ # Provides Literals appropriate for your ruby version.
8
+ #--
9
+ # This set of literals is for ruby 1.8 regular expressions.
10
+ }
11
+
12
+ Alphanumeric = /[0-9A-Za-z\200-\377]/
13
+ AlphanumericAscii = /[A-Za-z0-9]/
14
+ BOM = "\357\273\277"
15
+ Newline = "\n" | "\r" "\n"?
16
+ NonAlphanumeric = /[\000-\057\072-\100\133-\140\173-\177]/
17
+ Spacechar = " " | "\t"
18
+
@@ -0,0 +1,454 @@
1
+ # :markup: markdown
2
+
3
+ ##
4
+ # Provides Literals appropriate for your ruby version.
5
+ #--
6
+ # This set of literals is for ruby 1.8 regular expressions.
7
+ class RDoc::Markdown::Literals
8
+ # :stopdoc:
9
+
10
+ # This is distinct from setup_parser so that a standalone parser
11
+ # can redefine #initialize and still have access to the proper
12
+ # parser setup code.
13
+ def initialize(str, debug=false)
14
+ setup_parser(str, debug)
15
+ end
16
+
17
+
18
+
19
+ # Prepares for parsing +str+. If you define a custom initialize you must
20
+ # call this method before #parse
21
+ def setup_parser(str, debug=false)
22
+ @string = str
23
+ @pos = 0
24
+ @memoizations = Hash.new { |h,k| h[k] = {} }
25
+ @result = nil
26
+ @failed_rule = nil
27
+ @failing_rule_offset = -1
28
+
29
+ setup_foreign_grammar
30
+ end
31
+
32
+ attr_reader :string
33
+ attr_reader :failing_rule_offset
34
+ attr_accessor :result, :pos
35
+
36
+
37
+ def current_column(target=pos)
38
+ if c = string.rindex("\n", target-1)
39
+ return target - c - 1
40
+ end
41
+
42
+ target + 1
43
+ end
44
+
45
+ def current_line(target=pos)
46
+ cur_offset = 0
47
+ cur_line = 0
48
+
49
+ string.each_line do |line|
50
+ cur_line += 1
51
+ cur_offset += line.size
52
+ return cur_line if cur_offset >= target
53
+ end
54
+
55
+ -1
56
+ end
57
+
58
+ def lines
59
+ lines = []
60
+ string.each_line { |l| lines << l }
61
+ lines
62
+ end
63
+
64
+
65
+
66
+ def get_text(start)
67
+ @string[start..@pos-1]
68
+ end
69
+
70
+ def show_pos
71
+ width = 10
72
+ if @pos < width
73
+ "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
74
+ else
75
+ "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
76
+ end
77
+ end
78
+
79
+ def failure_info
80
+ l = current_line @failing_rule_offset
81
+ c = current_column @failing_rule_offset
82
+
83
+ if @failed_rule.kind_of? Symbol
84
+ info = self.class::Rules[@failed_rule]
85
+ "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
86
+ else
87
+ "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
88
+ end
89
+ end
90
+
91
+ def failure_caret
92
+ l = current_line @failing_rule_offset
93
+ c = current_column @failing_rule_offset
94
+
95
+ line = lines[l-1]
96
+ "#{line}\n#{' ' * (c - 1)}^"
97
+ end
98
+
99
+ def failure_character
100
+ l = current_line @failing_rule_offset
101
+ c = current_column @failing_rule_offset
102
+ lines[l-1][c-1, 1]
103
+ end
104
+
105
+ def failure_oneline
106
+ l = current_line @failing_rule_offset
107
+ c = current_column @failing_rule_offset
108
+
109
+ char = lines[l-1][c-1, 1]
110
+
111
+ if @failed_rule.kind_of? Symbol
112
+ info = self.class::Rules[@failed_rule]
113
+ "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
114
+ else
115
+ "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
116
+ end
117
+ end
118
+
119
+ class ParseError < RuntimeError
120
+ end
121
+
122
+ def raise_error
123
+ raise ParseError, failure_oneline
124
+ end
125
+
126
+ def show_error(io=STDOUT)
127
+ error_pos = @failing_rule_offset
128
+ line_no = current_line(error_pos)
129
+ col_no = current_column(error_pos)
130
+
131
+ io.puts "On line #{line_no}, column #{col_no}:"
132
+
133
+ if @failed_rule.kind_of? Symbol
134
+ info = self.class::Rules[@failed_rule]
135
+ io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
136
+ else
137
+ io.puts "Failed to match rule '#{@failed_rule}'"
138
+ end
139
+
140
+ io.puts "Got: #{string[error_pos,1].inspect}"
141
+ line = lines[line_no-1]
142
+ io.puts "=> #{line}"
143
+ io.print(" " * (col_no + 3))
144
+ io.puts "^"
145
+ end
146
+
147
+ def set_failed_rule(name)
148
+ if @pos > @failing_rule_offset
149
+ @failed_rule = name
150
+ @failing_rule_offset = @pos
151
+ end
152
+ end
153
+
154
+ attr_reader :failed_rule
155
+
156
+ def match_string(str)
157
+ len = str.size
158
+ if @string[pos,len] == str
159
+ @pos += len
160
+ return str
161
+ end
162
+
163
+ return nil
164
+ end
165
+
166
+ def scan(reg)
167
+ if m = reg.match(@string[@pos..-1])
168
+ width = m.end(0)
169
+ @pos += width
170
+ return true
171
+ end
172
+
173
+ return nil
174
+ end
175
+
176
+ if "".respond_to? :getbyte
177
+ def get_byte
178
+ if @pos >= @string.size
179
+ return nil
180
+ end
181
+
182
+ s = @string.getbyte @pos
183
+ @pos += 1
184
+ s
185
+ end
186
+ else
187
+ def get_byte
188
+ if @pos >= @string.size
189
+ return nil
190
+ end
191
+
192
+ s = @string[@pos]
193
+ @pos += 1
194
+ s
195
+ end
196
+ end
197
+
198
+ def parse(rule=nil)
199
+ # We invoke the rules indirectly via apply
200
+ # instead of by just calling them as methods because
201
+ # if the rules use left recursion, apply needs to
202
+ # manage that.
203
+
204
+ if !rule
205
+ apply(:_root)
206
+ else
207
+ method = rule.gsub("-","_hyphen_")
208
+ apply :"_#{method}"
209
+ end
210
+ end
211
+
212
+ class MemoEntry
213
+ def initialize(ans, pos)
214
+ @ans = ans
215
+ @pos = pos
216
+ @result = nil
217
+ @set = false
218
+ @left_rec = false
219
+ end
220
+
221
+ attr_reader :ans, :pos, :result, :set
222
+ attr_accessor :left_rec
223
+
224
+ def move!(ans, pos, result)
225
+ @ans = ans
226
+ @pos = pos
227
+ @result = result
228
+ @set = true
229
+ @left_rec = false
230
+ end
231
+ end
232
+
233
+ def external_invoke(other, rule, *args)
234
+ old_pos = @pos
235
+ old_string = @string
236
+
237
+ @pos = other.pos
238
+ @string = other.string
239
+
240
+ begin
241
+ if val = __send__(rule, *args)
242
+ other.pos = @pos
243
+ other.result = @result
244
+ else
245
+ other.set_failed_rule "#{self.class}##{rule}"
246
+ end
247
+ val
248
+ ensure
249
+ @pos = old_pos
250
+ @string = old_string
251
+ end
252
+ end
253
+
254
+ def apply_with_args(rule, *args)
255
+ memo_key = [rule, args]
256
+ if m = @memoizations[memo_key][@pos]
257
+ @pos = m.pos
258
+ if !m.set
259
+ m.left_rec = true
260
+ return nil
261
+ end
262
+
263
+ @result = m.result
264
+
265
+ return m.ans
266
+ else
267
+ m = MemoEntry.new(nil, @pos)
268
+ @memoizations[memo_key][@pos] = m
269
+ start_pos = @pos
270
+
271
+ ans = __send__ rule, *args
272
+
273
+ lr = m.left_rec
274
+
275
+ m.move! ans, @pos, @result
276
+
277
+ # Don't bother trying to grow the left recursion
278
+ # if it's failing straight away (thus there is no seed)
279
+ if ans and lr
280
+ return grow_lr(rule, args, start_pos, m)
281
+ else
282
+ return ans
283
+ end
284
+
285
+ return ans
286
+ end
287
+ end
288
+
289
+ def apply(rule)
290
+ if m = @memoizations[rule][@pos]
291
+ @pos = m.pos
292
+ if !m.set
293
+ m.left_rec = true
294
+ return nil
295
+ end
296
+
297
+ @result = m.result
298
+
299
+ return m.ans
300
+ else
301
+ m = MemoEntry.new(nil, @pos)
302
+ @memoizations[rule][@pos] = m
303
+ start_pos = @pos
304
+
305
+ ans = __send__ rule
306
+
307
+ lr = m.left_rec
308
+
309
+ m.move! ans, @pos, @result
310
+
311
+ # Don't bother trying to grow the left recursion
312
+ # if it's failing straight away (thus there is no seed)
313
+ if ans and lr
314
+ return grow_lr(rule, nil, start_pos, m)
315
+ else
316
+ return ans
317
+ end
318
+
319
+ return ans
320
+ end
321
+ end
322
+
323
+ def grow_lr(rule, args, start_pos, m)
324
+ while true
325
+ @pos = start_pos
326
+ @result = m.result
327
+
328
+ if args
329
+ ans = __send__ rule, *args
330
+ else
331
+ ans = __send__ rule
332
+ end
333
+ return nil unless ans
334
+
335
+ break if @pos <= m.pos
336
+
337
+ m.move! ans, @pos, @result
338
+ end
339
+
340
+ @result = m.result
341
+ @pos = m.pos
342
+ return m.ans
343
+ end
344
+
345
+ class RuleInfo
346
+ def initialize(name, rendered)
347
+ @name = name
348
+ @rendered = rendered
349
+ end
350
+
351
+ attr_reader :name, :rendered
352
+ end
353
+
354
+ def self.rule_info(name, rendered)
355
+ RuleInfo.new(name, rendered)
356
+ end
357
+
358
+
359
+ # :startdoc:
360
+ # :stopdoc:
361
+ def setup_foreign_grammar; end
362
+
363
+ # Alphanumeric = /[0-9A-Za-z\200-\377]/
364
+ def _Alphanumeric
365
+ _tmp = scan(/\A(?-mix:[0-9A-Za-z\200-\377])/)
366
+ set_failed_rule :_Alphanumeric unless _tmp
367
+ return _tmp
368
+ end
369
+
370
+ # AlphanumericAscii = /[A-Za-z0-9]/
371
+ def _AlphanumericAscii
372
+ _tmp = scan(/\A(?-mix:[A-Za-z0-9])/)
373
+ set_failed_rule :_AlphanumericAscii unless _tmp
374
+ return _tmp
375
+ end
376
+
377
+ # BOM = ""
378
+ def _BOM
379
+ _tmp = match_string("\303\257\302\273\302\277")
380
+ set_failed_rule :_BOM unless _tmp
381
+ return _tmp
382
+ end
383
+
384
+ # Newline = ("\n" | "
385
+ def _Newline
386
+
387
+ _save = self.pos
388
+ while true # choice
389
+ _tmp = match_string("\n")
390
+ break if _tmp
391
+ self.pos = _save
392
+
393
+ _save1 = self.pos
394
+ while true # sequence
395
+ _tmp = match_string("\r")
396
+ unless _tmp
397
+ self.pos = _save1
398
+ break
399
+ end
400
+ _save2 = self.pos
401
+ _tmp = match_string("\n")
402
+ unless _tmp
403
+ _tmp = true
404
+ self.pos = _save2
405
+ end
406
+ unless _tmp
407
+ self.pos = _save1
408
+ end
409
+ break
410
+ end # end sequence
411
+
412
+ break if _tmp
413
+ self.pos = _save
414
+ break
415
+ end # end choice
416
+
417
+ set_failed_rule :_Newline unless _tmp
418
+ return _tmp
419
+ end
420
+
421
+ # NonAlphanumeric = /[\000-\057\072-\100\133-\140\173-\177]/
422
+ def _NonAlphanumeric
423
+ _tmp = scan(/\A(?-mix:[\000-\057\072-\100\133-\140\173-\177])/)
424
+ set_failed_rule :_NonAlphanumeric unless _tmp
425
+ return _tmp
426
+ end
427
+
428
+ # Spacechar = (" " | "\t")
429
+ def _Spacechar
430
+
431
+ _save = self.pos
432
+ while true # choice
433
+ _tmp = match_string(" ")
434
+ break if _tmp
435
+ self.pos = _save
436
+ _tmp = match_string("\t")
437
+ break if _tmp
438
+ self.pos = _save
439
+ break
440
+ end # end choice
441
+
442
+ set_failed_rule :_Spacechar unless _tmp
443
+ return _tmp
444
+ end
445
+
446
+ Rules = {}
447
+ Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/[0-9A-Za-z\\200-\\377]/")
448
+ Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/")
449
+ Rules[:_BOM] = rule_info("BOM", "\"\"")
450
+ Rules[:_Newline] = rule_info("Newline", "(\"\\n\" | \"
451
+ Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/[\\000-\\057\\072-\\100\\133-\\140\\173-\\177]/")
452
+ Rules[:_Spacechar] = rule_info("Spacechar", "(\" \" | \"\\t\")")
453
+ # :startdoc:
454
+ end