Methods

Class/Module Index [+]

Quicksearch

Rabbit::Parser::RD

Constants

SNIPPET_SIZE

Public Class Methods

match?(source) click to toggle source
# File lib/rabbit/parser/rd.rb, line 19
def match?(source)
  extension = source.extension
  if extension.nil?
    head = source.read[0, 500]
    if head.respond_to?(:force_encoding)
      head.force_encoding("ASCII-8BIT")
    end
    /^= /.match(head)
  else
    /\A(?:rd|rab|rbt)\z/ =~ extension
  end
end

Public Instance Methods

parse() click to toggle source
# File lib/rabbit/parser/rd.rb, line 33
def parse
  source = @source.read.gsub(/\r\n/, "\n")
  source = "=begin\n#{source}\n=end\n"
  tree = ::RD::RDTree.new(source)
  visitor = RD2RabbitVisitor.new(@canvas)
  visitor.visit(tree)
rescue Racc::ParseError
  message = format_parse_error_message($!.message, source)
  raise ParseError.new, message, $@
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.