# A Formatting Language similar to BOX described in # [vandenbrand1996a] and [dejonge2003a] # module Rockit module PrettyPrint module Box # An element of the Box language class Term end # H formats its elements horizontally with a given number of spaces # in between. class H < Term attr_reader :num_hdelims, :elements def initialize(numHorizontalDelims = 1, *elements) @num_hdelims = numHdelims @elements = elements end end # H formats its elements horizontally with a given number of spaces # in between. class V < Term attr_reader :elements def initialize(*elements) @elements = elements end end # Epsilon is a H operator with no spaces in between class Epsilon < H def initialize(*elements) super(0, *elements) end end end end end require 'rockit/prettyprint/text_renderer' # We must do the def's below after requiring the text_renderer # since there is a circular dependency between the definitions. module Rockit module PrettyPrint module Box class Term def render render_on(Box::TextRenderer.new) end def render_on(renderer) renderer.render(self) end end end end end