Skip to content

Commit 2a3711e

Browse files
committed
Increment cursor to breakpoint + 2
When there is a `\r\n` in the following example: `p eval "%\n1\r\n \n"` Prism was returning `"1\n "` whereas parse.y returns `"1"`. In this case the cursor needs to be set to the breakpoint (which is `\r`) plus 2 to ignore the new line and the space. I'm having trouble figuring out how to test this but locally here is the before and after output: Parse.y ``` $ ./miniruby --parser=parse.y test.rb "1" ``` Prism Before: ``` $ ./miniruby --parser=prism test.rb "1\n " ``` Prism after: ``` $ ./miniruby --parser=prism test.rb "1" ```
1 parent f2a0fe6 commit 2a3711e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/prism.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12401,7 +12401,7 @@ parser_lex(pm_parser_t *parser) {
1240112401
breakpoint++;
1240212402
parser->current.end = breakpoint;
1240312403
pm_token_buffer_escape(parser, &token_buffer);
12404-
token_buffer.cursor = breakpoint;
12404+
token_buffer.cursor = breakpoint + 2;
1240512405

1240612406
/* fallthrough */
1240712407
case '\n':

0 commit comments

Comments
 (0)