Sha256: fc417e29c8cd5a15c7db1371dc97548d3dff971c4a3845dffdc5bf4c2a74771a

Contents?: true

Size: 716 Bytes

Versions: 7

Compression:

Stored size: 716 Bytes

Contents

module Lrama
  class Grammar
    class Code
      class NoReferenceCode < Code
        private

        # * ($$) error
        # * (@$) error
        # * ($:$) error
        # * ($1) error
        # * (@1) error
        # * ($:1) error
        def reference_to_c(ref)
          case
          when ref.type == :dollar # $$, $n
            raise "$#{ref.value} can not be used in #{type}."
          when ref.type == :at # @$, @n
            raise "@#{ref.value} can not be used in #{type}."
          when ref.type == :index # $:$, $:n
            raise "$:#{ref.value} can not be used in #{type}."
          else
            raise "Unexpected. #{self}, #{ref}"
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lrama-0.6.9 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.8 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.7 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.6 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.5 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.4 lib/lrama/grammar/code/no_reference_code.rb
lrama-0.6.3 lib/lrama/grammar/code/no_reference_code.rb