diff src/regexp_nfa.c @ 28911:e25196adb7c1 v8.2.4978

patch 8.2.4978: no error if engine selection atom is not at the start Commit: https://github.com/vim/vim/commit/360da40b47a84ee8586c3b5d062f8c64a2ac9cc6 Author: Christian Brabandt <cb@256bit.org> Date: Wed May 18 15:04:02 2022 +0100 patch 8.2.4978: no error if engine selection atom is not at the start Problem: No error if engine selection atom is not at the start. Solution: Give an error. (Christian Brabandt, closes https://github.com/vim/vim/issues/10439)
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 May 2022 16:15:03 +0200
parents 786707ef91de
children f9775679df1f
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -1592,6 +1592,14 @@ nfa_regatom(void)
 		    break;
 
 		case '#':
+		    if (regparse[0] == '=' && regparse[1] >= 48
+							  && regparse[1] <= 50)
+		    {
+			// misplaced \%#=1
+			semsg(_(e_atom_engine_must_be_at_start_of_pattern),
+								  regparse[1]);
+			return FAIL;
+		    }
 		    EMIT(NFA_CURSOR);
 		    break;