Method: ANTLR3::AST::CommonTree#source_range

Defined in:
lib/antlr3/tree.rb

#source_rangeObject



549
550
551
552
553
554
555
556
557
# File 'lib/antlr3/tree.rb', line 549

def source_range
  unknown_boundaries? and infer_boundaries
  tokens = map do | node |
    tk = node.token and tk.index >= 0 ? tk : nil
  end
  tokens.compact!
  first, last = tokens.minmax_by { |t| t.index }
  first.start .. last.stop
end