Skip to content

Commit

Permalink
Showing 10 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
jar 'com.github.jnr:jffi:${jffi.version}'
jar 'com.github.jnr:jffi:${jffi.version}:native'

jar 'org.jruby.joni:joni:2.1.14'
jar 'org.jruby.joni:joni:2.1.15'
jar 'org.jruby.extras:bytelist:1.0.15'
jar 'org.jruby.jcodings:jcodings:1.0.27'
jar 'org.jruby:dirgra:0.3'
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -173,7 +173,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>org.jruby.joni</groupId>
<artifactId>joni</artifactId>
<version>2.1.14</version>
<version>2.1.15</version>
</dependency>
<dependency>
<groupId>org.jruby.extras</groupId>
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyInteger.java
Original file line number Diff line number Diff line change
@@ -362,7 +362,7 @@ public RubyString chr(ThreadContext context) {

Encoding enc;

if (0xff < i) {
if (i > 0xff) {
enc = runtime.getDefaultInternalEncoding();
if (enc == null) {
throw runtime.newRangeError(toString() + " out of char range");
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -168,6 +168,7 @@ public Encoding getEncoding() {

@Override
public void setEncoding(Encoding encoding) {
modify();
value.setEncoding(encoding);
}

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

protected RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, Encoding enc, int cr) {
this(runtime, rubyClass, value);
value.setEncoding(enc);
flags |= cr;
value.setEncoding(enc);
}

protected RubyString(Ruby runtime, RubyClass rubyClass, ByteList value, Encoding enc) {
7 changes: 2 additions & 5 deletions core/src/main/java/org/jruby/lexer/LexingCommon.java
Original file line number Diff line number Diff line change
@@ -352,15 +352,12 @@ public int peekVariableName(int tSTRING_DVAR, int tSTRING_DBEG) throws IOExcepti
commandStart = true;
return tSTRING_DBEG;
default:
// We did not find significant char after # so push it back to
// be processed as an ordinary string.
pushback(c);
return 0;
}

pushback(c);

// We found #@, #$, #@@ but we don't know what at this point (check for valid chars).
if (significant != -1 && Character.isAlphabetic(significant) || significant == '_') {
pushback(c);
setValue("#" + significant);
return tSTRING_DVAR;
}
12 changes: 5 additions & 7 deletions core/src/main/java/org/jruby/lexer/yacc/StringTerm.java
Original file line number Diff line number Diff line change
@@ -87,6 +87,7 @@ private int endFound(RubyLexer lexer) throws IOException {
}

lexer.setValue("" + end);

return RubyParser.tSTRING_END;
}

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

if (token != 0) {
return token;
} else {
buffer.append(c);
}
} else {
lexer.pushback(c);
if (token != 0) return token;

buffer.append('#'); // not an expansion to variable so it is just a literal.
}
lexer.pushback(c); // pushback API is deceptive here...we are just pushing index back one and not pushing c back necessarily.

Encoding enc[] = new Encoding[1];
enc[0] = lexer.getEncoding();
2 changes: 1 addition & 1 deletion lib/pom.rb
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ def initialize( name, version, default_spec = true )
default_gems =
[
ImportedGem.new( 'jruby-openssl', '0.9.21' ),
ImportedGem.new( 'jruby-readline', '1.2.1' ),
ImportedGem.new( 'jruby-readline', '1.2.2' ),
ImportedGem.new( 'rake', '${rake.version}' ),
ImportedGem.new( 'rdoc', '${rdoc.version}' ),
ImportedGem.new( 'minitest', '${minitest.version}' ),
2 changes: 1 addition & 1 deletion lib/pom.xml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-readline</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
1 change: 0 additions & 1 deletion lib/ruby/stdlib/date.rb
Original file line number Diff line number Diff line change
@@ -1948,5 +1948,4 @@ def to_datetime

private_class_method :today
public_class_method :now

end
9 changes: 9 additions & 0 deletions spec/ruby/language/string_spec.rb
Original file line number Diff line number Diff line change
@@ -42,6 +42,15 @@
"#@ip#@ip".should == 'xxxxxx'
end

it "don't get confused by partial interpolation character sequences" do
"#@".should == '#@'
"#@ ".should == '#@ '
"#@@".should == '#@@'
"#@@ ".should == '#@@ '
"#$ ".should == '#$ '
"#\$".should == '#$'
end

it "taints the result of interpolation when an interpolated value is tainted" do
"#{"".taint}".tainted?.should be_true

0 comments on commit 3a97ae7

Please sign in to comment.