Skip to content
Browse files

More agreement with MRI source for StrNode creation (this should allo…

…w heredocs to properly convert from USASCII to ASCII-8BIT)
  • Loading branch information...
1 parent d7d9ffc commit 06d99662526440b98fd5687ac24c4c77f22af793 @enebo enebo committed with yokolet
Showing with 3 additions and 2 deletions.
  1. +2 −2 src/org/jruby/lexer/yacc/HeredocTerm.java
  2. +1 −0 src/org/jruby/lexer/yacc/RubyYaccLexer.java
View
4 src/org/jruby/lexer/yacc/HeredocTerm.java
@@ -118,7 +118,7 @@ public int parseString(RubyYaccLexer lexer, LexerSource src) throws java.io.IOEx
syntaxError(src);
}
if (c != '\n') {
- lexer.yaccValue = new StrNode(lexer.getPosition(), str);
+ lexer.yaccValue = lexer.createStrNode(lexer.getPosition(), str, 0);
return Tokens.tSTRING_CONTENT;
}
str.append(src.read());
@@ -130,7 +130,7 @@ public int parseString(RubyYaccLexer lexer, LexerSource src) throws java.io.IOEx
src.unreadMany(lastLine);
lexer.setStrTerm(new StringTerm(-1, '\0', '\0'));
- lexer.yaccValue = new StrNode(position, str);
+ lexer.yaccValue = lexer.createStrNode(position, str, 0);
return Tokens.tSTRING_CONTENT;
}
View
1 src/org/jruby/lexer/yacc/RubyYaccLexer.java
@@ -516,6 +516,7 @@ protected boolean isMultiByteChar(int c) {
return encoding.codeToMbcLength(c) != 1;
}
+ // STR_NEW3/parser_str_new
public StrNode createStrNode(ISourcePosition position, ByteList buffer, int flags) {
Encoding bufferEncoding = buffer.getEncoding();
int codeRange = StringSupport.codeRangeScan(bufferEncoding, buffer);

0 comments on commit 06d9966

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