Method: Antlr4::Runtime::CodePointCharStream#la

Defined in:
lib/antlr4/runtime/code_point_char_stream.rb

#la(i) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/antlr4/runtime/code_point_char_stream.rb', line 28

def la(i)
  case Integer.signum(i)
  when -1
    offset = @position + i
    return IntStream::EOF if offset < 0

    return @byte_array[offset] & 0xFF
  when 0
    # Undefined
    return 0
  when 1
    offset = @position + i - 1
    return IntStream::EOF if offset >= @size

    return @byte_array[offset] & 0xFF
  else
    # type code here
  end
  raise UnsupportedOperationException, 'Not reached'
end