Class: Code::Parser::RightOperation

Inherits:
Language
  • Object
show all
Defined in:
lib/code/parser/right_operation.rb

Direct Known Subclasses

Equal, IfModifier, Power, Rescue

Instance Method Summary collapse

Instance Method Details

#operatorObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/code/parser/right_operation.rb', line 18

def operator
  raise NotImplementedError
end

#rootObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/code/parser/right_operation.rb', line 22

def root
  (
    statement.aka(:left) << (
      whitespace? << operator.aka(:operator) << whitespace? <<
        self.class.aka(:right)
    ).maybe
  )
    .aka(:right_operation)
    .then do |output|
      if output[:right_operation][:right]
        output
      else
        output[:right_operation][:left]
      end
    end
end

#statementObject

Raises:

  • (NotImplementedError)


6
7
8
# File 'lib/code/parser/right_operation.rb', line 6

def statement
  raise NotImplementedError
end

#whitespaceObject



10
11
12
# File 'lib/code/parser/right_operation.rb', line 10

def whitespace
  Whitespace
end

#whitespace?Boolean

Returns:



14
15
16
# File 'lib/code/parser/right_operation.rb', line 14

def whitespace?
  whitespace.maybe
end