Class: Keisan::Tokens::BitwiseOperator
- Inherits:
-
Operator
- Object
- Keisan::Token
- Operator
- Keisan::Tokens::BitwiseOperator
- Defined in:
- lib/keisan/tokens/bitwise_operator.rb
Constant Summary collapse
- AND =
/(?:\&)/- OR =
/(?:\|)/- XOR =
/(?:\^)/- NOT =
/(?:\~+)/- REGEX =
/(#{AND}|#{OR}|#{XOR}|#{NOT})/
Instance Attribute Summary
Attributes inherited from Keisan::Token
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Operator
Methods inherited from Keisan::Token
#initialize, #regex, #type, type
Constructor Details
This class inherits a constructor from Keisan::Token
Class Method Details
.regex ⇒ Object
11 12 13 |
# File 'lib/keisan/tokens/bitwise_operator.rb', line 11 def self.regex REGEX end |
Instance Method Details
#operator_type ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/keisan/tokens/bitwise_operator.rb', line 15 def operator_type case string when AND :"&" when OR :"|" when XOR :"^" when NOT string.count("~").even? ? :"~~" : :"~" end end |