aboutsummaryrefslogtreecommitdiffstats
path: root/lib/racc/sourcetext.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-05-13 21:25:22 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-19 18:17:25 +0900
commit1a2546c2be839baa7d0a50dc056d4d6987d26852 (patch)
tree19fef5d8b8d96452a51ab68e8093ea895192ca27 /lib/racc/sourcetext.rb
parentcbe06cd3501fdadd0e6e63094da2973484d70b0b (diff)
downloadruby-1a2546c2be839baa7d0a50dc056d4d6987d26852.tar.gz
Backport racc-1.4.15 from upstream.
Diffstat (limited to 'lib/racc/sourcetext.rb')
-rw-r--r--lib/racc/sourcetext.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/racc/sourcetext.rb b/lib/racc/sourcetext.rb
new file mode 100644
index 0000000000..b33ba29291
--- /dev/null
+++ b/lib/racc/sourcetext.rb
@@ -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