Module: HAProxy::Treetop

Extended by:
Treetop
Included in:
Treetop
Defined in:
lib/haproxy/treetop/nodes.rb

Defined Under Namespace

Modules: ConfigBlockContainer, OptionalValueElement, ServerContainer, ServiceAddressContainer, StrippedTextContent Classes: BackendHeader, BackendSection, BlankLine, Char, CommentLine, CommentText, ConfigBlock, ConfigLine, ConfigurationFile, DefaultsHeader, DefaultsSection, FrontendHeader, FrontendSection, GlobalHeader, GlobalSection, Host, Keyword, LineBreak, ListenHeader, ListenSection, OptionLine, Port, ProxyName, ServerLine, ServerName, ServiceAddress, UserlistHeader, UserlistSection, Value, Whitespace

Instance Method Summary collapse

Instance Method Details



203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/haproxy/treetop/nodes.rb', line 203

def print_node(e, depth, options = nil)
  options ||= {}
  options = {:max_depth => 2}.merge(options)

  puts if depth == 0
  print "--" * depth
  print " #{e.class.name.split('::').last}"
  print " [#{e.text_value}]" if e.class == ::Treetop::Runtime::SyntaxNode
  print " [#{e.content}]" if e.respond_to? :content
  puts
  e.elements.each do |child|
    print_node(child, depth + 1, options)
  end if depth < options[:max_depth] && e.elements && !e.respond_to?(:content)
end