From f3d25fdd9c58942d5e2d909f16b1dd8adabd21e1 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 14 Aug 2003 17:20:14 +0000 Subject: * gc.c (id2ref): recycle check should be done by klass == 0. [ruby-core:01408] * eval.c (Init_Thread): Continuation#[] added. [ruby-talk:79028] * parse.y (mlhs_node): should allow "::Foo" (colon3) as lhs. * parse.y (lhs): ditto. * parse.y (yylex): should return tCOLON3 right after kCLASS. [ruby-talk:78918] * error.c (exc_initialize): was converting argument to string too eagerly. Only check was needed. [ruby-talk:78958] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index c037fcb772..32f843cee9 100644 --- a/parse.y +++ b/parse.y @@ -809,6 +809,12 @@ mlhs_node : variable yyerror("dynamic constant assignment"); $$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3)); } + | tCOLON3 tCONSTANT + { + if (in_def || in_single) + yyerror("dynamic constant assignment"); + $$ = NEW_CDECL(0, 0, NEW_COLON3($2)); + } | backref { rb_backref_error($1); @@ -842,6 +848,12 @@ lhs : variable yyerror("dynamic constant assignment"); $$ = NEW_CDECL(0, 0, NEW_COLON2($1, $3)); } + | tCOLON3 tCONSTANT + { + if (in_def || in_single) + yyerror("dynamic constant assignment"); + $$ = NEW_CDECL(0, 0, NEW_COLON3($2)); + } | backref { rb_backref_error($1); @@ -1026,6 +1038,10 @@ arg : lhs '=' arg { yyerror("constant re-assignment"); } + | tCOLON3 tCONSTANT tOP_ASGN arg + { + yyerror("constant re-assignment"); + } | backref tOP_ASGN arg { rb_backref_error($1); @@ -1431,7 +1447,7 @@ primary : literal { $$ = NEW_COLON2($1, $3); } - | tCOLON3 cname + | tCOLON3 tCONSTANT { $$ = NEW_COLON3($2); } @@ -3928,7 +3944,7 @@ yylex() c = nextc(); if (c == ':') { if (lex_state == EXPR_BEG || lex_state == EXPR_MID || - (IS_ARG() && space_seen)) { + lex_state == EXPR_CLASS || (IS_ARG() && space_seen)) { lex_state = EXPR_BEG; return tCOLON3; } -- cgit v1.2.3