Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent NoMethodError in generating an error message #25

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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