Skip to content

Commit

Permalink
Fix location of token after line continuation
Browse files Browse the repository at this point in the history
  • Loading branch information
FnControlOption committed Feb 11, 2025
1 parent 673353c commit 4776fa1
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 @@ -2374,6 +2374,7 @@ module Crystal
assert_end_location "case :foo; when :bar; 2; end"
assert_end_location %(asm("nop" ::))
assert_end_location "select; when foo; 2; end"
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 4776fa1

Please sign in to comment.