Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d3289dd23d83
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80d27f7ff25d
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 8, 2018

  1. Restore logic to bail on magic comment search if not found.

    Regression from recent Ripper fixes. Manifested as a failure when
    the "coding" comment has heavily mangled capitalization.
    headius committed Jan 8, 2018
    Copy the full SHA
    cd6c6dd View commit details
  2. Copy the full SHA
    80d27f7 View commit details
Showing with 14 additions and 7 deletions.
  1. +5 −2 core/src/main/java/org/jruby/ext/ripper/RipperLexer.java
  2. +9 −5 core/src/main/java/org/jruby/lexer/LexingCommon.java
7 changes: 5 additions & 2 deletions core/src/main/java/org/jruby/ext/ripper/RipperLexer.java
Original file line number Diff line number Diff line change
@@ -99,9 +99,12 @@ protected void ambiguousOperator(String op, String syn) {
parser.dispatch("on_operator_ambiguous", getRuntime().newSymbol(op), getRuntime().newString(syn));
}

protected void onMagicComment(String name, ByteList value) {
super.onMagicComment(name, value);
protected boolean onMagicComment(String name, ByteList value) {
boolean found = super.onMagicComment(name, value);

parser.dispatch("on_magic_comment", getRuntime().newString(name), getRuntime().newString(value));

return found;
}

private int getFloatToken(String number, int suffix) {
14 changes: 9 additions & 5 deletions core/src/main/java/org/jruby/lexer/LexingCommon.java
Original file line number Diff line number Diff line change
@@ -907,19 +907,23 @@ public boolean parser_magic_comment(ByteList magicLine) {
String name = magicLine.subSequence(beg, end).toString().replace('-', '_');
ByteList value = magicLine.makeShared(vbeg, vend - vbeg);

onMagicComment(name, value);
if (!onMagicComment(name, value)) return false;
}

return true;
}

protected void onMagicComment(String name, ByteList value) {
if ("coding".equals(name) || "encoding".equals(name)) {
protected boolean onMagicComment(String name, ByteList value) {
if ("coding".equalsIgnoreCase(name) || "encoding".equalsIgnoreCase(name)) {
magicCommentEncoding(value);
} else if ("frozen_string_literal".equals(name)) {
return true;
} else if ("frozen_string_literal".equalsIgnoreCase(name)) {
setCompileOptionFlag(name, value);
} else if ("warn_indent".equals(name)) {
return true;
} else if ("warn_indent".equalsIgnoreCase(name)) {
setTokenInfo(name, value);
return true;
}
return false;
}
}