Class: Rley::Formatter::Debug
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Rley::Formatter::Debug
- Defined in:
- lib/rley/formatter/debug.rb
Overview
A formatter class that renders the visit notification events from a parse tree visitor
Instance Attribute Summary collapse
-
#indentation ⇒ Object
readonly
Current indentation level.
Attributes inherited from BaseFormatter
Instance Method Summary collapse
-
#after_non_terminal(_nonterm) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#after_ptree(_ptree) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#after_subnodes(_parent, _children) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#after_terminal(_term) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#before_non_terminal(_nonterm) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#before_ptree(_ptree) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#before_subnodes(_parent, _children) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#before_terminal(_term) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed.
-
#initialize(anIO) ⇒ Debug
constructor
Constructor.
Methods inherited from BaseFormatter
Constructor Details
#initialize(anIO) ⇒ Debug
Constructor. is written.
16 17 18 19 |
# File 'lib/rley/formatter/debug.rb', line 16 def initialize(anIO) super(anIO) @indentation = 0 end |
Instance Attribute Details
#indentation ⇒ Object (readonly)
Current indentation level
11 12 13 |
# File 'lib/rley/formatter/debug.rb', line 11 def indentation @indentation end |
Instance Method Details
#after_non_terminal(_nonterm) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a non-terminal node
69 70 71 72 |
# File 'lib/rley/formatter/debug.rb', line 69 def after_non_terminal(_nonterm) dedent output_event(__method__, indentation) end |
#after_ptree(_ptree) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of the given parse tree
89 90 91 92 |
# File 'lib/rley/formatter/debug.rb', line 89 def after_ptree(_ptree) dedent output_event(__method__, indentation) end |
#after_subnodes(_parent, _children) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of the children of a non-terminal node.
79 80 81 82 |
# File 'lib/rley/formatter/debug.rb', line 79 def after_subnodes(_parent, _children) dedent output_event(__method__, indentation) end |
#after_terminal(_term) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a terminal node.
61 62 63 |
# File 'lib/rley/formatter/debug.rb', line 61 def after_terminal(_term) output_event(__method__, indentation) end |
#before_non_terminal(_nonterm) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a non-terminal node
34 35 36 37 |
# File 'lib/rley/formatter/debug.rb', line 34 def before_non_terminal(_nonterm) output_event(__method__, indentation) indent end |
#before_ptree(_ptree) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit the given parse tree
25 26 27 28 |
# File 'lib/rley/formatter/debug.rb', line 25 def before_ptree(_ptree) output_event(__method__, indentation) indent end |
#before_subnodes(_parent, _children) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit the children of a non-terminal node
44 45 46 47 |
# File 'lib/rley/formatter/debug.rb', line 44 def before_subnodes(_parent, _children) output_event(__method__, indentation) indent end |
#before_terminal(_term) ⇒ Object
Method called by a ParseTreeVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a terminal node
53 54 55 |
# File 'lib/rley/formatter/debug.rb', line 53 def before_terminal(_term) output_event(__method__, indentation) end |