[前][次][番号順一覧][スレッド一覧]

ruby-changes:49700

From: mame <ko1@a...>
Date: Sun, 14 Jan 2018 22:51:45 +0900 (JST)
Subject: [ruby-changes:49700] mame:r61817 (trunk): parse.y: Expand global-like accessor macros for struct parser_params

mame	2018-01-14 22:51:41 +0900 (Sun, 14 Jan 2018)

  New Revision: 61817

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61817

  Log:
    parse.y: Expand global-like accessor macros for struct parser_params
    
    For example, `lex_strterm` is expanded to `p->lex.strterm`.
    I believe that this expansion make the code straightforward.
    They look not so annoying because "parser" was renamed to "p".

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61816)
+++ parse.y	(revision 61817)
@@ -60,7 +60,7 @@ https://github.com/ruby/ruby/blob/trunk/parse.y#L60
     while (0)
 
 #define RUBY_SET_YYLLOC_FROM_STRTERM_HEREDOC(Current)			\
-    rb_parser_set_location_from_strterm_heredoc(p, &lex_strterm->u.heredoc, &(Current))
+    rb_parser_set_location_from_strterm_heredoc(p, &p->lex.strterm->u.heredoc, &(Current))
 #define RUBY_SET_YYLLOC_OF_NONE(Current)					\
     rb_parser_set_location_of_none(p, &(Current))
 #define RUBY_SET_YYLLOC(Current)					\
@@ -105,20 +105,20 @@ enum lex_state_e { https://github.com/ruby/ruby/blob/trunk/parse.y#L105
 };
 #define IS_lex_state_for(x, ls)	((x) & (ls))
 #define IS_lex_state_all_for(x, ls) (((x) & (ls)) == (ls))
-#define IS_lex_state(ls)	IS_lex_state_for(lex_state, (ls))
-#define IS_lex_state_all(ls)	IS_lex_state_all_for(lex_state, (ls))
+#define IS_lex_state(ls)	IS_lex_state_for(p->lex.state, (ls))
+#define IS_lex_state_all(ls)	IS_lex_state_all_for(p->lex.state, (ls))
 
 # define SET_LEX_STATE(ls) \
