From 1307f8d555235116f0f0c79b9902df9cfd4bff12 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 25 May 1999 08:26:20 +0000 Subject: regexp null pattern git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 9ce595da4c..ebee1ce354 100644 --- a/parse.y +++ b/parse.y @@ -460,6 +460,10 @@ mlhs_basic : mlhs_head { $$ = NEW_MASGN(NEW_LIST($1), $3); } + | mlhs_head tSTAR + { + $$ = NEW_MASGN(NEW_LIST($1), -1); + } | mlhs_head mlhs_tail { $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2), 0); @@ -468,10 +472,18 @@ mlhs_basic : mlhs_head { $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2),$5); } + | mlhs_head mlhs_tail ',' tSTAR + { + $$ = NEW_MASGN(list_concat(NEW_LIST($1),$2),-1); + } | tSTAR mlhs_node { $$ = NEW_MASGN(0, $2); } + | tSTAR + { + $$ = NEW_MASGN(0, -1); + } mlhs_item : mlhs_node | tLPAREN mlhs_entry ')' @@ -1500,6 +1512,10 @@ f_rest_arg : tSTAR tIDENTIFIER yyerror("rest argument must be local variable"); $$ = local_cnt($2); } + | tSTAR + { + $$ = -2; + } f_block_arg : tAMPER tIDENTIFIER { @@ -1609,7 +1625,7 @@ none : /* none */ #include "regex.h" #include "util.h" -#define is_identchar(c) ((c)!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) +#define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) static char *tokenbuf = NULL; static int tokidx, toksiz = 0; @@ -2013,6 +2029,7 @@ parse_regx(term, paren) tokadd(c); } else { +#if 0 int c1; pushback(c); c1 = read_escape(); @@ -2023,6 +2040,10 @@ parse_regx(term, paren) tokadd('\\'); tokadd(c); } +#else + tokadd('\\'); + tokadd(c); +#endif } } continue; -- cgit v1.2.3