Class: Racc::SourceText

Inherits:
Object show all
Defined in:
lib/racc/sourcetext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, filename, lineno) ⇒ SourceText

Returns a new instance of SourceText.



16
17
18
19
20
# File 'lib/racc/sourcetext.rb', line 16

def initialize(text, filename, lineno)
  @text = text
  @filename = filename
  @lineno = lineno
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



23
24
25
# File 'lib/racc/sourcetext.rb', line 23

def filename
  @filename
end

#linenoObject (readonly)

Returns the value of attribute lineno.



24
25
26
# File 'lib/racc/sourcetext.rb', line 24

def lineno
  @lineno
end

#textObject (readonly)

Returns the value of attribute text.



22
23
24
# File 'lib/racc/sourcetext.rb', line 22

def text
  @text
end

Instance Method Details

#locationObject



30
31
32
# File 'lib/racc/sourcetext.rb', line 30

def location
  "#{@filename}:#{@lineno}"
end

#to_sObject



26
27
28
# File 'lib/racc/sourcetext.rb', line 26

def to_s
  "#<SourceText #{location()}>"
end