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 ⇒ Object
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.
23 24 25 26 |
# File 'lib/sequitur/formatter/debug.rb', line 23 def initialize(anIO) super(anIO) @indentation = 0 end |
Instance Attribute Details
#indentation ⇒ Object
Current indentation level
18 19 20 |
# File 'lib/sequitur/formatter/debug.rb', line 18 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
107 108 109 110 |
# File 'lib/sequitur/formatter/debug.rb', line 107 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.
83 84 85 |
# File 'lib/sequitur/formatter/debug.rb', line 83 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
91 92 93 94 |
# File 'lib/sequitur/formatter/debug.rb', line 91 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
66 67 68 |
# File 'lib/sequitur/formatter/debug.rb', line 66 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
31 32 33 34 |
# File 'lib/sequitur/formatter/debug.rb', line 31 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
75 76 77 |
# File 'lib/sequitur/formatter/debug.rb', line 75 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
40 41 42 43 |
# File 'lib/sequitur/formatter/debug.rb', line 40 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
49 50 51 52 |
# File 'lib/sequitur/formatter/debug.rb', line 49 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
58 59 60 |
# File 'lib/sequitur/formatter/debug.rb', line 58 def before_terminal(_) output_event(__method__, indentation) end |