Class Parslet::Parser::PrettyPrinter
In: lib/parslet/export.rb
Parent: Object

A helper class that formats Citrus and Treetop grammars as a string.

Methods

deferred   mangle_name   new   pretty_print   rule  

Attributes

visitor  [R] 

Public Class methods

Public Instance methods

Whenever the visitor encounters an rule in a parslet, it defers the pretty printing of the rule by calling this method.

Mangles names so that Citrus and Treetop can live with it. This mostly transforms some of the things that Ruby allows into other patterns. If there is collision, we will not detect it for now.

Pretty prints the given parslet using the visitor that has been configured in initialize. Returns the string representation of the Citrus or Treetop grammar.

Formats a rule in either dialect.

[Validate]