Sha256: c464177bc9b416e6bcf8195e8751fe1768929db631f7050cf0db12fc6a2b5f1e

Contents?: true

Size: 439 Bytes

Versions: 8

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

module Preval
  class Parser < Ripper::SexpBuilder
    def self.parse(source)
      new(source).parse
    end

    private

    SCANNER_EVENTS.each do |event|
      define_method(:"on_#{event}") do |token|
        Node.new(:"@#{event}", token, true)
      end
    end

    PARSER_EVENTS.each do |event|
      define_method(:"on_#{event}") do |*args|
        Node.new(event, args)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
preval-0.6.1 lib/preval/parser.rb
preval-0.6.0 lib/preval/parser.rb
preval-0.5.0 lib/preval/parser.rb
preval-0.4.1 lib/preval/parser.rb
preval-0.4.0 lib/preval/parser.rb
preval-0.3.0 lib/preval/parser.rb
preval-0.2.0 lib/preval/parser.rb
preval-0.1.0 lib/preval/parser.rb