Sha256: 541efc3c32e4dfd82c7dd3dd4c761ef8b94cdbf825124f7c3fee0fa30e33fe73

Contents?: true

Size: 607 Bytes

Versions: 4

Compression:

Stored size: 607 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

require "yoga/parser/helpers"

module Yoga
  # A parsing helper.
  #
  # This uses the `@tokens` and `@_root` instance variables.
  module Parser
    # Initialize the parser.
    #
    # @param tokens [::Enumerable<Yoga::Token>]
    def initialize(tokens)
      @tokens = tokens
    end

    # Performs the parsing.
    #
    # @return [Yoga::Node]
    def call
      @_root ||= parse_root
    end

    # Internal ruby construct.
    #
    # @private
    # @api private
    def self.included(base)
      base.send :include, Parser::Helpers
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoga-0.3.2 lib/yoga/parser.rb
yoga-0.3.0 lib/yoga/parser.rb
yoga-0.2.1 lib/yoga/parser.rb
yoga-0.2.0 lib/yoga/parser.rb