-    (lex_state = \
-     (yydebug ? \
-      rb_parser_trace_lex_state(p, lex_state, (ls), __LINE__) : \
+    (p->lex.state = \
+     (p->yydebug ? \
+      rb_parser_trace_lex_state(p, p->lex.state, (ls), __LINE__) : \
       (enum lex_state_e)(ls)))
 
 typedef VALUE stack_type;
 
 static const rb_code_location_t NULL_LOC = { {0, -1}, {0, -1} };
 
-# define SHOW_BITSTACK(stack, name) (yydebug ? rb_parser_show_bitstack(p, stack, name, __LINE__) : (void)0)
+# define SHOW_BITSTACK(stack, name) (p->yydebug ? rb_parser_show_bitstack(p, stack, name, __LINE__) : (void)0)
 # define BITSTACK_PUSH(stack, n) (((stack) = ((stack)<<1)|((n)&1)), SHOW_BITSTACK(stack, #stack"(push)"))
 # define BITSTACK_POP(stack)	 (((stack) = (stack) >> 1), SHOW_BITSTACK(stack, #stack"(pop)"))
 # define BITSTACK_SET_P(stack)	 (SHOW_BITSTACK(stack, #stack), (stack)&1)
@@ -126,17 +126,17 @@ static const rb_code_location_t NULL_LOC https://github.com/ruby/ruby/blob/trunk/parse.y#L126
 
 /* A flag to identify keyword_do_cond, "do" keyword after condition expression.
    Examples: `while ... do`, `until ... do`, and `for ... in ... do` */
-#define COND_PUSH(n)	BITSTACK_PUSH(cond_stack, (n))
-#define COND_POP()	BITSTACK_POP(cond_stack)
-#define COND_P()	BITSTACK_SET_P(cond_stack)
-#define COND_SET(n)	BITSTACK_SET(cond_stack, (n))
+#define COND_PUSH(n)	BITSTACK_PUSH(p->cond_stack, (n))
+#define COND_POP()	BITSTACK_POP(p->cond_stack)
+#define COND_P()	BITSTACK_SET_P(p->cond_stack)
+#define COND_SET(n)	BITSTACK_SET(p->cond_stack, (n))
 
 /* A flag to identify keyword_do_block; "do" keyword after command_call.
    Example: `foo 1, 2 do`. */
-#define CMDARG_PUSH(n)	BITSTACK_PUSH(cmdarg_stack, (n))
-#define CMDARG_POP()	BITSTACK_POP(cmdarg_stack)
-#define CMDARG_P()	BITSTACK_SET_P(cmdarg_stack)
-#define CMDARG_SET(n)	BITSTACK_SET(cmdarg_stack, (n))
+#define CMDARG_PUSH(n)	BITSTACK_PUSH(p->cmdarg_stack, (n))
+#define CMDARG_POP()	BITSTACK_POP(p->cmdarg_stack)
+#define CMDARG_P()	BITSTACK_SET_P(p->cmdarg_stack)
+#define CMDARG_SET(n)	BITSTACK_SET(p->cmdarg_stack, (n))
 
 struct vtable {
     ID *tbl;
@@ -153,7 +153,7 @@ struct local_vars { https://github.com/ruby/ruby/blob/trunk/parse.y#L153
     struct vtable *past;
 # endif
     struct local_vars *prev;
-    stack_type cmdargs, cond; /* XXX: backup for cmdargs_stack and cond_stack.  Because this is not a part of local variables, refactoring is needed. */
+    stack_type cmdargs, cond; /* XXX: backup for cmdargs_stack and p->cond_stack.  Because this is not a part of local variables, refactoring is needed. */
 };
 
 #define DVARS_INHERIT ((void*)1)
@@ -173,7 +173,7 @@ typedef struct rb_strterm_struct rb_strt https://github.com/ruby/ruby/blob/trunk/parse.y#L173
 /*
     Structure of Lexer Buffer:
 
- lex_pbeg      tokp         lex_p        lex_pend
+ p->lex.pbeg   tokp         p->lex.pcur  p->lex.pend
     |           |              |            |
     |-----------+--------------+------------|
                 |<------------>|
@@ -199,7 +199,7 @@ struct parser_params { https://github.com/ruby/ruby/blob/trunk/parse.y#L199
 	enum lex_state_e state;
 	/* track the nest level of any parens "()[]{}" */
 	int paren_nest;
-	/* keep paren_nest at the beginning of lambda "->" to detect tLAMBEG and keyword_do_LAMBDA */
+	/* keep p->lex.paren_nest at the beginning of lambda "->" to detect tLAMBEG and keyword_do_LAMBDA */
 	int lpar_beg;
 	/* track the nest level of only braces "{}" */
 	int brace_nest;
@@ -277,11 +277,11 @@ struct parser_params { https://github.com/ruby/ruby/blob/trunk/parse.y#L277
 
 #define intern_cstr(n,l,en) rb_intern3(n,l,en)
 
-#define STR_NEW(ptr,len) rb_enc_str_new((ptr),(len),current_enc)
-#define STR_NEW0() rb_enc_str_new(0,0,current_enc)
-#define STR_NEW2(ptr) rb_enc_str_new((ptr),strlen(ptr),current_enc)
-#define STR_NEW3(ptr,len,e,func) parser_str_new((ptr),(len),(e),(func),current_enc)
-#define TOK_INTERN() intern_cstr(tok(), toklen(), current_enc)
+#define STR_NEW(ptr,len) rb_enc_str_new((ptr),(len),p->enc)
+#define STR_NEW0() rb_enc_str_new(0,0,p->enc)
+#define STR_NEW2(ptr) rb_enc_str_new((ptr),strlen(ptr),p->enc)
+#define STR_NEW3(ptr,len,e,func) parser_str_new((ptr),(len),(e),(func),p->enc)
+#define TOK_INTERN() intern_cstr(tok(), toklen(), p->enc)
 
 static int parser_yyerror(struct parser_params*, const YYLTYPE *yylloc, const char*);
 #define yyerror0(msg) parser_yyerror(p, NULL, (msg))
@@ -289,60 +289,20 @@ static int parser_yyerror(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L289
 #define yyerror(yylloc, p, msg) parser_yyerror(p, yylloc, msg)
 #define token_flush(ptr) ((ptr)->lex.ptok = (ptr)->lex.pcur)
 
-#define lex_strterm		(p->lex.strterm)
-#define lex_state		(p->lex.state)
-#define cond_stack		(p->cond_stack)
-#define cmdarg_stack		(p->cmdarg_stack)
-#define paren_nest		(p->lex.paren_nest)
-#define lpar_beg		(p->lex.lpar_beg)
-#define brace_nest		(p->lex.brace_nest)
-#define in_def			(p->in_def)
-#define in_class		(p->in_class)
-#define in_main 		(p->in_main)
-#define in_defined		(p->in_defined)
-#define tokenbuf		(p->tokenbuf)
-#define tokidx			(p->tokidx)
-#define toksiz			(p->toksiz)
-#define tokline 		(p->tokline)
-#define lex_input		(p->lex.input)
-#define lex_prevline		(p->lex.prevline)
-#define lex_lastline		(p->lex.lastline)
-#define lex_nextline		(p->lex.nextline)
-#define lex_pbeg		(p->lex.pbeg)
-#define lex_p			(p->lex.pcur)
-#define lex_pend		(p->lex.pend)
-#define heredoc_end		(p->heredoc_end)
-#define heredoc_indent		(p->heredoc_indent)
-#define heredoc_line_indent	(p->heredoc_line_indent)
-#define command_start		(p->command_start)
-#define lex_gets_ptr		(p->lex.gets_ptr)
-#define lex_gets		(p->lex.gets)
-#define lvtbl			(p->lvtbl)
-#define ruby__end__seen 	(p->ruby__end__seen)
-#define ruby_sourceline 	(p->ruby_sourceline)
-#define ruby_sourcefile 	(p->ruby_sourcefile)
-#define ruby_sourcefile_string	(p->ruby_sourcefile_string)
-#define current_enc		(p->enc)
-#define current_arg		(p->cur_arg)
-#define yydebug 		(p->yydebug)
 #ifdef RIPPER
 #define compile_for_eval	(0)
 #else
-#define compile_for_eval	(p->base_block != 0 && !in_main)
-#define ruby_eval_tree		(p->eval_tree)
-#define ruby_eval_tree_begin	(p->eval_tree_begin)
-#define ruby_debug_lines	(p->debug_lines)
-#define ruby_coverage		(p->coverage)
+#define compile_for_eval	(p->base_block != 0 && !p->in_main)
 #endif
 #define tokp			lex.ptok
 
-#define token_column		((int)(p->tokp - lex_pbeg))
+#define token_column		((int)(p->tokp - p->lex.pbeg))
 
 #define CALL_Q_P(q) ((q) == TOKEN2VAL(tANDDOT))
 #define NODE_CALL_Q(q) (CALL_Q_P(q) ? NODE_QCALL : NODE_CALL)
 #define NEW_QCALL(q,r,m,a,loc) NEW_NODE(NODE_CALL_Q(q),r,m,a,loc)
 
-#define lambda_beginning_p() (lpar_beg == paren_nest)
+#define lambda_beginning_p() (p->lex.lpar_beg == p->lex.paren_nest)
 
 static enum yytokentype yylex(YYSTYPE*, YYLTYPE*, struct parser_params*);
 
@@ -901,8 +861,8 @@ PRINTF_ARGS(static void ripper_compile_e https://github.com/ruby/ruby/blob/trunk/parse.y#L861
 # define WARN_I(i) i
 # define WARN_ID(i) rb_id2name(i)
 # define PRIsWARN PRIsVALUE
-# define WARN_ARGS(fmt,n) WARN_ARGS_L(ruby_sourceline,fmt,n)
-# define WARN_ARGS_L(l,fmt,n) ruby_sourcefile, (l), (fmt)
+# define WARN_ARGS(fmt,n) WARN_ARGS_L(p->ruby_sourceline,fmt,n)
+# define WARN_ARGS_L(l,fmt,n) p->ruby_sourcefile, (l), (fmt)
 # define WARN_CALL rb_compile_warn
 # define WARNING_ARGS(fmt,n) WARN_ARGS(fmt,n)
 # define WARNING_ARGS_L(l,fmt,n) WARN_ARGS_L(l,fmt,n)
@@ -1116,7 +1076,7 @@ program		:  { https://github.com/ruby/ruby/blob/trunk/parse.y#L1076
 				void_expr(node->nd_head);
 			    }
 			}
-			ruby_eval_tree = NEW_SCOPE(0, block_append(ruby_eval_tree, $2), &@$);
+			p->eval_tree = NEW_SCOPE(0, block_append(p->eval_tree, $2), &@$);
 		    /*%
 			$$ = $2;
 			p->result = dispatch1(program, $$);
@@ -1177,8 +1137,8 @@ top_stmt	: stmt https://github.com/ruby/ruby/blob/trunk/parse.y#L1137
 		  '{' top_compstmt '}'
 		    {
 		    /*%%%*/
-			ruby_eval_tree_begin = block_append(ruby_eval_tree_begin,
-							    NEW_BEGIN($4, &@$));
+			p->eval_tree_begin = block_append(p->eval_tree_begin,
+							  NEW_BEGIN($4, &@$));
 			/* NEW_PREEXE($4)); */
 			/* local_pop(); */
 			$$ = NEW_BEGIN(0, &@$);
@@ -1278,8 +1238,8 @@ stmt_or_begin	: stmt https://github.com/ruby/ruby/blob/trunk/parse.y#L1238
 		  '{' top_compstmt '}'
 		    {
 		    /*%%%*/
-			ruby_eval_tree_begin = block_append(ruby_eval_tree_begin,
-							    $4);
+			p->eval_tree_begin = block_append(p->eval_tree_begin,
+							  $4);
 			/* NEW_PREEXE($4)); */
 			/* local_pop(); */
 			$$ = NEW_BEGIN(0, &@$);
@@ -1392,7 +1352,7 @@ stmt		: keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1352
 		    }
 		| keyword_END '{' compstmt '}'
 		    {
-			if (in_def) {
+			if (p->in_def) {
 			    rb_warn0("END in method; use at_exit");
 			}
 		    /*%%%*/
@@ -1565,7 +1525,7 @@ fcall		: operation https://github.com/ruby/ruby/blob/trunk/parse.y#L1525
 		    {
 		    /*%%%*/
 			$$ = NEW_FCALL($1, 0, &@$);
-			nd_set_line($$, tokline);
+			nd_set_line($$, p->tokline);
 		    /*%
 		    %*/
 		    }
@@ -2237,9 +2197,9 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L2197
 		    {
 			$$ = logop(idOROP, $1, $3, &@2, &@$);
 		    }
-		| keyword_defined opt_nl {in_defined = 1;} arg
+		| keyword_defined opt_nl {p->in_defined = 1;} arg
 		    {
-			in_defined = 0;
+			p->in_defined = 0;
 			$$ = new_defined($4, &@$);
 		    }
 		| arg '?' arg opt_nl ':' arg
@@ -2427,7 +2387,7 @@ command_args	:   { https://github.com/ruby/ruby/blob/trunk/parse.y#L2387
 			    lookahead = 1;
 			}
 			if (lookahead) CMDARG_POP();
-			$<val>$ = cmdarg_stack;
+			$<val>$ = p->cmdarg_stack;
 			CMDARG_PUSH(1);
 			if (lookahead) CMDARG_PUSH(0);
 		    }
@@ -2568,7 +2528,7 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2528
 		    }
 		| k_begin
 		    {
-			$<val>1 = cmdarg_stack;
+			$<val>1 = p->cmdarg_stack;
 			CMDARG_SET(0);
 		    }
 		  bodystmt
@@ -2598,7 +2558,7 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2558
 		    }
 		| tLPAREN_ARG
 		    {
-			$<val>1 = cmdarg_stack;
+			$<val>1 = p->cmdarg_stack;
 			CMDARG_SET(0);
 		    }
 		  stmt {SET_LEX_STATE(EXPR_ENDARG);} rparen
@@ -2683,9 +2643,9 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2643
 			$$ = dispatch0(yield0);
 		    %*/
 		    }
-		| keyword_defined opt_nl '(' {in_defined = 1;} expr rparen
+		| keyword_defined opt_nl '(' {p->in_defined = 1;} expr rparen
 		    {
-			in_defined = 0;
+			p->in_defined = 0;
 			$$ = new_defined($5, &@$);
 		    }
 		| keyword_not '(' expr rparen
@@ -2842,12 +2802,12 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2802
 		    }
 		| k_class cpath superclass
 		    {
-			if (in_def) {
+			if (p->in_def) {
 			    YYLTYPE loc = code_loc_gen(&@1, &@2);
 			    yyerror1(&loc, "class definition in method body");
 			}
-			$<num>1 = in_class;
-			in_class = 1;
+			$<num>1 = p->in_class;
+			p->in_class = 1;
 			local_push(0);
 		    }
 		  bodystmt
@@ -2862,13 +2822,13 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2822
 			$$ = dispatch3(class, $2, $3, $5);
 		    %*/
 			local_pop();
-			in_class = $<num>1 & 1;
+			p->in_class = $<num>1 & 1;
 		    }
 		| k_class tLSHFT expr
 		    {
-			$<num>$ = (in_class << 1) | in_def;
-			in_def = 0;
-			in_class = 0;
+			$<num>$ = (p->in_class << 1) | p->in_def;
+			p->in_def = 0;
+			p->in_class = 0;
 			local_push(0);
 		    }
 		  term
@@ -2884,17 +2844,17 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2844
 			$$ = dispatch2(sclass, $3, $6);
 		    %*/
 			local_pop();
-			in_def = $<num>4 & 1;
-			in_class = ($<num>4 >> 1) & 1;
+			p->in_def = $<num>4 & 1;
+			p->in_class = ($<num>4 >> 1) & 1;
 		    }
 		| k_module cpath
 		    {
-			if (in_def) {
+			if (p->in_def) {
 			    YYLTYPE loc = code_loc_gen(&@1, &@2);
 			    yyerror1(&loc, "module definition in method body");
 			}
-			$<num>1 = in_class;
-			in_class = 1;
+			$<num>1 = p->in_class;
+			p->in_class = 1;
 			local_push(0);
 		    }
 		  bodystmt
@@ -2909,17 +2869,17 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2869
 			$$ = dispatch2(module, $2, $4);
 		    %*/
 			local_pop();
-			in_class = $<num>1 & 1;
+			p->in_class = $<num>1 & 1;
 		    }
 		| k_def fname
 		    {
 			local_push(0);
-			$<id>$ = current_arg;
-			current_arg = 0;
+			$<id>$ = p->cur_arg;
+			p->cur_arg = 0;
 		    }
 		    {
-			$<num>$ = in_def;
-			in_def = 1;
+			$<num>$ = p->in_def;
+			p->in_def = 1;
 		    }
 		  f_arglist
 		  bodystmt
@@ -2935,17 +2895,17 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2895
 			$$ = dispatch3(def, $2, $5, $6);
 		    %*/
 			local_pop();
-			in_def = $<num>4 & 1;
-			current_arg = $<id>3;
+			p->in_def = $<num>4 & 1;
+			p->cur_arg = $<id>3;
 		    }
 		| k_def singleton dot_or_colon {SET_LEX_STATE(EXPR_FNAME);} fname
 		    {
-			$<num>4 = in_def;
-			in_def = 1;
+			$<num>4 = p->in_def;
+			p->in_def = 1;
 			SET_LEX_STATE(EXPR_ENDFN|EXPR_LABEL); /* force for args */
 			local_push(0);
-			$<id>$ = current_arg;
-			current_arg = 0;
+			$<id>$ = p->cur_arg;
+			p->cur_arg = 0;
 		    }
 		  f_arglist
 		  bodystmt
