WadlerExample::Tree (Class)

In: prettyprint.rb
Parent: Object

Methods

altshow   new   show  

Public Class methods

[Source]

# File prettyprint.rb, line 593
      def initialize(string, *children)
        @string = string
        @children = children
      end

Public Instance methods

[Source]

# File prettyprint.rb, line 598
      def show(pp)
        pp.group {
          pp.text @string
          pp.nest(@string.length) {
            unless @children.empty?
              pp.text '['
              pp.nest(1) {
                first = true
                @children.each {|t|
                  if first
                    first = false
                  else
                    pp.text ','
                    pp.breakable
                  end
                  t.show(pp)
                }
              }
              pp.text ']'
            end
          }
        }
      end

[Source]

# File prettyprint.rb, line 622
      def altshow(pp)
        pp.group {
          pp.text @string
          unless @children.empty?
            pp.text '['
            pp.nest(2) {
              pp.breakable
              first = true
              @children.each {|t|
                if first
                  first = false
                else
                  pp.text ','
                  pp.breakable
                end
                t.altshow(pp)
              }
            }
            pp.breakable
            pp.text ']'
          end
        }
      end

[Validate]