Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexer: Fix location of token after line continuation #15454

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,7 @@ module Crystal
assert_end_location "1 rescue 2"
assert_end_location "1 ensure 2"
assert_end_location "foo.bar= *baz"
assert_end_location %("hello "\\\n"world"), line_number: 2, column_number: 7

assert_syntax_error %({"a" : 1}), "space not allowed between named argument name and ':'"
assert_syntax_error %({"a": 1, "b" : 2}), "space not allowed between named argument name and ':'"
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/lexer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ module Crystal
case next_char
when '\r', '\n'
handle_slash_r_slash_n_or_slash_n
incr_line_number
incr_line_number 0
@token.passed_backslash_newline = true
consume_whitespace
reset_regex_flags = false
Expand Down