diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -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; } |