mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	parse.y: CR in middle
* parse.y (parser_whole_match_p): treat CR in middle of a line as a mere whitespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									9af743fe0e
								
							
						
					
					
						commit
						c48b4209c2
					
				
					 3 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
Mon Aug 12 15:59:50 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* parse.y (parser_whole_match_p): treat CR in middle of a line as a
 | 
			
		||||
	  mere whitespace.
 | 
			
		||||
 | 
			
		||||
Mon Aug 12 15:16:58 2013  Koichi Sasada  <ko1@atdot.net>
 | 
			
		||||
 | 
			
		||||
	* class.c (rb_prepend_module): make T_ICLASS object shady because
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								parse.y
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -6375,7 +6375,11 @@ parser_whole_match_p(struct parser_params *parser,
 | 
			
		|||
	while (*p && ISSPACE(*p)) p++;
 | 
			
		||||
    }
 | 
			
		||||
    n = lex_pend - (p + len);
 | 
			
		||||
    if (n < 0 || (n > 0 && p[len] != '\n' && p[len] != '\r')) return FALSE;
 | 
			
		||||
    if (n < 0) return FALSE;
 | 
			
		||||
    if (n > 0 && p[len] != '\n') {
 | 
			
		||||
	if (p[len] != '\r') return FALSE;
 | 
			
		||||
	if (n <= 1 || p[len+1] != '\n') return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    return strncmp(eos, p, len) == 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -377,6 +377,14 @@ eom
 | 
			
		|||
    EOS
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_heredoc_cr
 | 
			
		||||
    assert_syntax_error("puts <<""EOS\n""ng\n""EOS\r""NO\n", /can't find string "EOS" anywhere before EOF/)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test__END___cr
 | 
			
		||||
    assert_syntax_error("__END__\r<<<<<\n", /unexpected <</)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  def not_label(x) @result = x; @not_label ||= nil end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue