Geoff Leyland
be4420ae62
csv.lua: now that a buffer looks like a string, reading strings is easier
2014-05-26 21:21:14 +12:00
Geoff Leyland
3d3bbfb6c1
csv.lua: separate the buffering stuff out into a file_buffer class (that looks strangely like a string...)
2014-05-26 21:03:54 +12:00
Geoff Leyland
d9d9e419c7
csv.lua: track the buffer start with a variable called (surprisingly) buffer_start, and now field_start and line_start count from the start of the whole file, not the current state of the buffer
2014-05-26 18:17:54 +12:00
Geoff Leyland
e2ea3d2f1a
csv.lua: rename anchor_pos to field_start
2014-05-26 17:51:54 +12:00
Geoff Leyland
0daa2ae5d7
csv.lua: move find's offsetting into field_find
2014-05-26 17:49:23 +12:00
Geoff Leyland
6892667042
csv.lua: move the offset by anchor_pos out of sub and into field_sub
2014-05-26 17:46:17 +12:00
Geoff Leyland
46e65775bf
whoops. Fix up find's return values when we've hit the end of file. How did that work?
2014-05-26 17:38:58 +12:00
Geoff Leyland
e18409d73f
csv.lua: rename find's second argument 'init' to match the Lua Reference Manual
2014-05-26 17:27:50 +12:00
Geoff Leyland
966ba6722f
csv.lua: tidy up truncating the buffer (not really the right word, since we're cutting off the beginning) and advancing anchor_pos (also a bad name)
2014-05-26 17:26:24 +12:00
Geoff Leyland
88e30b6720
Test at all buffer sizes from 1 to 16. Fix the resulting bug when an embedded quote straddles two buffer blocks
2014-05-26 17:20:17 +12:00
Geoff Leyland
13e3b69c74
csv.lua: this all doesn't work with small buffer sizes. Whoops. Made tests at small buffer sizes and fixed the problem
2014-05-26 17:06:28 +12:00
Geoff Leyland
deac119c13
csv.lua: move some variable definitions closer to their use (the aim here is to move find and sub out into a buffer object)
2014-05-26 16:21:45 +12:00
Geoff Leyland
e0123ee133
csv.lua: fix typos
2014-05-26 16:17:38 +12:00
Kevin Martin
f28dfe0720
Added an openstring function, by wrapping the string in an object
...
that supports read(bytes) and passing the object to the underlying
code. Modified all the tests to run with both open and openstring.
Changed the default buffer size in csv.lua to match the value in the
README, and added the crucial blank line to test-data/blankline.csv
2014-05-18 18:52:16 +01:00
Geoff Leyland
c9988c8b93
handle blank lines more correctly
2014-01-29 13:28:47 +13:00
Geoff Leyland
ac033b3075
ignore blank lines (I'm not sure this is a good thing *in* the file, but ignoring blank lines at the end is a good idea)
2013-12-06 12:56:02 +13:00
Geoff Leyland
279ca0717d
added tests for embedded quotes and reading files with headers
2013-12-05 21:37:25 +13:00
Geoff Leyland
50e14b7484
Added one test, for embedded newlines, and fixed all the bugs it found
2013-12-05 21:20:10 +13:00
Geoff Leyland
7294a1bc72
fix up accidental global variables. Thanks on Ashwyn Hirschi
2013-12-05 15:01:41 +13:00
Geoff Leyland
daa18891f3
get the read size right in extend. Thanks to xxopxe@gmail.com
2013-12-05 14:46:38 +13:00
Geoff Leyland
da57f60673
first commit of lua-csv
2013-12-04 22:16:11 +13:00