Sha256: 7c198abcda10f1d64a57b3a72b9d6fd5556e71c2dbaea1bd43f8a3511b5c5af8
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rockit-0.7.1 | lib/rockit/prettyprint/box.rb |