{"action":"opened","issue":{"url":"https://api.github.com/repos/seattlerb/ruby_parser/issues/198","labels_url":"https://api.github.com/repos/seattlerb/ruby_parser/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/seattlerb/ruby_parser/issues/198/comments","events_url":"https://api.github.com/repos/seattlerb/ruby_parser/issues/198/events","html_url":"https://github.com/seattlerb/ruby_parser/issues/198","id":106973457,"number":198,"title":"Ruby22Parser: new_call() being called without args","user":{"login":"mzazrivec","id":6648365,"avatar_url":"https://avatars.githubusercontent.com/u/6648365?v=3","gravatar_id":"","url":"https://api.github.com/users/mzazrivec","html_url":"https://github.com/mzazrivec","followers_url":"https://api.github.com/users/mzazrivec/followers","following_url":"https://api.github.com/users/mzazrivec/following{/other_user}","gists_url":"https://api.github.com/users/mzazrivec/gists{/gist_id}","starred_url":"https://api.github.com/users/mzazrivec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzazrivec/subscriptions","organizations_url":"https://api.github.com/users/mzazrivec/orgs","repos_url":"https://api.github.com/users/mzazrivec/repos","events_url":"https://api.github.com/users/mzazrivec/events{/privacy}","received_events_url":"https://api.github.com/users/mzazrivec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-17T12:31:31Z","updated_at":"2015-09-17T12:31:31Z","closed_at":null,"body":"With Ruby22Parser:\r\n\r\n```\r\nclass RubyXXParser < Ruby22Parser\r\n  def new_call(*args)\r\n    p args\r\n    super *args\r\n  end\r\nend\r\n```\r\n\r\n```\r\n> RubyXXParser.new.parse \"x._('foo')\"\r\n[nil, :x]\r\n[s(:call, nil, :x), :_, s(:array, s(:str, \"foo\"))]\r\n=> s(:call, s(:call, nil, :x), :_, s(:str, \"foo\"))\r\n\r\n> RubyXXParser.new.parse \"_('foo')\"\r\n[nil, :_]\r\n=> s(:call, nil, :_, s(:str, \"foo\"))\r\n```\r\n\r\nWhile when we try the same thing with Ruby19Parser:\r\n\r\n```\r\nclass RubyYYParser < Ruby19Parser\r\n  def new_call(*args)\r\n    p args\r\n    super *args\r\n  end\r\nend\r\n```\r\n\r\nwe can see the following new_call invocations:\r\n\r\n```\r\n> RubyYYParser.new.parse \"x._('foo')\"\r\n[nil, :x]\r\n[s(:call, nil, :x), :_, s(:array, s(:str, \"foo\"))]\r\n=> s(:call, s(:call, nil, :x), :_, s(:str, \"foo\"))\r\n\r\n> RubyYYParser.new.parse \"_('foo')\"\r\n[nil, :_, s(:array, s(:str, \"foo\"))]\r\n=> s(:call, nil, :_, s(:str, \"foo\"))\r\n```\r\n\r\nInterestingly enough, the resulting s-expression is the same in both scenarios, it's just\r\nthe invocation of new_call() routine that differs here.\r\n\r\nOther gems, namely `gettext_i18n_rails` rely on `new_call()` -- the gem overrides new_call\r\nwith its own version, where it tries to detect invocations of gettext routines in ruby / haml\r\nsource files (all to create gettext translation catalogs).\r\n\r\nObviously, the `new_call` routine from gettext_i18n_rails needs to see content of\r\nthe gettext function, to be able to extract the translation strings. This used to work with\r\nRuby19Parser, but seems to be broken with Ruby20Parser.\r\n\r\nWhere do we go from here?"}}