Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
19: Make regexps use encoding from options explicit encodings in a ro…
…undabout way...
  • Loading branch information
enebo committed Oct 18, 2011
1 parent 18959d6 commit 37fc115
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/jruby/parser/ParserSupport.java
Expand Up @@ -1623,15 +1623,19 @@ public Node newRegexpNode(ISourcePosition position, Node contents, RegexpNode en

for (Node fragment: dStrNode.childNodes()) {
if (fragment instanceof StrNode) {
regexpFragmentCheck(end, ((StrNode) fragment).getValue());
ByteList frag = ((StrNode) fragment).getValue();
regexpFragmentCheck(end, frag);
encoding = frag.getEncoding();
}
}

return new DRegexpNode(position, options, encoding).addAll((DStrNode) contents);
}

// EvStrNode: #{val}: no fragment check, but at least set encoding
regexpFragmentCheck(end, ByteList.create(""));
ByteList empty = ByteList.create("");
regexpFragmentCheck(end, empty);
encoding = empty.getEncoding();
return new DRegexpNode(position, options, encoding).add(contents);
}

Expand Down

0 comments on commit 37fc115

Please sign in to comment.