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.



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

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

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

#linenoObject (readonly)

Returns the value of attribute lineno.



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

def lineno
  @lineno
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#locationObject



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

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

#to_sObject



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

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