Sha256: 037e2aeb7915c06e861e8eb18fb286afd23e5ad762d9c8eb92a782227b856851
Contents?: true
Size: 989 Bytes
Versions: 2
Compression:
Stored size: 989 Bytes
Contents
module Sequitur # Namespace dedicated to grammar formatters. module Formatter # Superclass for grammar formatters. class BaseFormatter # The IO output stream in which the formatter's result will be sent. attr(:output) # Constructor. # @param anIO [IO] an output IO where the formatter's result will # be placed. def initialize(anIO) @output = anIO end # Given a grammar or a grammar visitor, perform the visit # and render the visit events in the output stream. # @param aGrmOrVisitor [DynamicGrammar or GrammarVisitor] def render(aGrmOrVisitor) a_visitor = if aGrmOrVisitor.kind_of?(GrammarVisitor) aGrmOrVisitor else aGrmOrVisitor.visitor end a_visitor.subscribe(self) a_visitor.start a_visitor.unsubscribe(self) end end # class end # module end # module # End of file
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sequitur-0.1.19 | lib/sequitur/formatter/base_formatter.rb |
sequitur-0.1.18 | lib/sequitur/formatter/base_formatter.rb |