Sha256: 4916759eef6d7464b1d36f42e075082cc3ac730305c675ed96b26d3ae4a7541e

Contents?: true

Size: 863 Bytes

Versions: 5

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

class Code
  class Parser
    class LeftOperation < Language
      def statement
        raise NotImplementedError
      end

      def whitespace
        Whitespace
      end

      def whitespace?
        whitespace.maybe
      end

      def operator
        raise NotImplementedError
      end

      def right_statement
        Statement
      end

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
code-ruby-0.10.4 lib/code/parser/left_operation.rb
code-ruby-0.10.3 lib/code/parser/left_operation.rb
code-ruby-0.10.2 lib/code/parser/left_operation.rb
code-ruby-0.10.1 lib/code/parser/left_operation.rb
code-ruby-0.10.0 lib/code/parser/left_operation.rb