Class: Keisan::Tokens::Assignment
Constant Summary
collapse
- REGEX =
/(
(?: # possible compound operators in front of equals
\|\| |
\&\& |
\*\* |
\+ |
\- |
\* |
\/ |
\% |
\& |
\| |
\^
)?
\=
(?!\=) # negative lookahead to prevent matching ==
)/x
Instance Attribute Summary
#string
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Operator
#type
#initialize, #regex, #type, type
Constructor Details
This class inherits a constructor from Keisan::Token
Class Method Details
.regex ⇒ Object
22
23
24
|
# File 'lib/keisan/tokens/assignment.rb', line 22
def self.regex
REGEX
end
|
Instance Method Details
#compound_operator ⇒ Object
30
31
32
|
# File 'lib/keisan/tokens/assignment.rb', line 30
def compound_operator
string[0] == "=" ? nil : string[0...-1].to_sym
end
|
#operator_type ⇒ Object
26
27
28
|
# File 'lib/keisan/tokens/assignment.rb', line 26
def operator_type
:"="
end
|