csv.lua: move some variable definitions closer to their use (the aim here is to move find and sub out into a buffer object)

This commit is contained in:
Geoff Leyland 2014-05-26 16:21:45 +12:00
parent e0123ee133
commit deac119c13

View File

@ -150,13 +150,9 @@ end
-- the buffer.
local function separated_values_iterator(file, parameters)
local buffer_size = parameters.buffer_size or DEFAULT_BUFFER_SIZE
local filename = parameters.filename or "<unknown>"
local buffer = ""
local anchor_pos = 1
local line, line_start = 1, 1
local column_name_map = parameters.columns and
build_column_name_map(parameters.columns)
local column_index_map
local line_start = 1
-- Cut the front off the buffer if we've already read it
@ -208,6 +204,13 @@ local function separated_values_iterator(file, parameters)
end
local filename = parameters.filename or "<unknown>"
local line = 1
local column_name_map = parameters.columns and
build_column_name_map(parameters.columns)
local column_index_map
-- If the user hasn't specified a separator, try to work out what it is.
local sep = parameters.separator
if not sep then