Skip to content

Commit 7aea3b5

Browse files
committed
add support for numbers in scientific notation
1 parent 3d67a84 commit 7aea3b5

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

data/scientific-notation.settings

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[com/github/wwmm/easyeffects/streamoutputs/bassenhancer]
2+
amount=-6.9388939039072284e-16
3+
blend=0.0
4+
listen=true

output/scientific-notation.nix

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
2+
{ lib, ... }:
3+
4+
with lib.hm.gvariant;
5+
6+
{
7+
dconf.settings = {
8+
"com/github/wwmm/easyeffects/streamoutputs/bassenhancer" = {
9+
amount = -6.938893903907228e-16;
10+
blend = 0.0;
11+
listen = true;
12+
};
13+
14+
};
15+
}

src/DConf.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vDouble = try $ do
2121
s <- option "" $ string "-"
2222
n <- many1 digit
2323
d <- string "."
24-
e <- many1 digit
24+
e <- many1 (digit <|> oneOf "eEdD-")
2525
pure . D $ read (s <> n <> d <> e)
2626

2727
vInt :: Parsec Text () Value

test/DConf2NixTest.hs

+10
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,15 @@ dconf2nixKeybindings =
106106
prop_dconf2nix_keybindings :: Property
107107
prop_dconf2nix_keybindings = withTests (10 :: TestLimit) dconf2nixKeybindings
108108

109+
dconf2nixScientificNotation :: Property
110+
dconf2nixScientificNotation =
111+
let input = "data/scientific-notation.settings"
112+
output = "output/scientific-notation.nix"
113+
root = Root T.empty
114+
in baseProperty input output root
115+
116+
prop_dconf2nix_scientific_notation :: Property
117+
prop_dconf2nix_scientific_notation = withTests (10 :: TestLimit) dconf2nixScientificNotation
118+
109119
dconf2nixTests :: Group
110120
dconf2nixTests = $$(discover)

0 commit comments

Comments
 (0)