Commit 9a418e0f authored by Michal Nazarewicz's avatar Michal Nazarewicz
Browse files

Remove dead opcodes in regex bytecode

There is no way to specify before_dot and after_dot opcodes in a regex
so code handling those ends up being dead.  Remove it.

* src/regex.c (print_partial_compiled_pattern, regex_compile,
analyze_first, re_match_2_internal): Remove handling and references to
before_dot and after_dot opcodes.
parent 4538a5e3
...@@ -669,9 +669,7 @@ typedef enum ...@@ -669,9 +669,7 @@ typedef enum
notsyntaxspec notsyntaxspec
#ifdef emacs #ifdef emacs
,before_dot, /* Succeeds if before point. */ , at_dot, /* Succeeds if at point. */
at_dot, /* Succeeds if at point. */
after_dot, /* Succeeds if after point. */
/* Matches any character whose category-set contains the specified /* Matches any character whose category-set contains the specified
category. The operator is followed by a byte which contains a category. The operator is followed by a byte which contains a
...@@ -1053,18 +1051,10 @@ print_partial_compiled_pattern (re_char *start, re_char *end) ...@@ -1053,18 +1051,10 @@ print_partial_compiled_pattern (re_char *start, re_char *end)
break; break;
# ifdef emacs # ifdef emacs
case before_dot:
fprintf (stderr, "/before_dot");
break;
case at_dot: case at_dot:
fprintf (stderr, "/at_dot"); fprintf (stderr, "/at_dot");
break; break;
case after_dot:
fprintf (stderr, "/after_dot");
break;
case categoryspec: case categoryspec:
fprintf (stderr, "/categoryspec"); fprintf (stderr, "/categoryspec");
mcnt = *p++; mcnt = *p++;
...@@ -3440,8 +3430,6 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax, ...@@ -3440,8 +3430,6 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
goto normal_char; goto normal_char;
#ifdef emacs #ifdef emacs
/* There is no way to specify the before_dot and after_dot
operators. rms says this is ok. --karl */
case '=': case '=':
laststart = b; laststart = b;
BUF_PUSH (at_dot); BUF_PUSH (at_dot);
...@@ -4018,9 +4006,7 @@ analyze_first (const_re_char *p, const_re_char *pend, char *fastmap, ...@@ -4018,9 +4006,7 @@ analyze_first (const_re_char *p, const_re_char *pend, char *fastmap,
/* All cases after this match the empty string. These end with /* All cases after this match the empty string. These end with
`continue'. */ `continue'. */
case before_dot:
case at_dot: case at_dot:
case after_dot:
#endif /* !emacs */ #endif /* !emacs */
case no_op: case no_op:
case begline: case begline:
...@@ -6148,24 +6134,12 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, ...@@ -6148,24 +6134,12 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
break; break;
#ifdef emacs #ifdef emacs
case before_dot:
DEBUG_PRINT ("EXECUTING before_dot.\n");
if (PTR_BYTE_POS (d) >= PT_BYTE)
goto fail;
break;
case at_dot: case at_dot:
DEBUG_PRINT ("EXECUTING at_dot.\n"); DEBUG_PRINT ("EXECUTING at_dot.\n");
if (PTR_BYTE_POS (d) != PT_BYTE) if (PTR_BYTE_POS (d) != PT_BYTE)
goto fail; goto fail;
break; break;
case after_dot:
DEBUG_PRINT ("EXECUTING after_dot.\n");
if (PTR_BYTE_POS (d) <= PT_BYTE)
goto fail;
break;
case categoryspec: case categoryspec:
case notcategoryspec: case notcategoryspec:
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment