To: vim-dev@vim.org Subject: Patch 6.0.233 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.233 Problem: "\1\{,8}" in a regexp is not allowed, but it should work, because there is an upper limit. (Jim Battle) Solution: Allow using "\{min,max}" after an atom that can be empty if there is an upper limit. Files: src/regexp.c *** ../vim60.232/src/regexp.c Mon Feb 4 22:43:27 2002 --- src/regexp.c Mon Feb 18 12:30:16 2002 *************** *** 1213,1220 **** if (op == Magic('+')) EMSG_M_RET_NULL("E57: %s+ operand could be empty", reg_magic == MAGIC_ALL); ! EMSG_M_RET_NULL("E58: %s{ operand could be empty", ! reg_magic == MAGIC_ALL); } *flagp = (WORST | SPSTART | (flags & HASNL)); /* default flags */ --- 1213,1219 ---- if (op == Magic('+')) EMSG_M_RET_NULL("E57: %s+ operand could be empty", reg_magic == MAGIC_ALL); ! /* "\{}" is checked below, it's allowed when there is an upper limit */ } *flagp = (WORST | SPSTART | (flags & HASNL)); /* default flags */ *************** *** 1279,1287 **** case Magic('?'): case Magic('='): /* Emit x= as (x|) */ ! reginsert(BRANCH, ret); /* Either x */ regtail(ret, regnode(BRANCH)); /* or */ ! next = regnode(NOTHING);/* null. */ regtail(ret, next); regoptail(ret, next); break; --- 1278,1286 ---- case Magic('?'): case Magic('='): /* Emit x= as (x|) */ ! reginsert(BRANCH, ret); /* Either x */ regtail(ret, regnode(BRANCH)); /* or */ ! next = regnode(NOTHING); /* null. */ regtail(ret, next); regoptail(ret, next); break; *************** *** 1289,1294 **** --- 1288,1297 ---- case Magic('{'): if (!read_limits(&minval, &maxval)) return NULL; + if (!(flags & HASWIDTH) && (maxval > minval + ? maxval >= MAX_LIMIT : minval >= MAX_LIMIT)) + EMSG_M_RET_NULL("E58: %s{ operand could be empty", + reg_magic == MAGIC_ALL); if (flags & SIMPLE) { reginsert(BRACE_SIMPLE, ret); *** ../vim60.232/src/version.c Mon Feb 18 12:08:34 2002 --- src/version.c Mon Feb 18 12:36:49 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 233, /**/ -- System administrators are just like women: You can't live with them and you can't live without them. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///