Class: Sequitur::Formatter::Debug
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Sequitur::Formatter::Debug
- Defined in:
- lib/sequitur/formatter/debug.rb
Overview
A formatter class that can render the notification events from a grammar visitor
Instance Attribute Summary collapse
-
#indentation ⇒ Integer
Current indentation level.
Attributes inherited from BaseFormatter
Instance Method Summary collapse
-
#after_grammar(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#after_non_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#after_production(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#after_rhs(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#after_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#before_grammar(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#before_non_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#before_production(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#before_rhs(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#before_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed.
-
#initialize(anIO) ⇒ Debug
constructor
Constructor.
Methods inherited from BaseFormatter
Constructor Details
#initialize(anIO) ⇒ Debug
Constructor. is written.
22 23 24 25 |
# File 'lib/sequitur/formatter/debug.rb', line 22 def initialize(anIO) super(anIO) @indentation = 0 end |
Instance Attribute Details
#indentation ⇒ Integer
Returns Current indentation level.
17 18 19 |
# File 'lib/sequitur/formatter/debug.rb', line 17 def indentation @indentation end |
Instance Method Details
#after_grammar(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a grammar
108 109 110 111 |
# File 'lib/sequitur/formatter/debug.rb', line 108 def after_grammar(_) dedent output_event(__method__, indentation) end |
#after_non_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a non-terminal symbol from the rhs of a production.
82 83 84 |
# File 'lib/sequitur/formatter/debug.rb', line 82 def after_non_terminal(_) output_event(__method__, indentation) end |
#after_production(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a production
99 100 101 102 |
# File 'lib/sequitur/formatter/debug.rb', line 99 def after_production(_) dedent output_event(__method__, indentation) end |
#after_rhs(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of the rhs of a production
90 91 92 93 |
# File 'lib/sequitur/formatter/debug.rb', line 90 def after_rhs(_) dedent output_event(__method__, indentation) end |
#after_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor completed the visit of a terminal symbol from the rhs of a production
65 66 67 |
# File 'lib/sequitur/formatter/debug.rb', line 65 def after_terminal(_) output_event(__method__, indentation) end |
#before_grammar(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a grammar
30 31 32 33 |
# File 'lib/sequitur/formatter/debug.rb', line 30 def before_grammar(_) output_event(__method__, indentation) indent end |
#before_non_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a non-terminal (= an allusion to a production) in the rhs of a production
74 75 76 |
# File 'lib/sequitur/formatter/debug.rb', line 74 def before_non_terminal(_) output_event(__method__, indentation) end |
#before_production(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a production
39 40 41 42 |
# File 'lib/sequitur/formatter/debug.rb', line 39 def before_production(_) output_event(__method__, indentation) indent end |
#before_rhs(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit the rhs of a production
48 49 50 51 |
# File 'lib/sequitur/formatter/debug.rb', line 48 def before_rhs(_) output_event(__method__, indentation) indent end |
#before_terminal(_) ⇒ Object
Method called by a GrammarVisitor to which the formatter subscribed. Notification of a visit event: the visitor is about to visit a terminal symbol from the rhs of a production
57 58 59 |
# File 'lib/sequitur/formatter/debug.rb', line 57 def before_terminal(_) output_event(__method__, indentation) end |