Class: Code::Parser::LeftOperation
- Inherits:
-
Language
- Object
- Language
- Code::Parser::LeftOperation
show all
- Defined in:
- lib/code/parser/left_operation.rb
Direct Known Subclasses
Addition, AndOperator, BitwiseAnd, BitwiseOr, ChainedCall, Equality, Greater, Multiplication, OrKeyword, OrOperator, Range, Shift
Instance Method Summary
collapse
Instance Method Details
18
19
20
|
# File 'lib/code/parser/left_operation.rb', line 18
def operator
str("")
end
|
#right_statement ⇒ Object
22
23
24
|
# File 'lib/code/parser/left_operation.rb', line 22
def right_statement
Statement
end
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/code/parser/left_operation.rb', line 26
def root
(
statement.aka(:first) << (
whitespace? << operator.aka(:operator) << whitespace? <<
right_statement.aka(:statement)
).repeat(1).aka(:others).maybe
)
.aka(:left_operation)
.then do |output|
if output[:left_operation][:others]
output
else
output[:left_operation][:first]
end
end
end
|
#statement ⇒ Object
6
7
8
|
# File 'lib/code/parser/left_operation.rb', line 6
def statement
Statement
end
|
#whitespace ⇒ Object
10
11
12
|
# File 'lib/code/parser/left_operation.rb', line 10
def whitespace
Whitespace
end
|
#whitespace? ⇒ Boolean
14
15
16
|
# File 'lib/code/parser/left_operation.rb', line 14
def whitespace?
whitespace.maybe
end
|