# Verify get errors. For these, we need // or else puts it in single quotes,
# and bypasses the lexer.
/\N{U+}/ - c - Invalid hexadecimal number
-# Below currently gives a misleading message
-/[\N{U+}]/ - Sc - Unmatched
-/[\N{U+}]/ - sc - Syntax error in (?[...])
+/[\N{U+}]/ - c - Invalid hexadecimal number
/abc\N{def/ - c - Missing right brace
/\N{U+4AG3}/ - c - Invalid hexadecimal number
-/[\N{U+4AG3}]/ - Sc - Unmatched
-/[\N{U+4AG3}]/ - sc - Syntax error in (?[...])
+/[\N{U+4AG3}]/ - c - Invalid hexadecimal number
# And verify that in single quotes which bypasses the lexer, the regex compiler
# figures it out.
s = PL_bufend;
}
else {
+ int save_error_count = PL_error_count;
+
s = scan_const(PL_bufptr);
+
+ /* Quit if this was a pattern and there were errors. This prevents
+ * us from trying to regex compile a broken pattern, which could
+ * lead to segfaults, etc. */
+ if (PL_lex_inpat && PL_error_count > save_error_count) {
+ yyquit();
+ }
if (*s == '\\')
PL_lex_state = LEX_INTERPCASEMOD;
else