Sha256: 6f9e99a6f5fe705fb3128f39fcd4acffb45f7aec33f476725e20cf34442aba92

Contents?: true

Size: 837 Bytes

Versions: 5

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

class Code
  class Parser
    class RightOperation < 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(:left) << (
            whitespace? << operator.aka(:operator) << whitespace? <<
              right_statement.aka(:right)
          ).maybe
        )
          .aka(:right_operation)
          .then do |output|
            if output[:right_operation][:right]
              output
            else
              output[:right_operation][:left]
            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/right_operation.rb
code-ruby-0.10.3 lib/code/parser/right_operation.rb
code-ruby-0.10.2 lib/code/parser/right_operation.rb
code-ruby-0.10.1 lib/code/parser/right_operation.rb
code-ruby-0.10.0 lib/code/parser/right_operation.rb