diff --git a/CHANGELOG.md b/CHANGELOG.md index 80fc04b2..035dd02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ Bug fixes --------- * Variables introduced inside `try` blocks are now properly cleaned up upon an exception. +* Off-by-one error in character positions after a comment line is now fixed. + +Enhancements +------------ + +* `rhai-repl` tool has a few more commands, such as `strict` to turn on/off _Strict Variables Mode_ and `optimize` to turn on/off script optimization. Version 1.4.1 diff --git a/src/tokenizer.rs b/src/tokenizer.rs index b23c630e..ba6fb045 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -1592,11 +1592,11 @@ fn get_next_token_inner( // `\r - start from next line Some('\r') => { eat_next(stream, pos); - pos.new_line(); // `\r\n if let Some('\n') = stream.peek_next() { eat_next(stream, pos); } + pos.new_line(); } // `\n - start from next line Some('\n') => { @@ -1762,11 +1762,11 @@ fn get_next_token_inner( while let Some(c) = stream.get_next() { if c == '\r' { - pos.new_line(); // \r\n if let Some('\n') = stream.peek_next() { eat_next(stream, pos); } + pos.new_line(); break; } if c == '\n' {