https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-07-12T15:35:24ZRuby Issue Tracking SystemRuby master - Bug #8628: Parse error with method argument that is a Hash with a specific patternhttps://bugs.ruby-lang.org/issues/8628?journal_id=404642013-07-12T15:35:24Zdimitri-lo2u (Dimitri Geshef)famished.tiger@yahoo.com
<ul></ul><p>First detected in ruby 1.9.3p374 (2013-01-15) [i386-mingw32]</p> Ruby master - Bug #8628: Parse error with method argument that is a Hash with a specific patternhttps://bugs.ruby-lang.org/issues/8628?journal_id=404652013-07-12T15:38:39Zdimitri-lo2u (Dimitri Geshef)famished.tiger@yahoo.com
<ul></ul><p>The error message when you run the snippet in attachment is:<br>
snippet.rb:9: syntax error, unexpected tIDENTIFIER, expecting $end</p>
<a name="in-comment-gt-fails"></a>
<h1 >/in comment/ => 'fails'<a href="#in-comment-gt-fails" class="wiki-anchor">¶</a></h1>
<pre><code> ^
</code></pre> Ruby master - Bug #8628: Parse error with method argument that is a Hash with a specific patternhttps://bugs.ruby-lang.org/issues/8628?journal_id=404662013-07-12T15:55:47Zdimitri-lo2u (Dimitri Geshef)famished.tiger@yahoo.com
<ul></ul><a name="Could-also-reproduce-the-problem-with-the-regexp-"></a>
<h1 >Could also reproduce the problem with the regexp /,/<a href="#Could-also-reproduce-the-problem-with-the-regexp-" class="wiki-anchor">¶</a></h1>
<a name="In-other-words-this-will-also-result-in-a-parse-error"></a>
<h1 >In other words, this will also result in a parse error:<a href="#In-other-words-this-will-also-result-in-a-parse-error" class="wiki-anchor">¶</a></h1>
<p>p /,/ => 'problematic too'</p>
<a name="in-comment-gt-parse-fails-in-this-line"></a>
<h1 >/in comment/ => 'parse fails in this line'<a href="#in-comment-gt-parse-fails-in-this-line" class="wiki-anchor">¶</a></h1> Ruby master - Bug #8628: Parse error with method argument that is a Hash with a specific patternhttps://bugs.ruby-lang.org/issues/8628?journal_id=404682013-07-12T16:18:49Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p><code>p /=/' is interpreted as </code>p /= /.../', an assignment to a variable `p'.</p> Ruby master - Bug #8628: Parse error with method argument that is a Hash with a specific patternhttps://bugs.ruby-lang.org/issues/8628?journal_id=404722013-07-12T19:25:46Zdimitri-lo2u (Dimitri Geshef)famished.tiger@yahoo.com
<ul></ul><p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/4">@nobu (Nobuyoshi Nakada)</a>.<br>
My apologies for this false alarm.<br>
Thank you for pointing the grammatical ambiguity:<br>
/=/ can be parsed as the /= operator followed by a regexp literal or the regexp literal /=/ itself.<br>
Didn't realize this.</p>