diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-19 09:27:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-19 09:27:49 +0000 |
commit | 884efe7c5ecfe5bf0621008b7a535729b4c07b97 (patch) | |
tree | 0380cb0e4887dd83e1047c42285c3eb6e3ae9856 /parse.y | |
parent | d22fc7c4d8849c86774b049bd6ef02005187c671 (diff) |
* node.h (nd_cpath): nested class/module declaration.
[EXPREIMENTAL]
* eval.c (rb_eval): ditto.
* gc.c (rb_gc_mark_children): ditto.
* parse.y (cpath): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -240,7 +240,7 @@ static void top_local_setup(); %type <node> singleton strings string string1 xstring regexp %type <node> string_contents xstring_contents string_content %type <node> words qwords word_list qword_list word -%type <node> literal numeric dsym +%type <node> literal numeric dsym cbase cpath %type <node> bodystmt compstmt stmts stmt expr arg primary command command_call method_call %type <node> expr_value arg_value primary_value %type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure @@ -837,6 +837,27 @@ cname : tIDENTIFIER | tCONSTANT ; +cbase : tCOLON3 cname + { + $$ = NEW_COLON3($2); + } + | cname + { + $$ = NEW_CONST($1); + } + | cbase tCOLON2 cname + { + $$ = NEW_COLON2($1, $3); + } + ; + +cpath : cbase + { + if (nd_type($$ = $1) == NODE_CONST) + $$ = NEW_COLON2(0, $$->nd_vid); + } + ; + fname : tIDENTIFIER | tCONSTANT | tFID @@ -1525,7 +1546,7 @@ primary : literal $$ = NEW_FOR($2, $5, $8); fixpos($$, $2); } - | kCLASS cname superclass + | kCLASS cpath superclass { if (in_def || in_single) yyerror("class definition in method body"); @@ -1563,7 +1584,7 @@ primary : literal in_def = $<num>4; in_single = $<num>6; } - | kMODULE cname + | kMODULE cpath { if (in_def || in_single) yyerror("module definition in method body"); |