Skip to content

Commit

Permalink
Use location for #to_s
Browse files Browse the repository at this point in the history
Some tokens doesn't have `location`. `#to_s` raises NoMethodError
for such cases if the method uses `line` and `column`.
  • Loading branch information
yui-knk committed Nov 10, 2023
1 parent 04010c2 commit de91b48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lrama/lexer/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit de91b48

Please sign in to comment.