summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prism/diagnostic.c1
-rw-r--r--prism/diagnostic.h1
-rw-r--r--prism/prism.c6
-rw-r--r--test/prism/errors_test.rb7
-rw-r--r--test/prism/location_test.rb2
5 files changed, 15 insertions, 2 deletions
@@ -92,6 +92,7 @@ static const char* const diagnostic_messages[PM_DIAGNOSTIC_ID_LEN] = {
[PM_ERR_CLASS_NAME] = "Expected a constant name after `class`",
[PM_ERR_CLASS_SUPERCLASS] = "Expected a superclass after `<`",
[PM_ERR_CLASS_TERM] = "Expected an `end` to close the `class` statement",
[PM_ERR_CONDITIONAL_ELSIF_PREDICATE] = "Expected a predicate expression for the `elsif` statement",
[PM_ERR_CONDITIONAL_IF_PREDICATE] = "Expected a predicate expression for the `if` statement",
[PM_ERR_CONDITIONAL_PREDICATE_TERM] = "Expected `then` or `;` or '\n'",
@@ -57,6 +57,7 @@ typedef enum {
PM_ERR_CLASS_NAME,
PM_ERR_CLASS_SUPERCLASS,
PM_ERR_CLASS_TERM,
PM_ERR_CONDITIONAL_ELSIF_PREDICATE,
PM_ERR_CONDITIONAL_IF_PREDICATE,
PM_ERR_CONDITIONAL_PREDICATE_TERM,
@@ -12304,7 +12304,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
}
pm_parser_scope_push(parser, true);
- accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON);
pm_node_t *statements = NULL;
if (!match3(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_END)) {
@@ -1355,6 +1355,13 @@ module Prism
]
end
private
def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby")
@@ -206,7 +206,7 @@ module Prism
def test_ClassNode
assert_location(ClassNode, "class Foo end")
- assert_location(ClassNode, "class Foo < Bar end")
end
def test_ClassVariableAndWriteNode