comparison src/regexp.c @ 8021:b6b4f354df23 v7.4.1305

commit https://github.com/vim/vim/commit/7c29f387819b5817b003d2ba73e2b5cf3cb3d0dd Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 12 19:08:15 2016 +0100 patch 7.4.1305 Problem: "\%1l^#.*" does not match on a line starting with "#". Solution: Do not clear the start-of-line flag. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Fri, 12 Feb 2016 19:15:05 +0100
parents c079097365f3
children 05b88224cea1
comparison
equal deleted inserted replaced
8020:7250994a8654 8021:b6b4f354df23
1498 { 1498 {
1499 return had_eol; 1499 return had_eol;
1500 } 1500 }
1501 #endif 1501 #endif
1502 1502
1503 /* variables for parsing reginput */
1504 static int at_start; /* True when on the first character */
1505 static int prev_at_start; /* True when on the second character */
1506
1503 /* 1507 /*
1504 * Parse regular expression, i.e. main body or parenthesized thing. 1508 * Parse regular expression, i.e. main body or parenthesized thing.
1505 * 1509 *
1506 * Caller must absorb opening parenthesis. 1510 * Caller must absorb opening parenthesis.
1507 * 1511 *
1916 char_u *ret; 1920 char_u *ret;
1917 int flags; 1921 int flags;
1918 int c; 1922 int c;
1919 char_u *p; 1923 char_u *p;
1920 int extra = 0; 1924 int extra = 0;
1925 int save_prev_at_start = prev_at_start;
1921 1926
1922 *flagp = WORST; /* Tentatively. */ 1927 *flagp = WORST; /* Tentatively. */
1923 1928
1924 c = getchr(); 1929 c = getchr();
1925 switch (c) 1930 switch (c)
2329 break; 2334 break;
2330 } 2335 }
2331 else if (c == 'l' || c == 'c' || c == 'v') 2336 else if (c == 'l' || c == 'c' || c == 'v')
2332 { 2337 {
2333 if (c == 'l') 2338 if (c == 'l')
2339 {
2334 ret = regnode(RE_LNUM); 2340 ret = regnode(RE_LNUM);
2341 if (save_prev_at_start)
2342 at_start = TRUE;
2343 }
2335 else if (c == 'c') 2344 else if (c == 'c')
2336 ret = regnode(RE_COL); 2345 ret = regnode(RE_COL);
2337 else 2346 else
2338 ret = regnode(RE_VCOL); 2347 ret = regnode(RE_VCOL);
2339 if (ret == JUST_CALC_SIZE) 2348 if (ret == JUST_CALC_SIZE)
2944 } 2953 }
2945 2954
2946 /* 2955 /*
2947 * Functions for getting characters from the regexp input. 2956 * Functions for getting characters from the regexp input.
2948 */ 2957 */
2949
2950 static int at_start; /* True when on the first character */
2951 static int prev_at_start; /* True when on the second character */
2952
2953 /* 2958 /*
2954 * Start parsing at "str". 2959 * Start parsing at "str".
2955 */ 2960 */
2956 static void 2961 static void
2957 initchr(char_u *str) 2962 initchr(char_u *str)