@@ -1456,7 +1456,7 @@ nfa_regatom()
14561456 * matched an unlimited number of times. NFA_NOPEN is
14571457 * added only once at a position, while NFA_SPLIT is
14581458 * added multiple times. This is more efficient than
1459- * not allowsing NFA_SPLIT multiple times, it is used
1459+ * not allowing NFA_SPLIT multiple times, it is used
14601460 * a lot. */
14611461 EMIT (NFA_NOPEN );
14621462 break ;
@@ -3726,8 +3726,10 @@ typedef struct
37263726 {
37273727 struct multipos
37283728 {
3729- lpos_T start ;
3730- lpos_T end ;
3729+ linenr_T start_lnum ;
3730+ linenr_T end_lnum ;
3731+ colnr_T start_col ;
3732+ colnr_T end_col ;
37313733 } multi [NSUBEXP ];
37323734 struct linepos
37333735 {
@@ -3812,10 +3814,10 @@ log_subexpr(sub)
38123814 if (REG_MULTI )
38133815 fprintf (log_fd , "*** group %d, start: c=%d, l=%d, end: c=%d, l=%d\n" ,
38143816 j ,
3815- sub -> list .multi [j ].start . col ,
3816- (int )sub -> list .multi [j ].start . lnum ,
3817- sub -> list .multi [j ].end . col ,
3818- (int )sub -> list .multi [j ].end . lnum );
3817+ sub -> list .multi [j ].start_col ,
3818+ (int )sub -> list .multi [j ].start_lnum ,
3819+ sub -> list .multi [j ].end_col ,
3820+ (int )sub -> list .multi [j ].end_lnum );
38193821 else
38203822 {
38213823 char * s = (char * )sub -> list .line [j ].start ;
@@ -3952,8 +3954,11 @@ copy_ze_off(to, from)
39523954 {
39533955 if (REG_MULTI )
39543956 {
3955- if (from -> list .multi [0 ].end .lnum >= 0 )
3956- to -> list .multi [0 ].end = from -> list .multi [0 ].end ;
3957+ if (from -> list .multi [0 ].end_lnum >= 0 )
3958+ {
3959+ to -> list .multi [0 ].end_lnum = from -> list .multi [0 ].end_lnum ;
3960+ to -> list .multi [0 ].end_col = from -> list .multi [0 ].end_col ;
3961+ }
39573962 }
39583963 else
39593964 {
@@ -3985,33 +3990,33 @@ sub_equal(sub1, sub2)
39853990 for (i = 0 ; i < todo ; ++ i )
39863991 {
39873992 if (i < sub1 -> in_use )
3988- s1 = sub1 -> list .multi [i ].start . lnum ;
3993+ s1 = sub1 -> list .multi [i ].start_lnum ;
39893994 else
39903995 s1 = -1 ;
39913996 if (i < sub2 -> in_use )
3992- s2 = sub2 -> list .multi [i ].start . lnum ;
3997+ s2 = sub2 -> list .multi [i ].start_lnum ;
39933998 else
39943999 s2 = -1 ;
39954000 if (s1 != s2 )
39964001 return FALSE;
3997- if (s1 != -1 && sub1 -> list .multi [i ].start . col
3998- != sub2 -> list .multi [i ].start . col )
4002+ if (s1 != -1 && sub1 -> list .multi [i ].start_col
4003+ != sub2 -> list .multi [i ].start_col )
39994004 return FALSE;
40004005
40014006 if (nfa_has_backref )
40024007 {
40034008 if (i < sub1 -> in_use )
4004- s1 = sub1 -> list .multi [i ].end . lnum ;
4009+ s1 = sub1 -> list .multi [i ].end_lnum ;
40054010 else
40064011 s1 = -1 ;
40074012 if (i < sub2 -> in_use )
4008- s2 = sub2 -> list .multi [i ].end . lnum ;
4013+ s2 = sub2 -> list .multi [i ].end_lnum ;
40094014 else
40104015 s2 = -1 ;
40114016 if (s1 != s2 )
40124017 return FALSE;
4013- if (s1 != -1 && sub1 -> list .multi [i ].end . col
4014- != sub2 -> list .multi [i ].end . col )
4018+ if (s1 != -1 && sub1 -> list .multi [i ].end_col
4019+ != sub2 -> list .multi [i ].end_col )
40154020 return FALSE;
40164021 }
40174022 }
@@ -4062,7 +4067,7 @@ report_state(char *action,
40624067 if (sub -> in_use <= 0 )
40634068 col = -1 ;
40644069 else if (REG_MULTI )
4065- col = sub -> list .multi [0 ].start . col ;
4070+ col = sub -> list .multi [0 ].start_col ;
40664071 else
40674072 col = (int )(sub -> list .line [0 ].start - regline );
40684073 nfa_set_code (state -> c );
@@ -4482,28 +4487,29 @@ addstate(l, state, subs_arg, pim, off)
44824487 {
44834488 if (subidx < sub -> in_use )
44844489 {
4485- save_lpos = sub -> list .multi [subidx ].start ;
4490+ save_lpos .lnum = sub -> list .multi [subidx ].start_lnum ;
4491+ save_lpos .col = sub -> list .multi [subidx ].start_col ;
44864492 save_in_use = -1 ;
44874493 }
44884494 else
44894495 {
44904496 save_in_use = sub -> in_use ;
44914497 for (i = sub -> in_use ; i < subidx ; ++ i )
44924498 {
4493- sub -> list .multi [i ].start . lnum = -1 ;
4494- sub -> list .multi [i ].end . lnum = -1 ;
4499+ sub -> list .multi [i ].start_lnum = -1 ;
4500+ sub -> list .multi [i ].end_lnum = -1 ;
44954501 }
44964502 sub -> in_use = subidx + 1 ;
44974503 }
44984504 if (off == -1 )
44994505 {
4500- sub -> list .multi [subidx ].start . lnum = reglnum + 1 ;
4501- sub -> list .multi [subidx ].start . col = 0 ;
4506+ sub -> list .multi [subidx ].start_lnum = reglnum + 1 ;
4507+ sub -> list .multi [subidx ].start_col = 0 ;
45024508 }
45034509 else
45044510 {
4505- sub -> list .multi [subidx ].start . lnum = reglnum ;
4506- sub -> list .multi [subidx ].start . col =
4511+ sub -> list .multi [subidx ].start_lnum = reglnum ;
4512+ sub -> list .multi [subidx ].start_col =
45074513 (colnr_T )(reginput - regline + off );
45084514 }
45094515 }
@@ -4539,7 +4545,10 @@ addstate(l, state, subs_arg, pim, off)
45394545 if (save_in_use == -1 )
45404546 {
45414547 if (REG_MULTI )
4542- sub -> list .multi [subidx ].start = save_lpos ;
4548+ {
4549+ sub -> list .multi [subidx ].start_lnum = save_lpos .lnum ;
4550+ sub -> list .multi [subidx ].start_col = save_lpos .col ;
4551+ }
45434552 else
45444553 sub -> list .line [subidx ].start = save_ptr ;
45454554 }
@@ -4549,7 +4558,7 @@ addstate(l, state, subs_arg, pim, off)
45494558
45504559 case NFA_MCLOSE :
45514560 if (nfa_has_zend && (REG_MULTI
4552- ? subs -> norm .list .multi [0 ].end . lnum >= 0
4561+ ? subs -> norm .list .multi [0 ].end_lnum >= 0
45534562 : subs -> norm .list .line [0 ].end != NULL ))
45544563 {
45554564 /* Do not overwrite the position set by \ze. */
@@ -4603,16 +4612,17 @@ addstate(l, state, subs_arg, pim, off)
46034612 sub -> in_use = subidx + 1 ;
46044613 if (REG_MULTI )
46054614 {
4606- save_lpos = sub -> list .multi [subidx ].end ;
4615+ save_lpos .lnum = sub -> list .multi [subidx ].end_lnum ;
4616+ save_lpos .col = sub -> list .multi [subidx ].end_col ;
46074617 if (off == -1 )
46084618 {
4609- sub -> list .multi [subidx ].end . lnum = reglnum + 1 ;
4610- sub -> list .multi [subidx ].end . col = 0 ;
4619+ sub -> list .multi [subidx ].end_lnum = reglnum + 1 ;
4620+ sub -> list .multi [subidx ].end_col = 0 ;
46114621 }
46124622 else
46134623 {
4614- sub -> list .multi [subidx ].end . lnum = reglnum ;
4615- sub -> list .multi [subidx ].end . col =
4624+ sub -> list .multi [subidx ].end_lnum = reglnum ;
4625+ sub -> list .multi [subidx ].end_col =
46164626 (colnr_T )(reginput - regline + off );
46174627 }
46184628 /* avoid compiler warnings */
@@ -4637,7 +4647,10 @@ addstate(l, state, subs_arg, pim, off)
46374647 sub = & subs -> norm ;
46384648
46394649 if (REG_MULTI )
4640- sub -> list .multi [subidx ].end = save_lpos ;
4650+ {
4651+ sub -> list .multi [subidx ].end_lnum = save_lpos .lnum ;
4652+ sub -> list .multi [subidx ].end_col = save_lpos .col ;
4653+ }
46414654 else
46424655 sub -> list .line [subidx ].end = save_ptr ;
46434656 sub -> in_use = save_in_use ;
@@ -4825,15 +4838,15 @@ match_backref(sub, subidx, bytelen)
48254838
48264839 if (REG_MULTI )
48274840 {
4828- if (sub -> list .multi [subidx ].start . lnum < 0
4829- || sub -> list .multi [subidx ].end . lnum < 0 )
4841+ if (sub -> list .multi [subidx ].start_lnum < 0
4842+ || sub -> list .multi [subidx ].end_lnum < 0 )
48304843 goto retempty ;
4831- if (sub -> list .multi [subidx ].start . lnum == reglnum
4832- && sub -> list .multi [subidx ].end . lnum == reglnum )
4844+ if (sub -> list .multi [subidx ].start_lnum == reglnum
4845+ && sub -> list .multi [subidx ].end_lnum == reglnum )
48334846 {
4834- len = sub -> list .multi [subidx ].end . col
4835- - sub -> list .multi [subidx ].start . col ;
4836- if (cstrncmp (regline + sub -> list .multi [subidx ].start . col ,
4847+ len = sub -> list .multi [subidx ].end_col
4848+ - sub -> list .multi [subidx ].start_col ;
4849+ if (cstrncmp (regline + sub -> list .multi [subidx ].start_col ,
48374850 reginput , & len ) == 0 )
48384851 {
48394852 * bytelen = len ;
@@ -4843,10 +4856,10 @@ match_backref(sub, subidx, bytelen)
48434856 else
48444857 {
48454858 if (match_with_backref (
4846- sub -> list .multi [subidx ].start . lnum ,
4847- sub -> list .multi [subidx ].start . col ,
4848- sub -> list .multi [subidx ].end . lnum ,
4849- sub -> list .multi [subidx ].end . col ,
4859+ sub -> list .multi [subidx ].start_lnum ,
4860+ sub -> list .multi [subidx ].start_col ,
4861+ sub -> list .multi [subidx ].end_lnum ,
4862+ sub -> list .multi [subidx ].end_col ,
48504863 bytelen ) == RA_MATCH )
48514864 return TRUE;
48524865 }
@@ -5441,6 +5454,7 @@ nfa_regmatch(prog, start, submatch, m)
54415454
54425455 /* Allocate memory for the lists of nodes. */
54435456 size = (nstate + 1 ) * sizeof (nfa_thread_T );
5457+
54445458 list [0 ].t = (nfa_thread_T * )lalloc (size , TRUE);
54455459 list [0 ].len = nstate + 1 ;
54465460 list [1 ].t = (nfa_thread_T * )lalloc (size , TRUE);
@@ -5482,8 +5496,8 @@ nfa_regmatch(prog, start, submatch, m)
54825496 {
54835497 if (REG_MULTI )
54845498 {
5485- m -> norm .list .multi [0 ].start . lnum = reglnum ;
5486- m -> norm .list .multi [0 ].start . col = (colnr_T )(reginput - regline );
5499+ m -> norm .list .multi [0 ].start_lnum = reglnum ;
5500+ m -> norm .list .multi [0 ].start_col = (colnr_T )(reginput - regline );
54875501 }
54885502 else
54895503 m -> norm .list .line [0 ].start = reginput ;
@@ -5580,7 +5594,7 @@ nfa_regmatch(prog, start, submatch, m)
55805594 if (t -> subs .norm .in_use <= 0 )
55815595 col = -1 ;
55825596 else if (REG_MULTI )
5583- col = t -> subs .norm .list .multi [0 ].start . col ;
5597+ col = t -> subs .norm .list .multi [0 ].start_col ;
55845598 else
55855599 col = (int )(t -> subs .norm .list .line [0 ].start - regline );
55865600 nfa_set_code (t -> state -> c );
@@ -5861,7 +5875,7 @@ nfa_regmatch(prog, start, submatch, m)
58615875 * continue with what follows. */
58625876 if (REG_MULTI )
58635877 /* TODO: multi-line match */
5864- bytelen = m -> norm .list .multi [0 ].end . col
5878+ bytelen = m -> norm .list .multi [0 ].end_col
58655879 - (int )(reginput - regline );
58665880 else
58675881 bytelen = (int )(m -> norm .list .line [0 ].end - reginput );
@@ -6741,7 +6755,7 @@ nfa_regmatch(prog, start, submatch, m)
67416755 if (add )
67426756 {
67436757 if (REG_MULTI )
6744- m -> norm .list .multi [0 ].start . col =
6758+ m -> norm .list .multi [0 ].start_col =
67456759 (colnr_T )(reginput - regline ) + clen ;
67466760 else
67476761 m -> norm .list .line [0 ].start = reginput + clen ;
@@ -6854,8 +6868,11 @@ nfa_regtry(prog, col)
68546868 {
68556869 for (i = 0 ; i < subs .norm .in_use ; i ++ )
68566870 {
6857- reg_startpos [i ] = subs .norm .list .multi [i ].start ;
6858- reg_endpos [i ] = subs .norm .list .multi [i ].end ;
6871+ reg_startpos [i ].lnum = subs .norm .list .multi [i ].start_lnum ;
6872+ reg_startpos [i ].col = subs .norm .list .multi [i ].start_col ;
6873+
6874+ reg_endpos [i ].lnum = subs .norm .list .multi [i ].end_lnum ;
6875+ reg_endpos [i ].col = subs .norm .list .multi [i ].end_col ;
68596876 }
68606877
68616878 if (reg_startpos [0 ].lnum < 0 )
@@ -6903,13 +6920,13 @@ nfa_regtry(prog, col)
69036920 struct multipos * mpos = & subs .synt .list .multi [i ];
69046921
69056922 /* Only accept single line matches that are valid. */
6906- if (mpos -> start . lnum >= 0
6907- && mpos -> start . lnum == mpos -> end . lnum
6908- && mpos -> end . col >= mpos -> start . col )
6923+ if (mpos -> start_lnum >= 0
6924+ && mpos -> start_lnum == mpos -> end_lnum
6925+ && mpos -> end_col >= mpos -> start_col )
69096926 re_extmatch_out -> matches [i ] =
6910- vim_strnsave (reg_getline (mpos -> start . lnum )
6911- + mpos -> start . col ,
6912- mpos -> end . col - mpos -> start . col );
6927+ vim_strnsave (reg_getline (mpos -> start_lnum )
6928+ + mpos -> start_col ,
6929+ mpos -> end_col - mpos -> start_col );
69136930 }
69146931 else
69156932 {
0 commit comments