Commit Graph

685 Commits

Author SHA1 Message Date
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
Havoc Pennington
145cb40ec2 Implement include keyword 2011-11-12 09:57:57 -05:00
Havoc Pennington
5a51d590af make get() and getValue() on AbstractConfigObject return a more specific type 2011-11-12 09:26:36 -05:00
Havoc Pennington
795579f952 use SimpleConfigObject.empty() in one more spot 2011-11-12 08:39:13 -05:00
Havoc Pennington
c18f10c6dc Implement unquoted path keys, { foo.bar : 42 } 2011-11-12 01:42:43 -05:00
Havoc Pennington
a3128871ac allow duplicate keys in .conf with later key winning 2011-11-12 00:30:23 -05:00
Havoc Pennington
df3b3792da make resolveSubstitutions() do nothing on already-resolved objects.
This way if people resolve() gratuitously, there's no performance
issue. Also, tracking resolved state gives us the option to complain
about usage of unresolved objects.
2011-11-11 23:57:49 -05:00
Havoc Pennington
10babb5e8c rename Unresolved to Unmergeable 2011-11-11 22:58:26 -05:00
Havoc Pennington
9cf7b4d65a implement transformed() with a protected newCopy method instead of wrapper object 2011-11-11 22:28:23 -05:00
Havoc Pennington
839c588277 add a ConfigRoot type returned by load()
The point is to only support the resolve() method on the root object.
2011-11-11 22:11:57 -05:00
Havoc Pennington
529b3b1f55 completely drop "transformer" arg to ConfigObject constructors
If you want to change the transformer, use the transformed() method.
2011-11-11 17:28:00 -05:00
Havoc Pennington
8c00a97243 clean up merge() so it doesn't need origin or transformer
origin can be computed by combining origins of merged values.

transformer should be set prior to merge; probably it should
be an error to merge with mismatched transformers.
2011-11-11 17:18:26 -05:00
Havoc Pennington
8f0e6bd5f0 Make merging work properly with substitutions involved.
If we saw a ConfigSubstitution value, we would then
ignore any objects after it. But in fact, the substitution
might expand to an object, and then we would need to merge
it with the objects after it.

If we had an object and merged a substitution with it, we
were previously ignoring the substitution. But in fact,
the substitution might expand to an object, and we would
need to merge that object in.

So in both cases now we create a ConfigDelayedMerge
or ConfigDelayedMergeObject object instead.

As part of this, the merge() code was refactored to
use a withFallback() method, which is now handy
and public.
2011-11-11 16:32:24 -05:00
Havoc Pennington
b726948e4f make some classes final that can be 2011-11-11 11:03:23 -05:00
Havoc Pennington
ae2cd72eed make a bunch of fields final 2011-11-11 10:35:25 -05:00
Havoc Pennington
00241585bd add an empty README.md 2011-11-10 20:54:53 -05:00
Havoc Pennington
cc35f33cfa remove YAML spec 2011-11-10 20:53:36 -05:00
Havoc Pennington
a722d5249e add some tests for paths with hyphen and underscore in them 2011-11-10 20:52:06 -05:00
Havoc Pennington
d13f7861fd avoid full parser for simple paths
Kind of a stupid overoptimization probably but what the hell
2011-11-10 20:51:29 -05:00
Havoc Pennington
da09c9790c improve error message on badly-formatted number 2011-11-10 20:50:46 -05:00
Havoc Pennington
43337aa315 call getMilliseconds in ApiExamples.scala 2011-11-10 20:21:59 -05:00
Havoc Pennington
8ea188ed59 move unwrapped() return type specialization from AbstractConfigObject to ConfigObject 2011-11-10 20:19:26 -05:00
Havoc Pennington
f169f12d43 add an ApiExamples.scala to tests 2011-11-10 20:16:33 -05:00
Havoc Pennington
9a187a2de9 rename getAny to getAnyRef
makes it a better name in Scala
2011-11-10 20:16:04 -05:00
Havoc Pennington
3019aec77f move a ConfigList interface up into the public API 2011-11-10 19:53:02 -05:00
Havoc Pennington
88b970982d make ConfigList implement java.util.List 2011-11-10 19:36:42 -05:00
Havoc Pennington
be63b620f6 make ConfigObject implement java.util.Map<String, ConfigValue> 2011-11-10 17:00:21 -05:00
Havoc Pennington
c677a23b3b Sort map keys when computing the hash for a SimpleConfigObject 2011-11-10 16:12:40 -05:00
Havoc Pennington
6923dec829 rename resolve() to find() in AbstractConfigObject
since resolve() is being used for substitution resolution
2011-11-10 15:40:55 -05:00
Havoc Pennington
a70bb89c2a use full path parser for ConfigObject getters 2011-11-10 15:38:36 -05:00
Havoc Pennington
cfff60131e close StringReader in parsePath
not sure there's any real need but technically correct
2011-11-10 15:36:11 -05:00
Havoc Pennington
d46b068eaf reimplement Path.newPath using the full parser 2011-11-10 15:04:45 -05:00
Havoc Pennington
859dc082bd make parsePathException a static method on Parser
This is step 1 toward using it to parse keys in the API.
2011-11-10 14:48:17 -05:00