Method: ANTLR3::InteractiveStringStream#initialize

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

#initialize(options = {}, &block) ⇒ InteractiveStringStream

creates a new StringStream object where data is the string data to stream. accepts the following options in a symbol-to-value hash:

:file or :name

the (file) name to associate with the stream; default: '(string)'

:line

the initial line number; default: 1

:column

the initial column number; default: 0



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/antlr3/streams/interactive.rb', line 24

def initialize( options = {}, &block )      # for 1.9
  @string = ''
  @data   = []
  @position = options.fetch :position, 0
  @line     = options.fetch :line, 1
  @column   = options.fetch :column, 0
  @markers  = []
  mark
  @initialized = @eof = false
  @readline = block or raise( ArgumentError, "no line-reading block was provided" )
  @name ||= options[ :file ] || options[ :name ] || '(interactive)'
end