Class: BabelBridge::TerminalNode
- Defined in:
- lib/nodes/terminal_node.rb
Overview
not subclassed
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Attributes inherited from Node
#delimiter, #many_delimiter, #match_length, #offset, #parent, #parser, #src
Instance Method Summary collapse
-
#initialize(parent, range, pattern) ⇒ TerminalNode
constructor
A new instance of TerminalNode.
- #inspect(options = {}) ⇒ Object
- #matches ⇒ Object
Methods inherited from Node
#column, #init_line_column, #length, #line, #match_range, #node_init, #node_path, #offset_after_match, #on_matched, #onlychildren_list, #parent_list, #path_string, #relative_class_name, #remaining_src, #text, #to_s, #to_sym
Constructor Details
#initialize(parent, range, pattern) ⇒ TerminalNode
Returns a new instance of TerminalNode.
12 13 14 15 16 17 |
# File 'lib/nodes/terminal_node.rb', line 12 def initialize(parent,range,pattern) node_init(parent) self.offset = range.min self.match_length = range.max-range.min self.pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
11 12 13 |
# File 'lib/nodes/terminal_node.rb', line 11 def pattern @pattern end |
Instance Method Details
#inspect(options = {}) ⇒ Object
19 20 21 |
# File 'lib/nodes/terminal_node.rb', line 19 def inspect(={}) "#{text.inspect}" unless ![:verbose] && text[/^\s*$/] # if only show whitespace matches if verbose end |
#matches ⇒ Object
23 |
# File 'lib/nodes/terminal_node.rb', line 23 def matches; []; end |