Skip to content

Commit

Permalink
Merge pull request #25 from mame/undefined-method-calls
Browse files Browse the repository at this point in the history
Prevent NoMethodError in generating an error message
  • Loading branch information
yui-knk authored May 19, 2023
2 parents 69e0987 + bb3c950 commit 0b4b203
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def translated_printer_code(tag)
when ref.type == :at # @n
raise "@#{ref.number} can not be used in %printer."
else
raise "Unexpected. #{code}, #{ref}"
raise "Unexpected. #{self}, #{ref}"
end

t_code[first_column..last_column] = str
Expand Down Expand Up @@ -205,7 +205,7 @@ def translated_user_code
i = -ref.position_in_rhs + ref.number
str = "(yylsp[#{i}])"
else
raise "Unexpected. #{code}, #{ref}"
raise "Unexpected. #{self}, #{ref}"
end

t_code[first_column..last_column] = str
Expand Down Expand Up @@ -235,7 +235,7 @@ def translated_initial_action_code
when ref.type == :at # @n
raise "@#{ref.number} can not be used in initial_action."
else
raise "Unexpected. #{code}, #{ref}"
raise "Unexpected. #{self}, #{ref}"
end

t_code[first_column..last_column] = str
Expand Down
2 changes: 1 addition & 1 deletion lib/lrama/states.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def transition(sym)
def find_reduce_by_item!(item)
reduces.find do |r|
r.item == item
end || (raise "reduce is not found. #{item}, #{state}")
end || (raise "reduce is not found. #{item}")
end

def default_reduction_rule=(default_reduction_rule)
Expand Down

0 comments on commit 0b4b203

Please sign in to comment.