Class: Code::Parser::LeftOperation

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

Instance Method Summary collapse

Instance Method Details

#operatorObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/code/parser/left_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/left_operation.rb', line 22

def root
  (
    statement.aka(:first) << (
      whitespace? << operator.aka(:operator) << whitespace? <<
        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

#statementObject

Raises:

  • (NotImplementedError)


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

def statement
  raise NotImplementedError
end

#whitespaceObject



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

def whitespace
  Whitespace
end

#whitespace?Boolean

Returns:



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

def whitespace?
  whitespace.maybe
end