printf ("no_sub: %d\t", bufp->no_sub);
printf ("not_bol: %d\t", bufp->not_bol);
printf ("not_eol: %d\t", bufp->not_eol);
+#ifndef emacs
printf ("syntax: %lx\n", bufp->syntax);
+#endif
fflush (stdout);
/* Perhaps we should print the translate table? */
}
/* Subroutine declarations and macros for regex_compile. */
static reg_errcode_t regex_compile (re_char *pattern, size_t size,
- reg_syntax_t syntax,
#ifdef emacs
+ bool posix_backtracking,
const char *whitespace_regexp,
+#else
+ reg_syntax_t syntax,
#endif
struct re_pattern_buffer *bufp);
static void store_op1 (re_opcode_t op, unsigned char *loc, int arg);
} while (0)
static reg_errcode_t
-regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
+regex_compile (const_re_char *pattern, size_t size,
#ifdef emacs
+# define syntax RE_SYNTAX_EMACS
+ bool posix_backtracking,
const char *whitespace_regexp,
+#else
+ reg_syntax_t syntax,
+# define posix_backtracking (!(syntax & RE_NO_POSIX_BACKTRACKING))
#endif
struct re_pattern_buffer *bufp)
{
range_table_work.allocated = 0;
/* Initialize the pattern buffer. */
+#ifndef emacs
bufp->syntax = syntax;
+#endif
bufp->fastmap_accurate = 0;
bufp->not_bol = bufp->not_eol = 0;
bufp->used_syntax = 0;
/* 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)
+ if (!posix_backtracking)
BUF_PUSH (succeed);
/* We have succeeded; set the length of the buffer. */
#endif /* not MATCH_MAY_ALLOCATE */
FREE_STACK_RETURN (REG_NOERROR);
+
+#ifdef emacs
+# undef syntax
+#else
+# undef posix_backtracking
+#endif
} /* regex_compile */
\f
/* Subroutines for `regex_compile'. */
{
int buf_charlen;
re_wchar_t buf_ch;
+ reg_syntax_t syntax;
DEBUG_PRINT ("EXECUTING anychar.\n");
target_multibyte);
buf_ch = TRANSLATE (buf_ch);
- if ((!(bufp->syntax & RE_DOT_NEWLINE)
- && buf_ch == '\n')
- || ((bufp->syntax & RE_DOT_NOT_NULL)
- && buf_ch == '\000'))
+#ifdef emacs
+ syntax = RE_SYNTAX_EMACS;
+#else
+ syntax = bufp->syntax;
+#endif
+
+ if ((!(syntax & RE_DOT_NEWLINE) && buf_ch == '\n')
+ || ((syntax & RE_DOT_NOT_NULL) && buf_ch == '\000'))
goto fail;
DEBUG_PRINT (" Matched \"%d\".\n", *d);
const char *
re_compile_pattern (const char *pattern, size_t length,
#ifdef emacs
- reg_syntax_t syntax, const char *whitespace_regexp,
+ bool posix_backtracking, const char *whitespace_regexp,
#endif
struct re_pattern_buffer *bufp)
{
ret = regex_compile ((re_char*) pattern, length,
#ifdef emacs
- syntax,
+ posix_backtracking,
whitespace_regexp,
#else
re_syntax_options,
/* Number of bytes actually used in `buffer'. */
size_t used;
+#ifndef emacs
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;
-
+#endif
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
the fastmap, if there is one, to skip over impossible
starting points for matches. */
BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
#ifdef emacs
- reg_syntax_t syntax,
+ bool posix_backtracking,
const char *whitespace_regexp,
#endif
struct re_pattern_buffer *__buffer);
Lisp_Object translate, bool posix)
{
const char *whitespace_regexp;
- reg_syntax_t syntax;
char *val;
cp->regexp = Qnil;
So let's turn it off. */
/* BLOCK_INPUT; */
- syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING);
whitespace_regexp = STRINGP (Vsearch_spaces_regexp) ?
SSDATA (Vsearch_spaces_regexp) : NULL;
val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern),
- syntax, whitespace_regexp, &cp->buf);
+ posix, whitespace_regexp, &cp->buf);
/* If the compiled pattern hard codes some of the contents of the
syntax-table, it can only be reused with *this* syntax table. */