Skip to content
Browse files

Fix JRUBY-6544: CR at the end of String can cause SyntaxError

We should retain CR here in ByteArrayLexerSource.
  • Loading branch information...
1 parent 65e3fb4 commit 515bc517f6efd7ded16bb5ee61de51bb2b1608eb @BanzaiMan BanzaiMan committed Mar 19, 2012
View
7 spec/regression/JRUBY-6554_cr_at_end_of_string_can_cause_syntax_error.rb
@@ -0,0 +1,7 @@
+require 'rspec'
+
+describe 'JRUBY-6554: \r at end of string' do
+ it "does not cause SyntaxError when eval'd" do
+ lambda {eval "{:a => '\r'}"}.should_not raise_error SyntaxError
+ end
+end
View
1 src/org/jruby/lexer/yacc/ByteArrayLexerSource.java
@@ -167,6 +167,7 @@ private int forward(int c) {
// we double report \n
if ((c = read()) != '\n') {
unread(c);
+ c = '\r';
} else {
if (captureSource){
uncaptureFeature(c);

0 comments on commit 515bc51

Please sign in to comment.
Something went wrong with that request. Please try again.