Skip to content

Commit

Permalink
Fix lexer location of token after line continuation (#15454)
Browse files Browse the repository at this point in the history
  • Loading branch information
FnControlOption authored Feb 21, 2025
1 parent 1c75ae6 commit 945655d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
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

0 comments on commit 945655d

Please sign in to comment.