@@ -2961,8 +2921,8 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2921
 			$$ = dispatch5(defs, $2, $<val>3, $5, $7, $8);
 		    %*/
 			local_pop();
-			in_def = $<num>4 & 1;
-			current_arg = $<id>6;
+			p->in_def = $<num>4 & 1;
+			p->cur_arg = $<id>6;
 		    }
 		| keyword_break
 		    {
@@ -3078,7 +3038,7 @@ k_end		: keyword_end https://github.com/ruby/ruby/blob/trunk/parse.y#L3038
 
 k_return	: keyword_return
 		    {
-			if (in_class && !in_def && !dyna_in_block())
+			if (p->in_class && !p->in_def && !dyna_in_block())
 			    yyerror1(&@1, "Invalid return in class/module body");
 		    }
 		;
@@ -3348,13 +3308,13 @@ block_param	: f_arg ',' f_block_optarg ' https://github.com/ruby/ruby/blob/trunk/parse.y#L3308
 opt_block_param	: none
 		| block_param_def
 		    {
-			command_start = TRUE;
+			p->command_start = TRUE;
 		    }
 		;
 
 block_param_def	: '|' opt_bv_decl '|'
 		    {
-			current_arg = 0;
+			p->cur_arg = 0;
 		    /*%%%*/
 			$$ = 0;
 		    /*%
@@ -3373,7 +3333,7 @@ block_param_def	: '|' opt_bv_decl '|' https://github.com/ruby/ruby/blob/trunk/parse.y#L3333
 		    }
 		| '|' block_param opt_bv_decl '|'
 		    {
-			current_arg = 0;
+			p->cur_arg = 0;
 		    /*%%%*/
 			$$ = $2;
 		    /*%
@@ -3431,17 +3391,17 @@ lambda		:   { https://github.com/ruby/ruby/blob/trunk/parse.y#L3391
 			$<vars>$ = dyna_push();
 		    }
 		    {
-			$<num>$ = lpar_beg;
-			lpar_beg = paren_nest;
+			$<num>$ = p->lex.lpar_beg;
+			p->lex.lpar_beg = p->lex.paren_nest;
 		    }
 		  f_larglist
 		    {
-			$<val>$ = cmdarg_stack;
+			$<val>$ = p->cmdarg_stack;
 			CMDARG_SET(0);
 		    }
 		  lambda_body
 		    {
-			lpar_beg = $<num>2;
+			p->lex.lpar_beg = $<num>2;
 			CMDARG_SET($<val>4);
 			CMDARG_POP();
 		    /*%%%*/
@@ -3618,7 +3578,7 @@ brace_block	: '{' brace_body '}' https://github.com/ruby/ruby/blob/trunk/parse.y#L3578
 		;
 
 brace_body	: {$<vars>$ = dyna_push();}
-		  {$<val>$ = cmdarg_stack >> 1; CMDARG_SET(0);}
+		  {$<val>$ = p->cmdarg_stack >> 1; CMDARG_SET(0);}
 		  opt_block_param compstmt
 		    {
 			$$ = new_brace_body($3, $4, &@$);
@@ -3628,7 +3588,7 @@ brace_body	: {$<vars>$ = dyna_push();} https://github.com/ruby/ruby/blob/trunk/parse.y#L3588
 		;
 
 do_body 	: {$<vars>$ = dyna_push();}
-		  {$<val>$ = cmdarg_stack; CMDARG_SET(0);}
+		  {$<val>$ = p->cmdarg_stack; CMDARG_SET(0);}
 		  opt_block_param bodystmt
 		    {
 			$$ = new_do_body($3, $4, &@$);
@@ -4020,14 +3980,14 @@ string_content	: tSTRING_CONTENT https://github.com/ruby/ruby/blob/trunk/parse.y#L3980
 		    }
 		| tSTRING_DVAR
 		    {
-			/* need to backup lex_strterm so that a string literal `%&foo,#$&,bar&` can be parsed */
-			$<strterm>$ = lex_strterm;
-			lex_strterm = 0;
+			/* need to backup p->lex.strterm so that a string literal `%&foo,#$&,bar&` can be parsed */
+			$<strterm>$ = p->lex.strterm;
+			p->lex.strterm = 0;
 			SET_LEX_STATE(EXPR_BEG);
 		    }
 		  string_dvar
 		    {
-			lex_strterm = $<strterm>2;
+			p->lex.strterm = $<strterm>2;
 		    /*%%%*/
 			$$ = NEW_EVSTR($3, &@$);
 			nd_set_line($$, @3.end_pos.lineno);
@@ -4037,37 +3997,37 @@ string_content	: tSTRING_CONTENT https://github.com/ruby/ruby/blob/trunk/parse.y#L3997
 		    }
 		| tSTRING_DBEG
 		    {
-			$<val>1 = cond_stack;
-			$<val>$ = cmdarg_stack;
+			$<val>1 = p->cond_stack;
+			$<val>$ = p->cmdarg_stack;
 			COND_SET(0);
 			CMDARG_SET(0);
 		    }
 		    {
-			/* need to backup lex_strterm so that a string literal `%!foo,#{ !0 },bar!` can be parsed */
-			$<strterm>$ = lex_strterm;
-			lex_strterm = 0;
+			/* need to backup p->lex.strterm so that a string literal `%!foo,#{ !0 },bar!` can be parsed */
+			$<strterm>$ = p->lex.strterm;
+			p->lex.strterm = 0;
 		    }
 		    {
-			$<num>$ = lex_state;
+			$<num>$ = p->lex.state;
 			SET_LEX_STATE(EXPR_BEG);
 		    }
 		    {
-			$<num>$ = brace_nest;
-			brace_nest = 0;
+			$<num>$ = p->lex.brace_nest;
+			p->lex.brace_nest = 0;
 		    }
 		    {
-			$<num>$ = heredoc_indent;
-			heredoc_indent = 0;
+			$<num>$ = p->heredoc_indent;
+			p->heredoc_indent = 0;
 		    }
 		  compstmt tSTRING_DEND
 		    {
 			COND_SET($<val>1);
 			CMDARG_SET($<val>2);
-			lex_strterm = $<strterm>3;
+			p->lex.strterm = $<strterm>3;
 			SET_LEX_STATE($<num>4);
-			brace_nest = $<num>5;
-			heredoc_indent = $<num>6;
-			heredoc_line_indent = -1;
+			p->lex.brace_nest = $<num>5;
+			p->heredoc_indent = $<num>6;
+			p->heredoc_line_indent = -1;
 		    /*%%%*/
 			if ($7) $7->flags &= ~NODE_FL_NEWLINE;
 			$$ = new_evstr($7, &@$);
@@ -4242,7 +4202,7 @@ backref		: tNTH_REF https://github.com/ruby/ruby/blob/trunk/parse.y#L4202
 superclass	: '<'
 		    {
 			SET_LEX_STATE(EXPR_BEG);
-			command_start = TRUE;
+			p->command_start = TRUE;
 		    }
 		  expr_value term
 		    {
@@ -4266,19 +4226,19 @@ f_arglist	: '(' f_args rparen https://github.com/ruby/ruby/blob/trunk/parse.y#L4226
 			$$ = dispatch1(paren, $2);
 		    %*/
 			SET_LEX_STATE(EXPR_BEG);
-			command_start = TRUE;
+			p->command_start = TRUE;
 		    }
 		|   {
 			$<num>$ = p->in_kwarg;
 			p->in_kwarg = 1;
-			SET_LEX_STATE(lex_state|EXPR_LABEL); /* force for args */
+			SET_LEX_STATE(p->lex.state|EXPR_LABEL); /* force for args */
 		    }
 		    f_args term
 		    {
 			p->in_kwarg = !!$<num>1;
 			$$ = $2;
 			SET_LEX_STATE(EXPR_BEG);
-			command_start = TRUE;
+			p->command_start = TRUE;
 		    }
 		;
 
@@ -4427,14 +4387,14 @@ f_arg_asgn	: f_norm_arg https://github.com/ruby/ruby/blob/trunk/parse.y#L4387
 		    {
 			ID id = get_id($1);
 			arg_var(id);
-			current_arg = id;
+			p->cur_a (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]