aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-10-13 13:37:29 +0100
committerAkshay <[email protected]>2020-10-13 13:37:29 +0100
commitf943fc17e5f80f92d20c86de5ea499bbfbe0cd75 (patch)
treef2b25997e86bf09e3f3d88127883b96d0014acf0
parent8641ce3e1a730c8195e5a74fabef8814f43b05f8 (diff)
allow multiline expressionspretty-errors
-rw-r--r--lisk.cabal3
-rw-r--r--src/Parser.hs7
2 files changed, 7 insertions, 3 deletions
diff --git a/lisk.cabal b/lisk.cabal
index bea3414..9578a85 100644
--- a/lisk.cabal
+++ b/lisk.cabal
@@ -27,7 +27,8 @@ library
27 Parser, 27 Parser,
28 Evaluator, 28 Evaluator,
29 Operators, 29 Operators,
30 Error 30 Error.Base
31 Error.Pretty
31 32
32executable lisk 33executable lisk
33 default-language: Haskell2010 34 default-language: Haskell2010
diff --git a/src/Parser.hs b/src/Parser.hs
index 1242645..dc754d3 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -69,7 +69,10 @@ parseId = do
69 _ -> Id atom 69 _ -> Id atom
70 70
71whiteSpace :: Parser () 71whiteSpace :: Parser ()
72whiteSpace = skipMany1 space 72whiteSpace = skipMany1 $ oneOf [' ', '\n']
73
74optionalWhiteSpace :: Parser ()
75optionalWhiteSpace = skipMany $ oneOf [' ', '\n']
73 76
74type Alias = String 77type Alias = String
75parseModifier :: Char -> Alias -> Parser Expr 78parseModifier :: Char -> Alias -> Parser Expr
@@ -98,7 +101,7 @@ parseLispValue =
98 x <- sepEndBy parseLispValue whiteSpace 101 x <- sepEndBy parseLispValue whiteSpace
99 spaces 102 spaces
100 t <- optionMaybe $ char '.' >> space >> parseLispValue 103 t <- optionMaybe $ char '.' >> space >> parseLispValue
101 spaces >> char ')' 104 optionalWhiteSpace >> char ')'
102 return $ maybe (List x) (DottedList x) t 105 return $ maybe (List x) (DottedList x) t
103 <?> "lisp value" 106 <?> "lisp value"
104 107