mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Backport racc-1.4.15 from upstream.
This commit is contained in:
parent
cbe06cd350
commit
1a2546c2be
111 changed files with 75498 additions and 43 deletions
34
lib/racc/sourcetext.rb
Normal file
34
lib/racc/sourcetext.rb
Normal file
|
@ -0,0 +1,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
|
Loading…
Add table
Add a link
Reference in a new issue