mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Use chomp: option when chomp mode
Get rid of depending on using $/ internally in String#chomp!, and chomp the separator at once.
This commit is contained in:
		
							parent
							
								
									83b987054a
								
							
						
					
					
						commit
						6baa78bb78
					
				
				
				Notes:
				
					git
				
				2022-01-07 09:24:07 +09:00 
				
			
			
			
		
		
					 1 changed files with 3 additions and 3 deletions
				
			
		
							
								
								
									
										6
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								parse.y
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -13127,9 +13127,9 @@ parser_append_options(struct parser_params *p, NODE *node)
 | 
			
		|||
	    node = block_append(p, split, node);
 | 
			
		||||
	}
 | 
			
		||||
	if (p->do_chomp) {
 | 
			
		||||
	    NODE *chomp = NEW_CALL(NEW_GVAR(idLASTLINE, LOC),
 | 
			
		||||
				   rb_intern("chomp!"), 0, LOC);
 | 
			
		||||
	    node = block_append(p, chomp, node);
 | 
			
		||||
	    NODE *chomp = NEW_LIT(ID2SYM(rb_intern("chomp")), LOC);
 | 
			
		||||
	    chomp = list_append(p, NEW_LIST(chomp, LOC), NEW_TRUE(LOC));
 | 
			
		||||
	    irs = list_append(p, irs, NEW_HASH(chomp, LOC));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	node = NEW_WHILE(NEW_FCALL(idGets, irs, LOC), node, 1, LOC);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue