160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/censive.rb', line 160
def next_token
if scan(@quoted)
token = ""
while true
token << (scan_until(@quotes) or bomb "unclosed quote")[0..-2]
token << @quote and next if scan(@quote)
scan(@eoc) and break
@relax or bomb "invalid character after quote"
token << @quote + (scan_until(@quotes) or bomb "bad inline quote")
scan(@eoc) and break
end
scan(@sep)
@strip ? token.strip : token
elsif match = scan(@unquoted)
if check(@quote) && !match.chomp!(@sep)
unless @excel && match.chomp!(@seq)
match << (scan_until(@eoc) or bomb "stray quote")
scan(@sep)
end
end
tokens = match.split(@sep, -1)
@strip ? tokens.map!(&:strip) : tokens
elsif scan(@sep)
match = scan(@seps)
match ? match.split(@sep, -1) : @es
else
scan(@eol)
nil
end
end
|