Class: Collie::AST::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/collie/ast.rb

Overview

Location information for source code elements

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file:, line:, column:, length: 0) ⇒ Location

Returns a new instance of Location.



9
10
11
12
13
14
# File 'lib/collie/ast.rb', line 9

def initialize(file:, line:, column:, length: 0)
  @file = file
  @line = line
  @column = column
  @length = length
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



7
8
9
# File 'lib/collie/ast.rb', line 7

def column
  @column
end

#fileObject

Returns the value of attribute file.



7
8
9
# File 'lib/collie/ast.rb', line 7

def file
  @file
end

#lengthObject

Returns the value of attribute length.



7
8
9
# File 'lib/collie/ast.rb', line 7

def length
  @length
end

#lineObject

Returns the value of attribute line.



7
8
9
# File 'lib/collie/ast.rb', line 7

def line
  @line
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/collie/ast.rb', line 16

def to_s
  "#{file}:#{line}:#{column}"
end