diff options
author | Kevin Newton <[email protected]> | 2024-05-01 17:49:41 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-05-01 19:19:07 -0400 |
commit | 1be5ede766d93d0d5056a99773c166987c5d5235 () | |
tree | ca6b9ee1e84e7e74ed12cbd399a58cb91a27a026 | |
parent | 62f8fb7f8988f775cc267431e381de8984dcba31 (diff) |
[PRISM] Error message for unterminated heredoc identifier
-rw-r--r-- | prism/config.yml | 1 | ||||
-rw-r--r-- | prism/prism.c | 7 | ||||
-rw-r--r-- | prism/templates/src/diagnostic.c.erb | 1 | ||||
-rw-r--r-- | prism/templates/src/token_type.c.erb | 8 | ||||
-rw-r--r-- | test/.excludes-prism/TestParse.rb | 1 |
5 files changed, 11 insertions, 7 deletions
@@ -123,6 +123,7 @@ errors: - HASH_ROCKET - HASH_TERM - HASH_VALUE - HEREDOC_TERM - INCOMPLETE_QUESTION_MARK - INCOMPLETE_VARIABLE_CLASS @@ -10830,8 +10830,11 @@ parser_lex(pm_parser_t *parser) { } size_t ident_length = (size_t) (parser->current.end - ident_start); if (quote != PM_HEREDOC_QUOTE_NONE && !match(parser, (uint8_t) quote)) { - // TODO: handle unterminated heredoc } parser->explicit_encoding = NULL; @@ -10856,7 +10859,7 @@ parser_lex(pm_parser_t *parser) { // this is not a valid heredoc declaration. In this case we // will add an error, but we will still return a heredoc // start. - pm_parser_err_heredoc_term(parser, parser->lex_modes.current); body_start = parser->end; } else { // Otherwise, we want to indicate that the body of the @@ -207,6 +207,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_HASH_ROCKET] = { "expected a `=>` between the hash key and value", PM_ERROR_LEVEL_SYNTAX }, [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_TERM] = { "unterminated heredoc; can't find string \"%.*s\"", 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 }, @@ -130,9 +130,9 @@ pm_token_type_human(pm_token_type_t token_type) { case PM_TOKEN_GREATER_EQUAL: return "'>='"; case PM_TOKEN_GREATER_GREATER: - return "'>>'"; case PM_TOKEN_GREATER_GREATER_EQUAL: - return "'>>='"; case PM_TOKEN_HEREDOC_END: return "heredoc ending"; case PM_TOKEN_HEREDOC_START: @@ -258,9 +258,9 @@ pm_token_type_human(pm_token_type_t token_type) { case PM_TOKEN_LESS_EQUAL_GREATER: return "'<=>'"; case PM_TOKEN_LESS_LESS: - return "'<<'"; case PM_TOKEN_LESS_LESS_EQUAL: - return "'<<='"; case PM_TOKEN_METHOD_NAME: return "method name"; case PM_TOKEN_MINUS: @@ -1,6 +1,5 @@ exclude(:test_error_def_in_argument, "unknown") exclude(:test_global_variable, "unknown") -exclude(:test_here_document, "unknown") exclude(:test_invalid_char, "unknown") exclude(:test_location_of_invalid_token, "unknown") exclude(:test_op_asgn1_with_block, "unknown") |