Skip to content

Commit

Permalink
Fix literal regexp syntax errors to actually be SyntaxError.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 13, 2015
1 parent 9717929 commit 3ffcfa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 7 additions & 1 deletion core/src/main/java/org/jruby/parser/ParserSupport.java
Expand Up @@ -46,6 +46,7 @@
import org.jruby.ast.types.INameNode;
import org.jruby.common.IRubyWarnings;
import org.jruby.common.IRubyWarnings.ID;
import org.jruby.exceptions.RaiseException;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.lexer.yacc.ISourcePositionHolder;
import org.jruby.lexer.yacc.RubyLexer;
Expand Down Expand Up @@ -1222,8 +1223,13 @@ public Node arg_append(Node node1, Node node2) {
// MRI: reg_fragment_check
public void regexpFragmentCheck(RegexpNode end, ByteList value) {
setRegexpEncoding(end, value);
RubyRegexp.preprocessCheck(configuration.getRuntime(), value);
try {
RubyRegexp.preprocessCheck(configuration.getRuntime(), value);
} catch (RaiseException re) {
compile_error(re.getMessage());
}
} // 1.9 mode overrides to do extra checking...

private List<Integer> allocateNamedLocals(RegexpNode regexpNode) {
RubyRegexp pattern = RubyRegexp.newRegexp(configuration.getRuntime(), regexpNode.getValue(), regexpNode.getOptions());
pattern.setLiteral();
Expand Down
7 changes: 0 additions & 7 deletions test/mri/excludes/TestM17N.rb
@@ -1,18 +1,11 @@
exclude :test_delete, "needs investigation"
exclude :test_dynamic_eucjp_regexp, "needs investigation"
exclude :test_dynamic_sjis_regexp, "needs investigation"
exclude :test_dynamic_utf8_regexp, "needs investigation"
exclude :test_end_with, "needs investigation"
exclude :test_euc_tw, "needs investigation"
exclude :test_force_encoding, "needs investigation"
exclude :test_nonascii_method_name, "needs investigation"
exclude :test_object_inspect_external, "needs investigation"
exclude :test_object_utf16_32_inspect, "needs investigation"
exclude :test_regexp_ascii, "needs investigation"
exclude :test_regexp_mixed_unicode, "needs investigation"
exclude :test_regexp_too_short_multibyte_character, "needs investigation"
exclude :test_regexp_unicode, "needs investigation"
exclude :test_regexp_usascii, "needs investigation"
exclude :test_scrub, ""
exclude :test_sprintf_c, "format string encoding should be used to decode incoming fixnums"
exclude :test_str_concat, "needs investigation"
Expand Down

0 comments on commit 3ffcfa9

Please sign in to comment.