Sha256: 7c3de09c0e9ad6ca1d5ed0a53bf8bf9a7f035fe8e0f301a62d15c4cf51f70fbd

Contents?: true

Size: 730 Bytes

Versions: 22

Compression:

Stored size: 730 Bytes

Contents

module Lrama
  class State
    class Reduce
      # https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html
      attr_reader :item, :look_ahead, :not_selected_symbols
      attr_accessor :default_reduction

      def initialize(item)
        @item = item
        @look_ahead = nil
        @not_selected_symbols = []
      end

      def rule
        @item.rule
      end

      def look_ahead=(look_ahead)
        @look_ahead = look_ahead.freeze
      end

      def add_not_selected_symbol(sym)
        @not_selected_symbols << sym
      end

      def selected_look_ahead
        if @look_ahead
          @look_ahead - @not_selected_symbols
        else
          []
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
lrama-0.6.9 lib/lrama/state/reduce.rb
lrama-0.6.8 lib/lrama/state/reduce.rb
lrama-0.6.7 lib/lrama/state/reduce.rb
lrama-0.6.6 lib/lrama/state/reduce.rb
lrama-0.6.5 lib/lrama/state/reduce.rb
lrama-0.6.4 lib/lrama/state/reduce.rb
lrama-0.6.3 lib/lrama/state/reduce.rb
lrama-0.6.2 lib/lrama/state/reduce.rb
lrama-0.6.1 lib/lrama/state/reduce.rb
lrama-0.6.0 lib/lrama/state/reduce.rb
lrama-0.5.12 lib/lrama/state/reduce.rb
lrama-0.5.11 lib/lrama/state/reduce.rb
lrama-0.5.10 lib/lrama/state/reduce.rb
lrama-0.5.9 lib/lrama/state/reduce.rb
lrama-0.5.8 lib/lrama/state/reduce.rb
lrama-0.5.7 lib/lrama/state/reduce.rb
lrama-0.5.6 lib/lrama/state/reduce.rb
lrama-0.5.5 lib/lrama/state/reduce.rb
lrama-0.5.4 lib/lrama/state/reduce.rb
lrama-0.5.3 lib/lrama/state/reduce.rb