{
no_op = 0,
+ /* Succeed right away--no more backtracking. */
+ succeed,
+
/* Followed by one byte giving n, then by n literal bytes. */
exactn,
/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
also be assigned to arbitrarily: each pattern buffer stores its own
syntax, so it can be changed between regex compilations. */
-reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
+/* This has no initializer because initialized variables in Emacs
+ become read-only after dumping. */
+reg_syntax_t re_syntax_options;
/* Specify the precise syntax of regexps for compilation. This provides
if (!COMPILE_STACK_EMPTY)
FREE_STACK_RETURN (REG_EPAREN);
+ /* If we don't want backtracking, force success
+ the first time we reach the end of the compiled pattern. */
+ if (syntax & RE_NO_POSIX_BACKTRACKING)
+ BUF_PUSH (succeed);
+
free (compile_stack.stack);
/* We have succeeded; set the length of the buffer. */
}
} /* d != end_match_2 */
+ succeed:
DEBUG_PRINT1 ("Accepting match.\n");
/* If caller wants register contents data back, do it. */
DEBUG_PRINT1 ("EXECUTING no_op.\n");
break;
+ case succeed:
+ DEBUG_PRINT1 ("EXECUTING succeed.\n");
+ goto succeed;
/* Match the next n pattern characters exactly. The following
byte in the pattern defines n, and the n bytes after that