Class: Keisan::Tokens::BitwiseShift

Inherits:
Operator show all
Defined in:
lib/keisan/tokens/bitwise_shift.rb

Constant Summary collapse

LEFT_SHIFT =
/(?:<<)/
RIGHT_SHIFT =
/(?:>>)/
REGEX =
/(#{LEFT_SHIFT}|#{RIGHT_SHIFT})/

Instance Attribute Summary

Attributes inherited from Keisan::Token

#string

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

#type

Methods inherited from Keisan::Token

#initialize, #regex, #type, type

Constructor Details

This class inherits a constructor from Keisan::Token

Class Method Details

.regexObject



9
10
11
# File 'lib/keisan/tokens/bitwise_shift.rb', line 9

def self.regex
  REGEX
end

Instance Method Details

#operator_typeObject



13
14
15
16
17
18
19
20
# File 'lib/keisan/tokens/bitwise_shift.rb', line 13

def operator_type
  case string
  when LEFT_SHIFT
    :<<
  when RIGHT_SHIFT
    :>>
  end
end