Sha256: 610a264bb60ee00778738099d1235f6f9ab175e725302580f58dd9904069788b
Contents?: true
Size: 698 Bytes
Versions: 2
Compression:
Stored size: 698 Bytes
Contents
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) }.compact 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webidl-0.0.3 | lib/webidl/generator.rb |
webidl-0.0.2 | lib/webidl/generator.rb |