Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into truffle-head
  • Loading branch information
eregon committed Feb 16, 2015
2 parents b9af305 + 8f81e15 commit d4a27a5
Show file tree
Hide file tree
Showing 59 changed files with 162 additions and 376 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Expand Up @@ -1758,12 +1758,12 @@ private void initBuiltins() {
addLazyBuiltin("ffi-internal.jar", "ffi-internal", "org.jruby.ext.ffi.FFIService");
addLazyBuiltin("tempfile.jar", "tempfile", "org.jruby.ext.tempfile.TempfileLibrary");
addLazyBuiltin("fcntl.rb", "fcntl", "org.jruby.ext.fcntl.FcntlLibrary");
addLazyBuiltin("yecht.jar", "yecht", "YechtService");
addLazyBuiltin("pathname.jar", "pathname", "org.jruby.ext.pathname.PathnameLibrary");

addLazyBuiltin("mathn/complex.jar", "mathn/complex", "org.jruby.ext.mathn.Complex");
addLazyBuiltin("mathn/rational.jar", "mathn/rational", "org.jruby.ext.mathn.Rational");
addLazyBuiltin("psych.jar", "psych", "org.jruby.ext.psych.PsychLibrary");
addLazyBuiltin("ripper.jar", "ripper", "org.jruby.ext.ripper.RipperLibrary");
addLazyBuiltin("coverage.jar", "coverage", "org.jruby.ext.coverage.CoverageLibrary");

// TODO: implement something for these?
Expand Down
16 changes: 4 additions & 12 deletions core/src/main/java/org/jruby/RubyString.java
Expand Up @@ -2582,18 +2582,10 @@ private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString
private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString repl,
RubyHash hash, IRubyObject arg0, final boolean bang, int tuFlags, boolean useBackref) {
Ruby runtime = context.runtime;

final Regex pattern, prepared;
final RubyRegexp regexp;
if (arg0 instanceof RubyRegexp) {
regexp = (RubyRegexp)arg0;
pattern = regexp.getPattern();
prepared = regexp.preparePattern(this);
} else {
regexp = null;
pattern = getStringPattern19(runtime, arg0);
prepared = RubyRegexp.preparePattern(runtime, pattern, this);
}
RubyRegexp regexp = arg0 instanceof RubyRegexp ? (RubyRegexp) arg0 :
RubyRegexp.newRegexp(runtime, RubyRegexp.quote19(getStringForPattern(arg0).getByteList(), false), new RegexpOptions());
Regex pattern = regexp.getPattern();
Regex prepared = regexp.preparePattern(this);

int offset, cp, n, blen;

Expand Down
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/parser/Parser.java
Expand Up @@ -127,9 +127,16 @@ public Node parse(String file, LexerSource lexerSource, DynamicScope blockScope,
case NOT_ASCII_COMPATIBLE:
throw runtime.newArgumentError(e.getMessage());
default:
int line = e.getPosition().getLine();

// Detailed source positions always have the right line number so they don't need to be adjusted.
if (! (e.getPosition() instanceof DetailedSourcePosition)) {
line++;
}

StringBuilder buffer = new StringBuilder(100);
buffer.append(e.getPosition().getFile()).append(':');
buffer.append(e.getPosition().getLine() + 1).append(": ");
buffer.append(line).append(": ");
buffer.append(e.getMessage());

throw runtime.newSyntaxError(buffer.toString());
Expand Down
Expand Up @@ -165,6 +165,17 @@ public void testRegression2() {
// assertEquals(8, position.getLength());
}

public void testSyntaxError() {
try {
parse("3.to_i(\n");
} catch (org.jruby.exceptions.RaiseException e) {
final String syntaxErrorMessage = e.getException().message.asJavaString();

// There's no easy way to get at the source position information, but it is embedded in the syntax error message.
assertEquals("test:1: syntax error, unexpected end-of-file\n", syntaxErrorMessage);
}
}

private class FoundException extends RuntimeException {

private final Node node;
Expand Down
3 changes: 0 additions & 3 deletions ext/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions ext/.project

This file was deleted.

2 changes: 0 additions & 2 deletions ext/.settings/org.eclipse.core.resources.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions ext/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

17 changes: 0 additions & 17 deletions ext/pom.rb

This file was deleted.

30 changes: 0 additions & 30 deletions ext/pom.xml

This file was deleted.

26 changes: 0 additions & 26 deletions ext/ripper/.classpath

This file was deleted.

23 changes: 0 additions & 23 deletions ext/ripper/.project

This file was deleted.

3 changes: 0 additions & 3 deletions ext/ripper/.settings/org.eclipse.core.resources.prefs

This file was deleted.

5 changes: 0 additions & 5 deletions ext/ripper/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions ext/ripper/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

30 changes: 0 additions & 30 deletions ext/ripper/License.txt

This file was deleted.

21 changes: 0 additions & 21 deletions ext/ripper/Mavenfile

This file was deleted.

7 changes: 0 additions & 7 deletions ext/ripper/Rakefile

This file was deleted.

18 changes: 0 additions & 18 deletions ext/ripper/nb-configuration.xml

This file was deleted.

0 comments on commit d4a27a5

Please sign in to comment.