From 0201900d76c9b05000924dd74b98892db7be3d6e Mon Sep 17 00:00:00 2001
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Wed, 17 Feb 2016 12:42:00 +0000
Subject: id.def: $~ and $_

* defs/id.def (predefined): add idLASTLINE and idBACKREF for $~
  and $_ respectively.
* parse.y: use idLASTLINE and idBACKREF instead of rb_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 defs/id.def | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'defs/id.def')

diff --git a/defs/id.def b/defs/id.def
index 1ff0d9aa3d..e186725770 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -62,6 +62,9 @@ firstline, predefined = __LINE__+1, %[\
   core#hash_merge_kwd
 
   -                                                     debug#created_info
+
+  $_                                                    LASTLINE
+  $~                                                    BACKREF
 ]
 
 # VM ID         OP      Parser Token
@@ -145,7 +148,7 @@ predefined.split(/^/).each_with_index do |line, num|
   case name
   when /\A[A-Z]\w*\z/; const_ids
   when /\A(?!\d)\w+\z/; local_ids
-  when /\A\$(?:\d+|(?!\d)\w+)\z/; global_ids
+  when /\A\$(?:\d+|(?!\d)\w+|\W)\z/; global_ids
   when /\A@@(?!\d)\w+\z/; class_ids
   when /\A@(?!\d)\w+\z/; instance_ids
   when /\A((?!\d)\w+)=\z/; attrset_ids
-- 
cgit v1.2.3

