@@ -85,28 +85,23 @@ function! s:InsideForm(lnum)
8585 " Reduce tokens from line "lnum" into "tokens".
8686 for tk in s: TokeniseLine (lnum)
8787 if tk[0 ] == # ' "'
88- " Keep track of the first string delimiter we
89- " see, as we'll need it later for multi-line
90- " strings/regexps.
91- if first_string_pos == []
92- let first_string_pos = tk[1 ]
93- endif
94-
95- if ! empty (tokens) && tokens[-1 ][0 ] == # ' "'
88+ if in_string
9689 let in_string = 0
9790 call remove (tokens, -1 )
9891 else
9992 let in_string = 1
10093 call add (tokens, tk)
101- endif
102-
103- continue
104- endif
105-
106- " When in string ignore other tokens.
107- if in_string | continue | endif
10894
109- if ! empty (tokens) && get (s: pairs , tk[0 ], ' ' ) == # tokens[-1 ][0 ]
95+ " Track the first string delimiter we
96+ " see, as we may need it later for
97+ " multi-line strings/regexps.
98+ if first_string_pos == []
99+ let first_string_pos = tk
100+ endif
101+ endif
102+ elseif in_string
103+ " When in string ignore other tokens.
104+ elseif ! empty (tokens) && get (s: pairs , tk[0 ], ' ' ) == # tokens[-1 ][0 ]
110105 " Matching pair: drop the last item in tokens.
111106 call remove (tokens, -1 )
112107 else
@@ -115,8 +110,6 @@ function! s:InsideForm(lnum)
115110 endif
116111 endfor
117112
118- " echom 'Pass' lnum tokens
119-
120113 if ! empty (tokens) && has_key (s: pairs , tokens[0 ][0 ])
121114 return tokens[0 ]
122115 endif
@@ -127,7 +120,7 @@ function! s:InsideForm(lnum)
127120 if ! empty (tokens) && tokens[0 ][0 ] == # ' "'
128121 " Must have been in a multi-line string or regular expression
129122 " as the string was never closed.
130- return [ ' " ' , first_string_pos]
123+ return first_string_pos
131124 endif
132125
133126 return [' ^' , [0 , 0 ]] " Default to top-level.
0 commit comments