peek en check Parsers toegevoegd
authorpimjager <pim@pimjager.nl>
Mon, 29 Feb 2016 18:52:14 +0000 (19:52 +0100)
committerpimjager <pim@pimjager.nl>
Mon, 29 Feb 2016 18:52:14 +0000 (19:52 +0100)
src/main.prj
src/yard.dcl
src/yard.icl

index 09ebcb5..94aea90 100644 (file)
@@ -31,6 +31,7 @@ Global
        Link
                LinkMethod:     Static
                GenerateRelocations:    False
+               GenerateSymbolTable:    False
                GenerateLinkMap:        False
                LinkResources:  False
                ResourceSource: 
@@ -419,9 +420,37 @@ OtherModules
                        ReadableABC:    False
                        ReuseUniqueNodes:       True
                        Fusion: False
+       Module
+               Name:   System.OS
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Compiler
+                       NeverMemoryProfile:     False
+                       NeverTimeProfile:       False
+                       StrictnessAnalysis:     True
+                       ListTypes:      StrictExportTypes
+                       ListAttributes: True
+                       Warnings:       True
+                       Verbose:        True
+                       ReadableABC:    False
+                       ReuseUniqueNodes:       True
+                       Fusion: False
+       Module
+               Name:   System.OS
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Compiler
+                       NeverMemoryProfile:     False
+                       NeverTimeProfile:       False
+                       StrictnessAnalysis:     True
+                       ListTypes:      StrictExportTypes
+                       ListAttributes: True
+                       Warnings:       True
+                       Verbose:        True
+                       ReadableABC:    False
+                       ReuseUniqueNodes:       True
+                       Fusion: False
        Module
                Name:   Control.Applicative
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -435,7 +464,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Control.Monad
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -449,7 +478,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Either
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -463,7 +492,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Foldable
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -477,7 +506,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Func
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -491,7 +520,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Functor
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -505,7 +534,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.List
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -519,7 +548,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Map
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -533,7 +562,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Maybe
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -547,7 +576,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Monoid
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -561,7 +590,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Set
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -575,7 +604,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Traversable
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -589,7 +618,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Data.Void
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -603,7 +632,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   System.CommandLine
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -617,7 +646,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   System.IO
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -631,7 +660,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   System._Pointer
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -645,7 +674,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Text
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -659,7 +688,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Text.JSON
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -673,21 +702,7 @@ OtherModules
                        Fusion: False
        Module
                Name:   Text.PPrint
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
-               Compiler
-                       NeverMemoryProfile:     False
-                       NeverTimeProfile:       False
-                       StrictnessAnalysis:     True
-                       ListTypes:      StrictExportTypes
-                       ListAttributes: True
-                       Warnings:       True
-                       Verbose:        True
-                       ReadableABC:    False
-                       ReuseUniqueNodes:       True
-                       Fusion: False
-       Module
-               Name:   System.OS
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -700,8 +715,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System.OS
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Name:   StdMaybe
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent/Deprecated/StdLib
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -769,17 +784,3 @@ OtherModules
                        ReadableABC:    False
                        ReuseUniqueNodes:       True
                        Fusion: False
-       Module
-               Name:   StdMaybe
-               Dir:    {Application}/lib/iTasks-SDK/Server/lib
-               Compiler
-                       NeverMemoryProfile:     False
-                       NeverTimeProfile:       False
-                       StrictnessAnalysis:     True
-                       ListTypes:      StrictExportTypes
-                       ListAttributes: True
-                       Warnings:       True
-                       Verbose:        True
-                       ReadableABC:    False
-                       ReuseUniqueNodes:       True
-                       Fusion: False
index dff75d9..cedf0df 100644 (file)
@@ -21,6 +21,8 @@ runParser :: (Parser a b) [a] -> (Either Error b, [a])
 (<?>) :: (Parser a b) (String, Int) -> Parser a b
 fail :: Parser a b
 top :: Parser a a
+peek :: Parser a a
 satisfy :: (a -> Bool) -> Parser a a
+check :: (a -> Bool) -> Parser a a
 item :: a -> Parser a a | Eq a
 list :: [a] -> Parser a [a] | Eq a
index b5e3c61..81e5883 100644 (file)
@@ -60,9 +60,17 @@ top = Parser \i -> case i of
     []      = (Left ParseError, [])
     [x:xs]  = (Right x, xs)
 
+peek :: Parser a a
+peek = Parser \i -> case i of
+    []      = (Left ParseError, [])
+    [x:xs]  = (Right x, [x:xs])
+
 satisfy :: (a -> Bool) -> Parser a a
 satisfy f = top >>= \r -> if (f r) (return r) fail
 
+check :: (a -> Bool) -> Parser a a
+check f = peek >>= \r -> if (f r) (return r) fail
+
 item :: a -> Parser a a | Eq a
 item a  = satisfy ((==)a)