Class | WadlerExample::Tree
In: | prettyprint.rb
Parent: | Object

### Methods

altshow new show

### Public Class methods

new(string, *children)

[Source]

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

### Public Instance methods

altshow(q)

[Source]

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

show(q)

[Source]

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

[Validate]