Class: Treetop::Runtime::CompiledParser

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#input_fileObject (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_nodeObject

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