Skip to content

Commit

Permalink
Extend error message for unterminated HEREDOC
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed May 7, 2024
1 parent f19bfc2 commit c1b07ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/src/diagnostic.c.erb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
[PM_ERR_HASH_TERM] = { "expected a `}` to close the hash literal", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_HASH_VALUE] = { "expected a value in the hash literal", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_HEREDOC_IDENTIFIER] = { "unterminated here document identifier", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_HEREDOC_TERM] = { "unterminated heredoc; can't find string \"%.*s\"", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_HEREDOC_TERM] = { "unterminated heredoc; can't find string \"%.*s\" anywhere before EOF", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_INCOMPLETE_QUESTION_MARK] = { "incomplete expression at `?`", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_INCOMPLETE_VARIABLE_CLASS_3_3] = { "`%.*s' is not allowed as a class variable name", PM_ERROR_LEVEL_SYNTAX },
[PM_ERR_INCOMPLETE_VARIABLE_CLASS] = { "'%.*s' is not allowed as a class variable name", PM_ERROR_LEVEL_SYNTAX },
Expand Down
2 changes: 1 addition & 1 deletion test/prism/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ def test_content_after_unterminated_heredoc
expected = CallNode(0, receiver, Location(), :foo, Location(), nil, nil, nil, nil)

assert_errors expected, "<<~FOO.foo\n", [
["unterminated heredoc; can't find string \"FOO\"", 3..6]
["unterminated heredoc; can't find string \"FOO\" anywhere before EOF", 3..6]
]
end

Expand Down

0 comments on commit c1b07ec

Please sign in to comment.