Skip to content

Commit 3a97ae7

Browse files
committedFeb 23, 2018
Merge branch 'master' into ruby-2.5
2 parents f9a47c6 + 7924a80 commit 3a97ae7

File tree

10 files changed

+23
-19
lines changed

10 files changed

+23
-19
lines changed
 

Diff for: ‎core/pom.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
jar 'com.github.jnr:jffi:${jffi.version}'
5353
jar 'com.github.jnr:jffi:${jffi.version}:native'
5454

55-
jar 'org.jruby.joni:joni:2.1.14'
55+
jar 'org.jruby.joni:joni:2.1.15'
5656
jar 'org.jruby.extras:bytelist:1.0.15'
5757
jar 'org.jruby.jcodings:jcodings:1.0.27'
5858
jar 'org.jruby:dirgra:0.3'

Diff for: ‎core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ DO NOT MODIFIY - GENERATED CODE
173173
<dependency>
174174
<groupId>org.jruby.joni</groupId>
175175
<artifactId>joni</artifactId>
176-
<version>2.1.14</version>
176+
<version>2.1.15</version>
177177
</dependency>
178178
<dependency>
179179
<groupId>org.jruby.extras</groupId>

Diff for: ‎core/src/main/java/org/jruby/RubyInteger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public RubyString chr(ThreadContext context) {
362362

363363
Encoding enc;
364364

365-
if (0xff < i) {
365+
if (i > 0xff) {
366366
enc = runtime.getDefaultInternalEncoding();
367367
if (enc == null) {
368368
throw runtime.newRangeError(toString() + " out of char range");

Diff for: ‎core/src/main/java/org/jruby/RubyString.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public Encoding getEncoding() {
168168

169169
@Override
170170
public void setEncoding(Encoding encoding) {
171+
modify();
171172
value.setEncoding(encoding);
172173
}
173174

@@ -385,8 +386,8 @@ public RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, Encoding en
385386

386387
protected RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, Encoding enc, int cr) {
387388
this(runtime, rubyClass, value);
388-
value.setEncoding(enc);
389389
flags |= cr;
390+
value.setEncoding(enc);
390391
}
391392

392393
protected RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, Encoding enc) {

Diff for: ‎core/src/main/java/org/jruby/lexer/LexingCommon.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,12 @@ public int peekVariableName(int tSTRING_DVAR, int tSTRING_DBEG) throws IOExcepti
352352
commandStart = true;
353353
return tSTRING_DBEG;
354354
default:
355-
// We did not find significant char after # so push it back to
356-
// be processed as an ordinary string.
357-
pushback(c);
358355
return 0;
359356
}
360357

361-
pushback(c);
362-
358+
// We found #@, #$, #@@ but we don't know what at this point (check for valid chars).
363359
if (significant != -1 && Character.isAlphabetic(significant) || significant == '_') {
360+
pushback(c);
364361
setValue("#" + significant);
365362
return tSTRING_DVAR;
366363
}

Diff for: ‎core/src/main/java/org/jruby/lexer/yacc/StringTerm.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ private int endFound(RubyLexer lexer) throws IOException {
8787
}
8888

8989
lexer.setValue("" + end);
90+
9091
return RubyParser.tSTRING_END;
9192
}
9293

@@ -118,14 +119,11 @@ public int parseString(RubyLexer lexer) throws IOException {
118119
if ((flags & STR_FUNC_EXPAND) != 0 && c == '#') {
119120
int token = lexer.peekVariableName(RubyParser.tSTRING_DVAR, RubyParser.tSTRING_DBEG);
120121

121-
if (token != 0) {
122-
return token;
123-
} else {
124-
buffer.append(c);
125-
}
126-
} else {
127-
lexer.pushback(c);
122+
if (token != 0) return token;
123+
124+
buffer.append('#'); // not an expansion to variable so it is just a literal.
128125
}
126+
lexer.pushback(c); // pushback API is deceptive here...we are just pushing index back one and not pushing c back necessarily.
129127

130128
Encoding enc[] = new Encoding[1];
131129
enc[0] = lexer.getEncoding();

Diff for: ‎lib/pom.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def initialize( name, version, default_spec = true )
2727
default_gems =
2828
[
2929
ImportedGem.new( 'jruby-openssl', '0.9.21' ),
30-
ImportedGem.new( 'jruby-readline', '1.2.1' ),
30+
ImportedGem.new( 'jruby-readline', '1.2.2' ),
3131
ImportedGem.new( 'rake', '${rake.version}' ),
3232
ImportedGem.new( 'rdoc', '${rdoc.version}' ),
3333
ImportedGem.new( 'minitest', '${minitest.version}' ),

Diff for: ‎lib/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ DO NOT MODIFIY - GENERATED CODE
4747
<dependency>
4848
<groupId>rubygems</groupId>
4949
<artifactId>jruby-readline</artifactId>
50-
<version>1.2.1</version>
50+
<version>1.2.2</version>
5151
<type>gem</type>
5252
<scope>provided</scope>
5353
<exclusions>

Diff for: ‎lib/ruby/stdlib/date.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1948,5 +1948,4 @@ def to_datetime
19481948

19491949
private_class_method :today
19501950
public_class_method :now
1951-
19521951
end

Diff for: ‎spec/ruby/language/string_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@
4242
"#@ip#@ip".should == 'xxxxxx'
4343
end
4444

45+
it "don't get confused by partial interpolation character sequences" do
46+
"#@".should == '#@'
47+
"#@ ".should == '#@ '
48+
"#@@".should == '#@@'
49+
"#@@ ".should == '#@@ '
50+
"#$ ".should == '#$ '
51+
"#\$".should == '#$'
52+
end
53+
4554
it "taints the result of interpolation when an interpolated value is tainted" do
4655
"#{"".taint}".tainted?.should be_true
4756

0 commit comments

Comments
 (0)
Please sign in to comment.