Line | |
---|
1 | # Parse a non-source file. We basically take the whole thing
|
---|
2 | # as one big comment. If the first character in the file
|
---|
3 | # is '#', we strip leading pound signs.
|
---|
4 |
|
---|
5 |
|
---|
6 | require "rdoc/code_objects"
|
---|
7 | require "rdoc/markup/simple_markup/preprocess"
|
---|
8 |
|
---|
9 | module RDoc
|
---|
10 | # See rdoc/parsers/parse_c.rb
|
---|
11 |
|
---|
12 | class SimpleParser
|
---|
13 |
|
---|
14 | # prepare to parse a plain file
|
---|
15 | def initialize(top_level, file_name, body, options, stats)
|
---|
16 |
|
---|
17 | preprocess = SM::PreProcess.new(file_name, options.rdoc_include)
|
---|
18 |
|
---|
19 | preprocess.handle(body) do |directive, param|
|
---|
20 | $stderr.puts "Unrecognized directive '#{directive}' in #{file_name}"
|
---|
21 | end
|
---|
22 |
|
---|
23 | @body = body
|
---|
24 | @options = options
|
---|
25 | @top_level = top_level
|
---|
26 | end
|
---|
27 |
|
---|
28 | # Extract the file contents and attach them to the toplevel as a
|
---|
29 | # comment
|
---|
30 |
|
---|
31 | def scan
|
---|
32 | # @body.gsub(/^(\s\n)+/, '')
|
---|
33 | @top_level.comment = remove_private_comments(@body)
|
---|
34 | @top_level
|
---|
35 | end
|
---|
36 |
|
---|
37 | def remove_private_comments(comment)
|
---|
38 | comment.gsub(/^--.*?^\+\+/m, '').sub(/^--.*/m, '')
|
---|
39 | end
|
---|
40 | end
|
---|
41 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.