summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-14 17:20:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-14 17:20:14 +0000
commitf3d25fdd9c58942d5e2d909f16b1dd8adabd21e1 (patch)
treeef0eacfd67e503e34658cc9b21e7797b96f1132b /parse.y
parent206efa13561648716e65fc7e87f4967cbb707571 (diff)
* 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
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y20
1 files changed, 18 insertions, 2 deletions
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;
}