Class: Treetop::Runtime::CompiledParser
- Inherits:
-
Object
- Object
- Treetop::Runtime::CompiledParser
- Defined in:
- lib/idl.rb
Overview
open up Treetop::Runtime::CompiledParser and add a few utility functions so we can track where the code is coming from
Instance Attribute Summary collapse
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
Instance Method Summary collapse
-
#instantiate_node(node_type, *args) ⇒ Object
override instatiate_node so we can set the input file.
-
#orig_instantiate_node ⇒ Object
alias instantiate_node so we can call it from the override.
- #set_input_file(filename, starting_line = 0) ⇒ Object
Instance Attribute Details
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
10 11 12 |
# File 'lib/idl.rb', line 10 def input_file @input_file end |
Instance Method Details
#instantiate_node(node_type, *args) ⇒ Object
override instatiate_node so we can set the input file
21 22 23 24 25 |
# File 'lib/idl.rb', line 21 def instantiate_node(node_type, *args) node = orig_instantiate_node(node_type, *args) node.set_input_file(input_file, @starting_line.nil? ? 0 : @starting_line) node end |
#orig_instantiate_node ⇒ Object
alias instantiate_node so we can call it from the override
18 |
# File 'lib/idl.rb', line 18 alias orig_instantiate_node instantiate_node |
#set_input_file(filename, starting_line = 0) ⇒ Object
12 13 14 15 |
# File 'lib/idl.rb', line 12 def set_input_file(filename, starting_line = 0) @input_file = filename @starting_line = starting_line end |