[ruby-core:93834] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
From:
merch-redmine@...
Date:
2019-07-18 19:22:05 UTC
List:
ruby-core #93834
Issue #10463 has been updated by jeremyevans0 (Jeremy Evans). File tilde-bang-at-symbols.patch added matz confirmed in the last developer meeting that he wants `def !@; end` to continue to work. However, I still think we should fix it so that `:!@` and `:~@` are not treated as `:!` and `:~`. This is a bit tricky to do as the parser currently uses the same lex state for both cases (`EXPR_FNAME`). The simplest way I can think to fix this is in the attached patch. It changes the `:!` and `:~` cases to use lex state `EXPR_FNAME|EXPR_FITEM`, and changes the code to check on whether `EXPR_FITEM` is one of the lex states. If `EXPR_FITEM` is one of the lex states, then it doesn't ignore the `@`. ---------------------------------------- Bug #10463: :~@ and :!@ are not parsed correctly https://bugs.ruby-lang.org/issues/10463#change-79706 * Author: sawa (Tsuyoshi Sawada) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.1.4 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- The at mark in literal symbols `:~@` and `:!@` are ignored. ~~~ruby :~@ # => :~ :!@ # => :! ~~~ ---Files-------------------------------- tilde-bang-at-symbols.patch (2.22 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>