YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -1,5 +1,5 @@
import Data.Functor
import Text.Parsec ((<|>), (<?>), many, many1, char, try, parse, sepBy, choice)
import Text.Parsec ((<|>), (<?>), many, many1, char, try, parse, sepBy, choice, between)
import Text.Parsec.Char (noneOf)
import Text.Parsec.Token (integer, float, whiteSpace, stringLiteral, makeTokenParser)
import Text.Parsec.Language (haskell)
@ -13,10 +13,10 @@ data Val = Int Integer
tProg = many tExpr <?> "program"
where tExpr = between ws ws (tList <|> tAtom) <?> "expression"
ws = whiteSpace haskell
tAtom = try (Int <$> integer haskell) <?> "integer"
<|> try (Float <$> float haskell) <?> "floating point number"
<|> String <$> stringLiteral haskell <?> "string"
<|> Symbol <$> many1 (noneOf "()\"\t\n\r") <?> "symbol"
tAtom = (try (Float <$> float haskell) <?> "floating point number")
<|> (try (Int <$> integer haskell) <?> "integer")
<|> (String <$> stringLiteral haskell <?> "string")
<|> (Symbol <$> many1 (noneOf "()\"\t\n\r ") <?> "symbol")
<?> "atomic expression"
tList = List <$> between (char '(') (char ')') (many tExpr) <?> "list"