-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for hexadecimal and octal numbers
I switched from `read` to our custom parsing because `read` expects the `0o` prefix instead of C-style `0`. We only handle integers for now, as `read` for `Double` does not support decimal numbers with `0x` prefix and I did not want to implement decimals myself. Additionally, add support for + sign. Also merge `negative.settings` test file into `dconf.settings` since that one aggregates configuration keys from real dconf dumps. Instead create `numbers.settings` that tests all possible numeric values. Currently unhandled cases: zero-trailing=0. zero-leading=.0 hex-float=0x10.1 GLib’s GVariant parses octal decimals a base 10. This is probably expected, as the docs only mention hex floats. oct-float=010.1 oct-sci=010e10 GLib’s GVariant parses the following as a double, probably confusing it with scientific notation: hex-neg-e=-0x1e
- Loading branch information
Showing
8 changed files
with
140 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[floats] | ||
avogadro=6.283185307179586 | ||
basic=1234567890.1234567890 | ||
negative=-72.02 | ||
positive=+72.02 | ||
sci=6.022e23 | ||
sci-exp-neg=7.51e-9 | ||
sci-neg=-72.02e3 | ||
sci-neg-exp-neg=-9.11e-17 | ||
zero=0.0 | ||
zero-neg=-0.0 | ||
zero-pos=+0.0 | ||
|
||
[int] | ||
dec=1234567890 | ||
dec-neg=-987654321 | ||
dec-pos=+987654321 | ||
dec-one=1 | ||
dec-zero=0 | ||
hex=0x123456789abcdef0 | ||
hex-dec-only=0x1234567890 | ||
hex-neg=-0x1234 | ||
hex-neg-e=-0x1e | ||
hex-neg-e2=-0x1e2 | ||
hex-pos=+0x1234 | ||
hex-zero=0x0 | ||
hex-zero-neg=-0x0 | ||
hex-zero-pos=+0x0 | ||
oct=012345670 | ||
oct-byte-max=0377 | ||
oct-neg=-0377 | ||
oct-pos=+0377 | ||
oct-zero=00 | ||
oct-zero-neg=-00 | ||
oct-zero-pos=+00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated via dconf2nix: https://github.com/nix-commmunity/dconf2nix | ||
{ lib, ... }: | ||
|
||
with lib.hm.gvariant; | ||
|
||
{ | ||
dconf.settings = { | ||
"floats" = { | ||
avogadro = 6.283185307179586; | ||
basic = 1.2345678901234567e9; | ||
negative = -72.02; | ||
positive = 72.02; | ||
sci = 6.022e23; | ||
sci-exp-neg = 7.51e-9; | ||
sci-neg = -72020.0; | ||
sci-neg-exp-neg = -9.11e-17; | ||
zero = 0.0; | ||
zero-neg = -0.0; | ||
zero-pos = 0.0; | ||
}; | ||
|
||
"int" = { | ||
dec = 1234567890; | ||
dec-neg = -987654321; | ||
dec-one = 1; | ||
dec-pos = 987654321; | ||
dec-zero = 0; | ||
hex = 1311768467463790320; | ||
hex-dec-only = 78187493520; | ||
hex-neg = -4660; | ||
hex-neg-e = -30; | ||
hex-neg-e2 = -482; | ||
hex-pos = 4660; | ||
hex-zero = 0; | ||
hex-zero-neg = 0; | ||
hex-zero-pos = 0; | ||
oct = 2739128; | ||
oct-byte-max = 255; | ||
oct-neg = -255; | ||
oct-pos = 255; | ||
oct-zero = 0; | ||
oct-zero-neg = 0; | ||
oct-zero-pos = 0; | ||
}; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters