-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
Token location of this ruby code seems wrong.
"\C-
"Prism.lex("\"\\C-\n\"").value[1]
#=> [STRING_CONTENT(1,1)-(1,5)("\\C-\n"), 1]This token ends with newline, so I think the location should be (1,1)-(2,0)
Another example for an incomplete string literal:
Prism.lex("\"\\C-\naaa\nbbb").value[1]
=> [[STRING_BEGIN(1,0)-(1,1)("\""), 1], [STRING_CONTENT(1,1)-(2,0)("\\C-\naaa\n"), 1], [STRING_CONTENT(2,0)-(2,3)("bbb"), 1], [EOF(2,3)-(2,3)(""), 1]](1,1)-(2,0) should be (1,1)-(2,3), (2,0)-(2,3) should be (3,0)-(3,3)
or perhaps two tokens should be concatenated: (1,1)-(3,3)
Found while typing "\C-a" to irb-head. (IRB appends \n when analyzing code).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels