Class: Rley::Syntax::SymbolSeq

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rley/syntax/symbol_seq.rb

Overview

A symbol sequence is a suite of grammar symbols

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theSymbols) ⇒ SymbolSeq

Returns a new instance of SymbolSeq.



13
14
15
# File 'lib/rley/syntax/symbol_seq.rb', line 13

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

Instance Attribute Details

#membersObject (readonly)

The sequence of symbols



11
12
13
# File 'lib/rley/syntax/symbol_seq.rb', line 11

def members
  @members
end

Instance Method Details

#==(other) ⇒ Object

Equality operator.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rley/syntax/symbol_seq.rb', line 18

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}"
      raise StandardError, msg
  end

  return result
end