Sha256: 5d2f740a3fe62d319369439e9b006aaa125a60af352355c577729f132d5de4ea

Contents?: true

Size: 909 Bytes

Versions: 33

Compression:

Stored size: 909 Bytes

Contents

require 'forwardable'

module Rley # This module is used as a namespace
  module Syntax # This module is used as a namespace
    # A symbol sequence is a suite of grammar symbols
    class SymbolSeq
      extend Forwardable
      def_delegators :@members, :empty?, :size, :[], :each, :find, :map

      # The sequence of symbols
      attr_reader(:members)

      def initialize(theSymbols)
        @members = theSymbols.dup
      end

      # Equality operator.
      def ==(other)
        return true if other.object_id == object_id

        case other
          when SymbolSeq then result = other.members == members
          when Array then result = other == members
          else
            msg = "Cannot compare a SymbolSeq with a #{other.class}"
            fail StandardError, msg
        end

        return result
      end
      
      
    end # class
  end # module
end # module

# End of file

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
rley-0.3.04 lib/rley/syntax/symbol_seq.rb
rley-0.3.01 lib/rley/syntax/symbol_seq.rb
rley-0.3.00 lib/rley/syntax/symbol_seq.rb
rley-0.2.15 lib/rley/syntax/symbol_seq.rb
rley-0.2.14 lib/rley/syntax/symbol_seq.rb
rley-0.2.12 lib/rley/syntax/symbol_seq.rb
rley-0.2.11 lib/rley/syntax/symbol_seq.rb
rley-0.2.10 lib/rley/syntax/symbol_seq.rb
rley-0.2.09 lib/rley/syntax/symbol_seq.rb
rley-0.2.08 lib/rley/syntax/symbol_seq.rb
rley-0.2.06 lib/rley/syntax/symbol_seq.rb
rley-0.2.05 lib/rley/syntax/symbol_seq.rb
rley-0.2.04 lib/rley/syntax/symbol_seq.rb
rley-0.2.03 lib/rley/syntax/symbol_seq.rb
rley-0.2.02 lib/rley/syntax/symbol_seq.rb
rley-0.2.01 lib/rley/syntax/symbol_seq.rb
rley-0.2.00 lib/rley/syntax/symbol_seq.rb
rley-0.1.12 lib/rley/syntax/symbol_seq.rb
rley-0.1.11 lib/rley/syntax/symbol_seq.rb
rley-0.1.10 lib/rley/syntax/symbol_seq.rb