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
24
25
26
|
# File 'lib/keisan/tokens/assignment.rb', line 24
def self.regex
REGEX
end
|
Instance Method Details
#compound_operator ⇒ Object
32
33
34
|
# File 'lib/keisan/tokens/assignment.rb', line 32
def compound_operator
string[0] == "=" ? nil : string[0...-1].to_sym
end
|
#operator_type ⇒ Object
28
29
30
|
# File 'lib/keisan/tokens/assignment.rb', line 28
def operator_type
:"="
end
|