From e1ef9ac3531312b80fb93c290753570b3066504e Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Fri, 11 Jul 2025 11:24:03 -0400 Subject: [PATCH] Track compile errors Fixes #481 --- lib/syntax_tree/parser.rb | 1 + test/parser_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/syntax_tree/parser.rb b/lib/syntax_tree/parser.rb index 326d3ec7..ace077ee 100644 --- a/lib/syntax_tree/parser.rb +++ b/lib/syntax_tree/parser.rb @@ -2871,6 +2871,7 @@ def on_parse_error(error, *) alias on_assign_error on_parse_error alias on_class_name_error on_parse_error alias on_param_error on_parse_error + alias compile_error on_parse_error # :call-seq: # on_period: (String value) -> Period diff --git a/test/parser_test.rb b/test/parser_test.rb index 7ac07381..169d5b46 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -33,7 +33,7 @@ def test_parses_ripper_methods def test_errors_on_missing_token_with_location error = assert_raises(Parser::ParseError) { SyntaxTree.parse("f+\"foo") } - assert_equal(2, error.column) + assert_equal(3, error.column) end def test_errors_on_missing_end_with_location @@ -45,7 +45,7 @@ def test_errors_on_missing_regexp_ending error = assert_raises(Parser::ParseError) { SyntaxTree.parse("a =~ /foo") } - assert_equal(5, error.column) + assert_equal(6, error.column) end def test_errors_on_missing_token_without_location