Sha256: 4d90edd686937a4cc7643dd409f48c87183fd5cec87bc91518e188c7b2070684
Contents?: true
Size: 735 Bytes
Versions: 1
Compression:
Stored size: 735 Bytes
Contents
require "webidl/generator/ruby_sexp_visitor" module WebIDL class Generator class ParseError < StandardError; end def initialize(visitor = nil) @visitor = visitor end def generate(str) parse_tree = parser.parse(str) if parse_tree.nil? raise ParseError, parser.failure_reason end ast_defs = parse_tree.build strings = ast_defs.map { |definition| ruby2ruby.process definition.accept(visitor) } strings.join("\n\n") end private def ruby2ruby @ruby2ruby ||= Ruby2Ruby.new end def parser @parser ||= WebIDL::Parser::IDLParser.new end def visitor @visitor ||= RubySexpVisitor.new end end # Generator end # WebIDL
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webidl-0.0.1 | lib/webidl/generator.rb |