Method: ANTLR3::StringStream#initialize
- Defined in:
-
lib/antlr3/streams.rb,
lib/antlr3/streams.rb
creates a new StringStream object where data is the string data to stream. accepts the following options in a symbol-to-value hash:
the (file) name to associate with the stream; default: '(string)'
the initial line number; default: 1
the initial column number; default: 0
397 398 399 400 401 402 403 404 405 406 |
# File 'lib/antlr3/streams.rb', line 397 def initialize( data, = {} ) # for 1.9 @string = data.to_s.encode( Encoding::UTF_8 ).freeze @data = @string.codepoints.to_a.freeze @position = .fetch :position, 0 @line = .fetch :line, 1 @column = .fetch :column, 0 @markers = [] @name ||= [ :file ] || [ :name ] # || '(string)' mark end |