Havoc Pennington
7cdbe721a9
add ConfigFactory.parseString
2011-11-17 21:33:36 -05:00
Havoc Pennington
31b9ccf983
rename parse() methods to parseFoo()
...
for clarity and to avoid overload ambiguity
2011-11-17 21:31:45 -05:00
Havoc Pennington
adb80f6017
Split Config out of ConfigObject.
...
This separates ConfigObject, which is:
- a tree of maps
- that can contain ConfigValueType.NULL
from Config, which is:
- a one-level map from path to non-map values
- which never returns a ConfigValueType.NULL
2011-11-17 21:16:44 -05:00
Havoc Pennington
2381cf7785
Create Config, SimpleConfig and associate a Config with every ConfigObject.
2011-11-17 15:04:33 -05:00
Havoc Pennington
7d5f72e248
Add Config.fromPathMap() which takes map with paths
...
Share implementation of this with the Properties parser;
it makes the Properties parser somewhat less efficient due
to creating the intermediate Path objects, but should not matter.
2011-11-17 12:09:12 -05:00
Havoc Pennington
88e81d7c67
add Path.parent() and Path.last() methods
...
Neither is very efficient, but we'll live.
2011-11-17 12:08:27 -05:00
Havoc Pennington
d8e54099e9
add more docs about paths vs. keys
2011-11-17 10:36:06 -05:00
Havoc Pennington
2886f73772
improve some path-related error messages
2011-11-17 10:15:41 -05:00
Havoc Pennington
159bec9d03
an explicit { HOME : null } should block lookup of ${HOME} in the environment.
2011-11-17 00:56:44 -05:00
Havoc Pennington
5f6f718566
fix some indentation that Eclipse messed up
2011-11-17 00:50:47 -05:00
Havoc Pennington
817bbb73eb
prohibit control characters in quoted strings per JSON spec
2011-11-17 00:44:19 -05:00
Havoc Pennington
c3fe5509a7
test that ConfigParseOptions.setIncluder works.
2011-11-17 00:19:52 -05:00
Havoc Pennington
c5fc564c56
Fix Parseable.parse() to use passed-in options
...
This was causing at least a couple bugs; in one test, a properties file
was being parsed with conf syntax; and includes suddenly could not
be missing if the parent file could not be missing.
2011-11-16 23:47:55 -05:00
Havoc Pennington
0bb9d19727
test "10.0foo" path expression, and correct the spec
...
The spec described parsing this as a 1-element path but
the implementation parsed it as 2 elements which is probably
a better behavior because it's less surprising. The simple
rule is now "only quoted periods are special".
2011-11-16 23:23:46 -05:00
Havoc Pennington
9dc6f77078
Fix behavior when merging object,primitive,object.
...
The AbstractConfigObject.merge() method was wrong; it merged in the
wrong order, which produced incorrect results. But there was a test
verifying that the results were wrong! So it's OK right?
Anyway, fix the test, fix the code, be sure it's crystal clear in spec.
2011-11-16 22:07:14 -05:00
Havoc Pennington
e1329e54bf
test the current behavior of duplicate keys set to object, then primitive, then object
2011-11-16 21:25:29 -05:00
Havoc Pennington
4676023f1c
add the Play 1.2 "yabe" example application.conf as test05.conf
2011-11-16 21:11:06 -05:00
Havoc Pennington
e782f6c1ad
fix line numbers in error messages. (start with 1.)
2011-11-16 21:04:59 -05:00
Havoc Pennington
e1628ee6de
use newNumber when doing fromAnyRef on a Number with unknown subclass
2011-11-16 15:08:50 -05:00
Havoc Pennington
d1e12fdd36
move newNumber to ConfigNumber rather than AbstractConfigValue
2011-11-16 15:08:29 -05:00
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