Class: Antlr4::Runtime::ANTLRFileStream

Inherits:
ANTLRInputStream show all
Defined in:
lib/antlr4/runtime/antlr_file_stream.rb

Constant Summary

Constants inherited from ANTLRInputStream

Antlr4::Runtime::ANTLRInputStream::INITIAL_BUFFER_SIZE, Antlr4::Runtime::ANTLRInputStream::READ_BUFFER_SIZE

Constants inherited from IntStream

IntStream::EOF, IntStream::UNKNOWN_SOURCE_NAME

Instance Method Summary collapse

Methods inherited from IntStream

#consume, #index, #la, #mark, #release, #seek, #size

Constructor Details

#initialize(file_name, encoding) ⇒ ANTLRFileStream

Returns a new instance of ANTLRFileStream



3
4
5
6
# File 'lib/antlr4/runtime/antlr_file_stream.rb', line 3

def initialize(file_name, encoding)
  @file_name = file_name
  load(file_name, encoding)
end

Instance Method Details

#load(file_name, encoding) ⇒ Object



8
9
10
11
# File 'lib/antlr4/runtime/antlr_file_stream.rb', line 8

def load(file_name, encoding)
  data = Utils.read_file(file_name, encoding)
  @n_items = data.length
end

#source_nameObject



13
14
15
# File 'lib/antlr4/runtime/antlr_file_stream.rb', line 13

def source_name
  @file_name
end