Sha256: b31d5524690f5ed728ec8b5792f5c5b62b3d49579dc3aca8aa2ff797509bd63e

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

module Melbourne

  module AST

    # The +and+ operator as in:
    #
    #   a and b
    #
    class And < Node

      # The left-side expression of the +and+ operator
      #
      attr_accessor :left

      # The right-side expression of the +and+ operator
      #
      attr_accessor :right

      def initialize(line, left, right) #:nodoc:
        @line = line
        @left = left
        @right = right
      end

    end

    # The +or+ operator as in:
    #
    #   a or b
    #
    class Or < And

    end

    # The +not+ operator as in:
    #
    #   (not true)
    #
    class Not < Node

      # The value that is negated
      #
      attr_accessor :value

      def initialize(line, value) #:nodoc:
        @line = line
        @value = value
      end

    end

    # TODO: document!
    class OpAssign1 < Node #:nodoc:

      attr_accessor :receiver

      attr_accessor :op

      attr_accessor :index

      attr_accessor :value

      def initialize(line, receiver, index, op, value)
        @line = line
        @receiver = receiver
        @op = op
        @index = index.body
        @value = value
      end

    end

    # TODO: document!
    class OpAssign2 < Node #:nodoc:

      attr_accessor :receiver

      attr_accessor :op

      attr_accessor :name

      attr_accessor :assign

      attr_accessor :value

      def initialize(line, receiver, name, op, value)
        @line = line
        @receiver = receiver
        @name = name
        @op = op
        @value = value
        @assign = name.to_s[-1] == ?= ? name : :"#{name}="
      end

    end

    # TODO: document!
    class OpAssignAnd < Node #:nodoc:

      attr_accessor :left, :right

      def initialize(line, left, right)
        @line = line
        @left = left
        @right = right
      end

    end

    # TODO: document!
    class OpAssignOr < OpAssignAnd #:nodoc:

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
melbourne-1.0.0 lib/melbourne/ast/operators.rb