Skip to content
Browse files

Merge pull request #8 from kowey/cl

Fix handling of comments.
  • Loading branch information...
2 parents 6cdcdca + e38fdc7 commit 3f69abc27772cf58de7d5cfb5b9ee87a8d523de5 @nominolo committed May 11, 2012
Showing with 22 additions and 4 deletions.
  1. +3 −2 Data/AttoLisp.hs
  2. +16 −1 atto-lisp.cabal
  3. +3 −1 Data/AttoLisp/Test.hs → test/test-attolisp.hs
View
5 Data/AttoLisp.hs
@@ -683,11 +683,12 @@ backslash = 92
{-# INLINE backslash #-}
skipLispSpace :: A.Parser ()
-skipLispSpace = skipSpace >> optional comment >> skipSpace
+skipLispSpace =
+ skipSpace >> many (comment >> skipSpace) >> return ()
comment :: A.Parser ()
comment = do
- _ <- char ';' >> Control.Applicative.many (notChar '\n')
+ _ <- char ';' >> many (notChar '\n')
end <- atEnd
if end then char '\n' >> return () else return ()
View
17 atto-lisp.cabal
@@ -11,7 +11,7 @@ description:
category: Text, Data
stability: provisional
build-type: Simple
-cabal-version: >= 1.6
+cabal-version: >= 1.10
library
build-depends:
@@ -28,3 +28,18 @@ library
Data.AttoLisp
ghc-options: -Wall
+ default-language: Haskell2010
+
+Test-Suite test
+ Type: exitcode-stdio-1.0
+ Main-is: test-attolisp.hs
+ Hs-Source-Dirs: test
+ Build-depends: atto-lisp
+ , attoparsec
+ , base
+ , bytestring
+ , text
+ , HUnit
+ , test-framework
+ , test-framework-hunit
+ Default-language: Haskell2010
View
4 Data/AttoLisp/Test.hs → test/test-attolisp.hs
@@ -2,7 +2,7 @@
MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances,
UndecidableInstances #-}
-module Data.AttoLisp.Test where
+module Main where
import Control.Applicative
import Data.AttoLisp
@@ -45,6 +45,8 @@ tcase (T inp out) = testCase (show inp) $ assertEqual (show inp) out out2
tests = [ T "()" (Right $ List [])
, T "42" (Right $ Number 42)
+ , T ";;foo\n42" (Right $ Number 42)
+ , T ";;foo\n;;bar\n42" (Right $ Number 42)
, T "(4 5 6)" (Right $ List [Number 4, Number 5, Number 6])
, T "(4 5 6 )" (Right $ List [Number 4, Number 5, Number 6])
, T "(3 (4))" (Right $ List [Number 3, List [Number 4]])

0 comments on commit 3f69abc

Please sign in to comment.
Something went wrong with that request. Please try again.