{"action":"created","issue":{"url":"https://api.github.com/repos/whitequark/parser/issues/198","labels_url":"https://api.github.com/repos/whitequark/parser/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/whitequark/parser/issues/198/comments","events_url":"https://api.github.com/repos/whitequark/parser/issues/198/events","html_url":"https://github.com/whitequark/parser/issues/198","id":84541962,"number":198,"title":"Parse issue with regexp backreferences and one-characters string (eg. ?#)","user":{"login":"blutorange","id":2456413,"avatar_url":"https://avatars.githubusercontent.com/u/2456413?v=3","gravatar_id":"","url":"https://api.github.com/users/blutorange","html_url":"https://github.com/blutorange","followers_url":"https://api.github.com/users/blutorange/followers","following_url":"https://api.github.com/users/blutorange/following{/other_user}","gists_url":"https://api.github.com/users/blutorange/gists{/gist_id}","starred_url":"https://api.github.com/users/blutorange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blutorange/subscriptions","organizations_url":"https://api.github.com/users/blutorange/orgs","repos_url":"https://api.github.com/users/blutorange/repos","events_url":"https://api.github.com/users/blutorange/events{/privacy}","received_events_url":"https://api.github.com/users/blutorange/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-03T12:40:22Z","updated_at":"2015-06-04T09:32:29Z","closed_at":"2015-06-04T09:31:56Z","body":"- parser-2.2.2.5\r\n- tried it with ruby 2.2.1, 2.2.0, 2.0.0, 1.9.3, jruby-1.7.19\r\n\r\nCame across this incidentally. Try the following code with *parser*:\r\n\r\n    require 'parser/current'\r\n    code = <<eos\r\n    /()\\\\1/\r\n    ?#\r\n    eos\r\n    p Parser::CurrentRuby.parse(code)\r\n\r\nThis outputs:\r\n\r\n    (begin\r\n      (regexp\r\n        (str \"()\\\\1\")\r\n        (regopt))\r\n      (str \"\\u0001\"))\r\n\r\nThe *str* should not be `\"\\u0001\"`, but `(str \"#\"))`. If I remove the backreference `\\1` in the regexp or use a normal string (`\"#\"` or `'#'`) instead of `?#`, it works as expected and parses it as `(str \"#\"))`.\r\n\r\nAlso, ruby 1.9.3 and jruby returns `(str \"\\x01\"))` instead, which is still a 0x01 byte and not `#`."},"comment":{"url":"https://api.github.com/repos/whitequark/parser/issues/comments/108807284","html_url":"https://github.com/whitequark/parser/issues/198#issuecomment-108807284","issue_url":"https://api.github.com/repos/whitequark/parser/issues/198","id":108807284,"user":{"login":"whitequark","id":54771,"avatar_url":"https://avatars.githubusercontent.com/u/54771?v=3","gravatar_id":"","url":"https://api.github.com/users/whitequark","html_url":"https://github.com/whitequark","followers_url":"https://api.github.com/users/whitequark/followers","following_url":"https://api.github.com/users/whitequark/following{/other_user}","gists_url":"https://api.github.com/users/whitequark/gists{/gist_id}","starred_url":"https://api.github.com/users/whitequark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitequark/subscriptions","organizations_url":"https://api.github.com/users/whitequark/orgs","repos_url":"https://api.github.com/users/whitequark/repos","events_url":"https://api.github.com/users/whitequark/events{/privacy}","received_events_url":"https://api.github.com/users/whitequark/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T09:32:29Z","updated_at":"2015-06-04T09:32:29Z","body":"Impressive.\r\n\r\nThis holds the record for the most obscure parser's own bug so far."}}