From de91b487d91ee1ffe8332fbc5db5889915aee810 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Fri, 10 Nov 2023 10:44:47 +0900 Subject: [PATCH] Use location for `#to_s` Some tokens doesn't have `location`. `#to_s` raises NoMethodError for such cases if the method uses `line` and `column`. --- lib/lrama/lexer/token.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lrama/lexer/token.rb b/lib/lrama/lexer/token.rb index 72d18279..4444e920 100644 --- a/lib/lrama/lexer/token.rb +++ b/lib/lrama/lexer/token.rb @@ -5,7 +5,7 @@ class Token < Struct.new(:s_value, :alias_name, :location, keyword_init: true) attr_accessor :referred def to_s - "#{super} line: #{line}, column: #{column}" + "#{super} location: #{location}" end def referred_by?(string)