Method: ANTLR3::StringStream#look

Defined in:
lib/antlr3/streams.rb,
lib/antlr3/streams.rb

#look(k = 1) ⇒ Object Also known as: >>

identical to #peek, except it returns the character value as a String



411
412
413
414
415
416
417
418
419
# File 'lib/antlr3/streams.rb', line 411

def look( k = 1 )               # for 1.9
  k == 0 and return nil
  k += 1 if k < 0
  
  index = @position + k - 1
  index < 0 and return nil
  
  @string[ index ]
end