summaryrefslogtreecommitdiff
path: root/lib/racc/sourcetext.rb
blob: b33ba292916fb01ae07ce2bb2614b71ebc974054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# $Id: 3b2d89d9ada2f5fcb043837dcc5c9631856d5b70 $
#
# Copyright (c) 1999-2006 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of LGPL, see the file "COPYING".
#

module Racc

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

    attr_reader :text
    attr_reader :filename
    attr_reader :lineno

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

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

end