Compare commits
16 commits
e3d563e6a3
...
2111e20f33
Author | SHA1 | Date | |
---|---|---|---|
2111e20f33 | |||
e46e1663b9 | |||
69e36774b5 | |||
cc9b0edfb2 | |||
8b111a1839 | |||
1a9fce3860 | |||
fdb166a2a6 | |||
352822a518 | |||
7c7950956a | |||
c1a2cf4963 | |||
025b76672d | |||
6734740946 | |||
9515e3e1c5 | |||
55813e4464 | |||
5ced705083 | |||
3029432699 |
2 changed files with 29 additions and 0 deletions
|
@ -238,6 +238,7 @@ parseTheseChars cs = do
|
||||||
Attempt to parse an exact string
|
Attempt to parse an exact string
|
||||||
|
|
||||||
```idris
|
```idris
|
||||||
|
export
|
||||||
exactString : String -> Parser String
|
exactString : String -> Parser String
|
||||||
exactString str with (asList str)
|
exactString str with (asList str)
|
||||||
exactString "" | [] = pure ""
|
exactString "" | [] = pure ""
|
||||||
|
|
|
@ -209,3 +209,31 @@ string = do
|
||||||
_ <- parseExactChar '"'
|
_ <- parseExactChar '"'
|
||||||
pure $ VString contents
|
pure $ VString contents
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```idris
|
||||||
|
number = do
|
||||||
|
d <- double
|
||||||
|
pure $ VNumber d
|
||||||
|
```
|
||||||
|
|
||||||
|
```idris
|
||||||
|
bool = do
|
||||||
|
oneOfE
|
||||||
|
(throwParseError "Expected Bool")
|
||||||
|
(the (List _) [true, false])
|
||||||
|
where
|
||||||
|
true : Parser (JSONValue TBool)
|
||||||
|
true = do
|
||||||
|
_ <- exactString "true"
|
||||||
|
pure $ VBool True
|
||||||
|
false : Parser (JSONValue TBool)
|
||||||
|
false = do
|
||||||
|
_ <- exactString "false"
|
||||||
|
pure $ VBool False
|
||||||
|
```
|
||||||
|
|
||||||
|
```idris
|
||||||
|
null = do
|
||||||
|
_ <- exactString "null"
|
||||||
|
pure VNull
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue