Commit Graph

267 Commits

Author SHA1 Message Date
Havoc Pennington
3610dc8d76 support "/" in unquoted strings (and therefore keys) 2011-11-16 11:03:16 -05:00
Havoc Pennington
20b75542e4 support "on" and "off" when converting string to boolean 2011-11-16 10:34:40 -05:00
Havoc Pennington
61b1281e90 Convert numbers to ConfigInt when possible, then ConfigLong, and ConfigDouble only when required
Had to overhaul and clean up equality of ConfigNumber as part of this.
2011-11-16 10:05:44 -05:00
Havoc Pennington
054e27ccd0 add comment about not having ConfigValue.parent() 2011-11-16 09:36:06 -05:00
Havoc Pennington
b7a73dc85b remove pluggable ConfigTransformer
Doesn't seem to have a useful purpose, was a bad idea.
Just hardcode the built-in automatic type conversions.
2011-11-16 09:33:18 -05:00
Havoc Pennington
ece196c146 mention foo.bar=10, foo.baz=12 style syntax (single line properties-style) 2011-11-15 23:35:24 -05:00
Havoc Pennington
ae10fadc04 two tests were identical, make them different again 2011-11-15 23:33:19 -05:00
Havoc Pennington
f81ab20caa implement ConfigObject.hasPath() 2011-11-15 23:30:03 -05:00
Havoc Pennington
f32c8bdd78 fix parsing of empty string path, and fix test suite which wasn't catching it 2011-11-15 23:28:08 -05:00
Havoc Pennington
e9fe426f7f fix unicodeTrim on all-whitespace strings 2011-11-15 23:26:43 -05:00
Havoc Pennington
41b9d5c68b Implement fromAnyRef and friends to wrap values in ConfigValue. 2011-11-15 22:46:53 -05:00
Havoc Pennington
3bdaaabf02 implement equals/hashCode/toString for SimpleConfigOrigin 2011-11-15 22:09:55 -05:00
Havoc Pennington
aefdb58e04 fix indentation, eclipse keeps screwing it up 2011-11-15 21:11:38 -05:00
Havoc Pennington
ed75c315bc add Config.empty variants that take origin description; use singleton for default-named empty object 2011-11-15 21:08:29 -05:00
Havoc Pennington
1841dd9c67 Add a real README, license, and rewrite spec. 2011-11-15 19:14:22 -05:00
Havoc Pennington
aae70ecb8e extensively fix fromProperties() and add tests
fromProperties() now parses paths with a strict "split on period"

It now handles more than one level of nested object.

It's now defined that if a properties file defines both an
object and a string at the same key, the object wins.
2011-11-15 19:13:12 -05:00
Havoc Pennington
d59786925d add a couple corner case tests related to include keyword 2011-11-15 16:37:47 -05:00
Havoc Pennington
68a22668bd change getMemorySize to getMemorySizeInBytes
Preserves the memory size vs. disk size distinction (powers of two vs. ten)
But specifies that it will be in bytes, for consistency with getMilliseconds
and clarity in general.
2011-11-15 16:37:06 -05:00
Havoc Pennington
598c5d045f support terabytes when parsing a memory size 2011-11-15 16:31:37 -05:00
Havoc Pennington
6ca952e516 Fix code to find includes relative to other includes. Support ParseOptions for load(). 2011-11-14 23:52:14 -05:00
Havoc Pennington
d257c3bbd9 attempt to rationalize the loader/includer code
Introduce ConfigIncluder pluggable includer interface.

Move all the parse-something logic from Config, Loader,
ConfigImpl, Parser into the Parseable abstraction.
2011-11-14 15:42:50 -05:00
Havoc Pennington
9b3efbd2d0 do a better job with origin when there's an empty config. add Config.empty(). 2011-11-14 10:26:53 -05:00
Havoc Pennington
54cd4ec3dd Overhaul the public API.
This patch is a little half-baked (it needs tests, and
there are a few bugs I know about). Fixes will be along.
2011-11-14 02:13:25 -05:00
Havoc Pennington
f1bedacdfc get rid of ConfigConfig, wasn't the right API.
Will replace it with something better later.
2011-11-12 22:59:43 -05:00
Havoc Pennington
31a8e9ee57 Save the original text of parsed numbers
Value concatenation is supposed to provide an illusion that
you can just type long unquoted sentences, but really they
are a series of tokens. Be sure we don't weirdly reformat
any numbers that happen to appear in unquoted text.
2011-11-12 22:42:25 -05:00
Havoc Pennington
52f34925dc Fix equality between ConfigObject of different types
By pulling equals/hashCode up into AbstractConfigObject
2011-11-12 22:19:24 -05:00
Havoc Pennington
6528ac5d1e check Map.get, Map.containsKey, Map.containsValue implementations with non-string parameter 2011-11-12 22:19:03 -05:00
Havoc Pennington
367b1b27fa remove a few unused methods 2011-11-12 22:07:55 -05:00
Havoc Pennington
e66eaddfc7 add a test for null in value concatenation 2011-11-12 21:53:40 -05:00
Havoc Pennington
7b0e5a1471 make whitespace handling Unicode-correct.
This is maybe a little above and beyond what will ever matter in practice.
2011-11-12 21:47:35 -05:00
Havoc Pennington
b0fdc6456c Relativize substitutions when including a file
This is needed because we resolve substitutions only
as the last step, and against the whole tree not
against each file.

Special handling is needed so that fallback to
system properties and environment variables still
works properly.
2011-11-12 19:23:09 -05:00
Havoc Pennington
b034ce8de3 remove unused import 2011-11-12 18:02:01 -05:00
Havoc Pennington
5327b5d5f5 add a couple of trivial benchmarks
Basically they just reveal there's nothing worth
performance tuning here.
2011-11-12 18:01:03 -05:00
Havoc Pennington
7a63eab4ab buffer the reader instead of the stream
seems to make more sense since the reader could be smarter about it?
2011-11-12 18:00:07 -05:00
Havoc Pennington
926a726ea3 fork jvm for test, run, and test:run 2011-11-12 17:45:12 -05:00
Havoc Pennington
a706c74396 move new BufferedInputStream inside try{} block
Not sure this makes any material difference.
2011-11-12 17:44:43 -05:00
Havoc Pennington
d5fba4b8a7 buffer the input stream for loading properties 2011-11-12 17:44:18 -05:00
Havoc Pennington
b1b2403a5d add akka-reference.conf as a test case 2011-11-12 17:08:08 -05:00
Havoc Pennington
0d4feca770 if we get UnsupportedEncodingException include it as cause in the ConfigException
"Least likely thing to matter, ever"
2011-11-12 16:52:50 -05:00
Havoc Pennington
466a096398 add properties-style.conf test
Showing .conf format with a properties-looking style
2011-11-12 16:43:38 -05:00
Havoc Pennington
75a1b12284 Allow omitting commas as long as there's a newline 2011-11-12 16:36:07 -05:00
Havoc Pennington
16fa1cec0d test weird empty documents with whitespace and comments 2011-11-12 15:57:25 -05:00
Havoc Pennington
178cd17dad allow one comma after last element in object or array 2011-11-12 15:25:19 -05:00
Havoc Pennington
4051d07870 allow omitting curly braces on root object 2011-11-12 15:02:20 -05:00
Havoc Pennington
39de5aa444 allow omitting the colon if the value is an object 2011-11-12 14:36:45 -05:00
Havoc Pennington
55595e4c39 allow '=' in addition to ':' to separate key from value 2011-11-12 14:28:01 -05:00
Havoc Pennington
508c5910ad Support # and // comments 2011-11-12 12:06:56 -05:00
Havoc Pennington
796937f3ac prohibit /, #, and + from unquoted strings
because the spec proposes syntactic meanings for these
2011-11-12 10:05:39 -05:00
Havoc Pennington
be560731b8 add test for an array as not-first element of another array
Adds a line of coverage ;-)
2011-11-12 10:01:12 -05:00
Havoc Pennington
c27fa2cd68 fix a stray "return" in Scala that was making many tests not run
Then fix a few of the tests that now run. Fortunately the bugs
were all in the tests, not in the actual code.
2011-11-12 09:58:28 -05:00