Mercurial > vim
comparison src/regexp.c @ 19892:5feb426d2ea1 v8.2.0502
patch 8.2.0502: Vim9: some code is not tested
Commit: https://github.com/vim/vim/commit/e8c4abbbd711af8fd3ed85ea69e9ac3d63a0d879
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 2 21:13:25 2020 +0200
patch 8.2.0502: Vim9: some code is not tested
Problem: Vim9: some code is not tested.
Solution: Add more tests. Fix uncovered problems.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 02 Apr 2020 21:15:04 +0200 |
parents | 08f4dc2ba716 |
children | aadd1cae2ff5 |
comparison
equal
deleted
inserted
replaced
19891:e1168788aa04 | 19892:5feb426d2ea1 |
---|---|
535 /* | 535 /* |
536 * Skip past regular expression. | 536 * Skip past regular expression. |
537 * Stop at end of "startp" or where "dirc" is found ('/', '?', etc). | 537 * Stop at end of "startp" or where "dirc" is found ('/', '?', etc). |
538 * Take care of characters with a backslash in front of it. | 538 * Take care of characters with a backslash in front of it. |
539 * Skip strings inside [ and ]. | 539 * Skip strings inside [ and ]. |
540 * When "newp" is not NULL and "dirc" is '?', make an allocated copy of the | |
541 * expression and change "\?" to "?". If "*newp" is not NULL the expression | |
542 * is changed in-place. | |
543 */ | 540 */ |
544 char_u * | 541 char_u * |
545 skip_regexp( | 542 skip_regexp( |
546 char_u *startp, | 543 char_u *startp, |
547 int dirc, | 544 int dirc, |
545 int magic) | |
546 { | |
547 return skip_regexp_ex(startp, dirc, magic, NULL, NULL); | |
548 } | |
549 | |
550 /* | |
551 * skip_regexp() with extra arguments: | |
552 * When "newp" is not NULL and "dirc" is '?', make an allocated copy of the | |
553 * expression and change "\?" to "?". If "*newp" is not NULL the expression | |
554 * is changed in-place. | |
555 * If a "\?" is changed to "?" then "dropped" is incremented, unless NULL. | |
556 */ | |
557 char_u * | |
558 skip_regexp_ex( | |
559 char_u *startp, | |
560 int dirc, | |
548 int magic, | 561 int magic, |
549 char_u **newp) | 562 char_u **newp, |
563 int *dropped) | |
550 { | 564 { |
551 int mymagic; | 565 int mymagic; |
552 char_u *p = startp; | 566 char_u *p = startp; |
553 | 567 |
554 if (magic) | 568 if (magic) |
577 { | 591 { |
578 *newp = vim_strsave(startp); | 592 *newp = vim_strsave(startp); |
579 if (*newp != NULL) | 593 if (*newp != NULL) |
580 p = *newp + (p - startp); | 594 p = *newp + (p - startp); |
581 } | 595 } |
596 if (dropped != NULL) | |
597 ++*dropped; | |
582 if (*newp != NULL) | 598 if (*newp != NULL) |
583 STRMOVE(p, p + 1); | 599 STRMOVE(p, p + 1); |
584 else | 600 else |
585 ++p; | 601 ++p; |
586 } | 602 } |