fixed until inline, comments more clean
authorMart Lubbers <mart@martlubbers.net>
Tue, 1 Mar 2016 11:03:02 +0000 (12:03 +0100)
committerMart Lubbers <mart@martlubbers.net>
Tue, 1 Mar 2016 11:03:02 +0000 (12:03 +0100)
src/lex.icl
src/main.prj
src/yard.dcl
src/yard.icl

index 63a14e0..bedb75f 100644 (file)
@@ -21,8 +21,8 @@ lexProgram = some lexToken <* many (satisfy isSpace) <* eof
 lexToken :: Parser Char TokenValue
 lexToken = 
     //Comments
-    (list (fromString "//") >>| until top ((item '\n' >>| return Void) <|> eof) >>| lexToken) <|>
-    (list (fromString "/*") >>| until top (list (fromString "*/")) >>| lexToken) <|>
+    (list (fromString "//") >>| lexUntilNL >>| lexToken) <|>
+    (list (fromString "/*") >>| lexUntilCommentClose >>| lexToken) <|>
        //Keyword tokens
        (lexKw "var" VarToken) <|>
        (lexKw "Void" VoidToken) <|>
@@ -61,8 +61,9 @@ lexToken =
        //Ident tokens
        (liftM IdentToken $ some $ satisfy isIdentChar) <|>
        (satisfy isSpace >>| lexToken)
-//     (eof >>| pure EndOfFileToken) 
        where
+               lexUntilNL = top until ((item '\n' >>| return Void) <|> eof)
+               lexUntilCommentClose = top until list (fromString "*/")
                isIdentChar c = isAlphanum c || c == '_'
                lexOp s tv = list (fromString s) >>| pure tv
                lexKw kw tv = lexOp kw tv <* check (not o isIdentChar) >>| pure tv
index e181dc1..d7bf8d0 100644 (file)
@@ -31,7 +31,6 @@ Global
        Link
                LinkMethod:     Static
                GenerateRelocations:    False
-               GenerateSymbolTable:    False
                GenerateLinkMap:        False
                LinkResources:  False
                ResourceSource: 
@@ -365,8 +364,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System.OS
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Name:   Control.Applicative
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -379,8 +378,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System.OS
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
+               Name:   Control.Monad
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -393,8 +392,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Control.Applicative
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Either
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -407,8 +406,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Control.Monad
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Func
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -421,8 +420,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Either
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Functor
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -435,8 +434,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Func
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.List
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -449,8 +448,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Functor
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Maybe
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -463,8 +462,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.List
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Monoid
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -477,8 +476,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Maybe
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Data.Void
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -491,8 +490,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Monoid
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   System.CommandLine
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -505,8 +504,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Data.Void
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   System.IO
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -519,8 +518,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System.CommandLine
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   System._Pointer
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -533,8 +532,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System.IO
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   Text
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Independent
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -547,8 +546,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   System._Pointer
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   System.OS
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -561,8 +560,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   Text
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent
+               Name:   System.OS
+               Dir:    {Application}/lib/iTasks-SDK/Dependencies/Platform/OS-Linux-64
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -575,8 +574,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   StdMaybe
-               Dir:    {Application}/lib/iTasks-SDK/Dependencies/clean-platform/src/libraries/OS-Independent/Deprecated/StdLib
+               Name:   _SystemDynamic
+               Dir:    {Application}/lib/iTasks-SDK/Patches/Dynamics
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -589,8 +588,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   _SystemDynamic
-               Dir:    {Application}/lib/iTasks-SDK/Patches/Dynamics
+               Name:   GenEq
+               Dir:    {Application}/lib/iTasks-SDK/Patches/Generics
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -603,7 +602,7 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   GenEq
+               Name:   GenPrint
                Dir:    {Application}/lib/iTasks-SDK/Patches/Generics
                Compiler
                        NeverMemoryProfile:     False
@@ -617,8 +616,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   GenPrint
-               Dir:    {Application}/lib/iTasks-SDK/Patches/Generics
+               Name:   StdGeneric
+               Dir:    {Application}/lib/iTasks-SDK/Patches/StdEnv
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
@@ -631,8 +630,8 @@ OtherModules
                        ReuseUniqueNodes:       True
                        Fusion: False
        Module
-               Name:   StdGeneric
-               Dir:    {Application}/lib/iTasks-SDK/Patches/StdEnv
+               Name:   StdMaybe
+               Dir:    {Application}/lib/iTasks-SDK/Server/lib
                Compiler
                        NeverMemoryProfile:     False
                        NeverTimeProfile:       False
index bc4f940..178356a 100644 (file)
@@ -18,7 +18,6 @@ instance Alternative (Parser a)
 
 instance toString Error
 
-//(`until`) infix 1
 
 runParser :: (Parser a b) [a] -> (Either Error b, [a])
 (<?>) :: (Parser a b) (String, Int) -> Parser a b
@@ -27,7 +26,7 @@ top :: Parser a a
 peek :: Parser a a
 satisfy :: (a -> Bool) -> Parser a a
 check :: (a -> Bool) -> Parser a a
-until :: (Parser a b) (Parser a c) -> Parser a [b]
+(until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b]
 item :: a -> Parser a a | Eq a
 list :: [a] -> Parser a [a] | Eq a
 eof :: Parser a Void
index 9ed6077..a78dcbb 100644 (file)
@@ -69,8 +69,8 @@ peek = Parser \i -> case i of
 //runs the left parser until the right parser succeeds. Returns the result of the left parser 
 //Note: if the right parser consumes input then this input is lost!
 //If the left parser fails before the right parser succeeds the whole parser fails
-until :: (Parser a b) (Parser a c) -> Parser a [b]
-until p guard = try $ until` p guard [] 
+(until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b]
+(until) p guard = try $ until` p guard [] 
     where
         until` :: (Parser a b) (Parser a c) [b] -> Parser a [b]
         until` p guard acc = Parser \i -> case runParser guard i of 
@@ -99,4 +99,4 @@ item :: a -> Parser a a | Eq a
 item a  = satisfy ((==)a)
 
 list :: [a] -> Parser a [a] | Eq a
-list as = mapM item as
\ No newline at end of file
+list as = mapM item as