Commit Graph

28 Commits

Author SHA1 Message Date
Geoff Leyland
8493881362 update license and make the default buffer block size a megabyte rather than a measly 4k 2014-05-26 21:38:32 +12:00
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
c40e12bb7c test.lua: add an exclamation mark to the end of newlines so that they're explicit 2014-05-26 16:44:57 +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
Geoff Leyland
6ad339da69 Merge pull request #1 from kev82/openstring
Addition of csv.openstring plus other minor fixes
2014-05-26 14:00:44 +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
1ed256e9f5 add an scm rockspec 2014-01-29 13:29:03 +13: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
1a8aa46661 added a makefile 2013-12-05 21:21:19 +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
4856a5aca7 Trying to clarify the multiple spaces issue in README.md 2013-12-05 06:50:18 +13:00
Geoff Leyland
542393be04 Whoops, README.md said Lua 5.1 or 5.1. Should be 5.2 the second time 2013-12-04 22:45:55 +13:00
Geoff Leyland
da57f60673 first commit of lua-csv 2013-12-04 22:16:11 +13:00