Skip to content

Commit e1ef9ac

Browse files
committed
Track compile errors
Fixes #481
1 parent dd35b0f commit e1ef9ac

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/syntax_tree/parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,6 +2871,7 @@ def on_parse_error(error, *)
28712871
alias on_assign_error on_parse_error
28722872
alias on_class_name_error on_parse_error
28732873
alias on_param_error on_parse_error
2874+
alias compile_error on_parse_error
28742875

28752876
# :call-seq:
28762877
# on_period: (String value) -> Period

test/parser_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_parses_ripper_methods
3333

3434
def test_errors_on_missing_token_with_location
3535
error = assert_raises(Parser::ParseError) { SyntaxTree.parse("f+\"foo") }
36-
assert_equal(2, error.column)
36+
assert_equal(3, error.column)
3737
end
3838

3939
def test_errors_on_missing_end_with_location
@@ -45,7 +45,7 @@ def test_errors_on_missing_regexp_ending
4545
error =
4646
assert_raises(Parser::ParseError) { SyntaxTree.parse("a =~ /foo") }
4747

48-
assert_equal(5, error.column)
48+
assert_equal(6, error.column)
4949
end
5050

5151
def test_errors_on_missing_token_without_location

0 commit comments

Comments
 (0)