@@ -85,28 +85,23 @@ function! s:InsideForm(lnum)
85
85
" Reduce tokens from line "lnum" into "tokens".
86
86
for tk in s: TokeniseLine (lnum)
87
87
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
96
89
let in_string = 0
97
90
call remove (tokens, -1 )
98
91
else
99
92
let in_string = 1
100
93
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
108
94
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 ]
110
105
" Matching pair: drop the last item in tokens.
111
106
call remove (tokens, -1 )
112
107
else
@@ -115,8 +110,6 @@ function! s:InsideForm(lnum)
115
110
endif
116
111
endfor
117
112
118
- " echom 'Pass' lnum tokens
119
-
120
113
if ! empty (tokens) && has_key (s: pairs , tokens[0 ][0 ])
121
114
return tokens[0 ]
122
115
endif
@@ -127,7 +120,7 @@ function! s:InsideForm(lnum)
127
120
if ! empty (tokens) && tokens[0 ][0 ] == # ' "'
128
121
" Must have been in a multi-line string or regular expression
129
122
" as the string was never closed.
130
- return [ ' " ' , first_string_pos]
123
+ return first_string_pos
131
124
endif
132
125
133
126
return [' ^' , [0 , 0 ]] " Default to top-level.
0 commit comments