summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-25 08:26:20 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-25 08:26:20 +0000
commit1307f8d555235116f0f0c79b9902df9cfd4bff12 (patch)
treefaf8962d1f1fcdb54db653b4a99b148fdecea7e6 /parse.y
parent1aba398e29bd9134f83c165a2495883f72cbbb3d (diff)
regexp null pattern
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y23
1 files changed, 22 insertions, 1 deletions
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;