Commit Graph

20 Commits (df205e2335748e3ab265dafb820eda0330ca82c7)

Author SHA1 Message Date
Ben Moon 594eebf78b Ensure no name collisions for supported parens 2016-07-11 11:27:38 +01:00
Ben Moon f56fd2c511 Add POD documentation 2016-07-11 11:04:00 +01:00
Ben Moon 6427597df5 Improve readability for nested list parsing 2016-07-11 11:04:00 +01:00
Ben Moon 1767f08449 Ensure only intended routines are exported 2016-07-11 11:04:00 +01:00
Ben Moon 69083246ed Add 'join_last' option 2016-07-11 11:04:00 +01:00
Ben Moon 4a6c23f048 Add 'join' option for formatting 2016-07-11 11:04:00 +01:00
Ben Moon d61bb26fa1 Add support for varying nested parentheses format
So `parens => '({})'` would format as '(1, {2, 3}, 4)'.
2016-07-11 11:03:59 +01:00
Ben Moon c24ecdf3d8 Improve support for 'empty' parentheses
When the user uses "parens => ''" in format_list.
2016-07-11 11:03:59 +01:00
Ben Moon e3cd02900c Add 'parens' option to 'format_list'
Allow specifying which parentheses should be used when formatting.
2016-07-11 11:03:59 +01:00
Ben Moon 0e0fcbc3af Default 'nested' to false if 'item' is provided
Generally, if an item regex is provided we won't be working with a
nested list, so turn nesting off.

Also improve validation for nested items.
2016-07-11 11:03:59 +01:00
Ben Moon e0017279ef Add support for parsing nested lists 2016-07-11 11:03:59 +01:00
Ben Moon ed472f5f7f Remove unused routines
We won't support ranges (for now); just basic parsing and formatting.
2016-07-11 11:03:59 +01:00
Ben Moon b05fff92a7 Add support for basic formatting
Currently only formatting as a standard ARRAY is supported. TODO:
support separators/brackets (and perhaps detected from previous
parsing).
2016-07-11 11:03:58 +01:00
Ben Moon 82c0840185 Allow specifying a regex each item must match
For example `parse_list($text, item => qr/\d+/)` would only allow
digits.
2016-07-11 11:03:58 +01:00
Ben Moon 11b2ec875f Add test for empty string (invalid) 2016-07-11 11:03:58 +01:00
Ben Moon 408c76f2a2 Allow lists without brackets 2016-07-11 11:03:58 +01:00
Ben Moon 7874e86491 Add test for number of items
Corrected regex to allow for empty list
2016-07-11 11:03:58 +01:00
Ben Moon 45e8bd8200 Add test for varying brackets
Also, return an ARRAY reference instead of a list (at least for now);
not sure which will make more sense in the future (probably just a
list).

/cc @mintsoft
2016-07-11 11:03:58 +01:00
Ben Moon 8556e46930 Add 'initialization' test 2016-07-11 11:03:57 +01:00
Ben Moon c5ab76983e Import main functionality from Shuffle 2016-07-11 11:03:57 +01:00