module Opal::Parser::DefaultConfig

Public Class Methods

included(klass) click to toggle source
# File lib/opal/parser/default_config.rb, line 18
def self.included(klass)
  klass.extend(ClassMethods)
  klass.diagnostics_consumer = ->(diagnostic) do
    if RUBY_ENGINE != 'opal'
      $stderr.puts(diagnostic.render)
    end
  end
end
new(*) click to toggle source
Calls superclass method
# File lib/opal/parser/default_config.rb, line 27
def initialize(*)
  super(Opal::AST::Builder.new)
end

Public Instance Methods

parse(source_buffer) click to toggle source
Calls superclass method
# File lib/opal/parser/default_config.rb, line 31
def parse(source_buffer)
  parsed = super || ::Opal::AST::Node.new(:nil)
  wrapped = ::Opal::AST::Node.new(:top, [parsed])
  rewriten = rewrite(wrapped)
  rewriten
end
rewrite(node) click to toggle source
# File lib/opal/parser/default_config.rb, line 38
def rewrite(node)
  Opal::Rewriter.new(node).process
end