Class: RLTK::StreamPosition

Inherits:
Object
  • Object
show all
Defined in:
lib/rltk/token.rb

Overview

The StreamPosition class is used to indicate the position of a token or other text inside a stream.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (StreamPosition) initialize(stream_offset = 0, line_number = 0, line_offset = 0, length = 0, file_name = nil)

Instantiates a new StreamPosition object with the values specified.



38
39
40
41
42
43
44
# File 'lib/rltk/token.rb', line 38

def initialize(stream_offset = 0, line_number = 0, line_offset = 0, length = 0, file_name = nil)
	@stream_offset	= stream_offset
	@line_number	= line_number
	@line_offset	= line_offset
	@length		= length
	@file_name	= file_name
end

Instance Attribute Details

- (String) file_name



27
28
29
# File 'lib/rltk/token.rb', line 27

def file_name
  @file_name
end

- (Integer) length



24
25
26
# File 'lib/rltk/token.rb', line 24

def length
  @length
end

- (Integer) line_number



18
19
20
# File 'lib/rltk/token.rb', line 18

def line_number
  @line_number
end

- (Integer) line_offset Also known as: start



21
22
23
# File 'lib/rltk/token.rb', line 21

def line_offset
  @line_offset
end

- (Integer) stream_offset



15
16
17
# File 'lib/rltk/token.rb', line 15

def stream_offset
  @stream_offset
end