Parse tasks
This commit is contained in:
parent
3af17331f4
commit
8c9a6631d8
2 changed files with 103 additions and 7 deletions
12
DateExpr.hs
12
DateExpr.hs
|
|
@ -3,6 +3,8 @@ module DateExpr
|
|||
, parseDateExpr
|
||||
, firstMatchingDay
|
||||
, evalDateExpr
|
||||
, daily
|
||||
, weekly
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
|
|
@ -23,7 +25,6 @@ type DateExpr = BoolExpr
|
|||
|
||||
data BoolExpr = BValue Bool
|
||||
| BStatement DateStatement
|
||||
| BLeapYear
|
||||
| BNot BoolExpr
|
||||
| BAnd BoolExpr BoolExpr
|
||||
| BOr BoolExpr BoolExpr
|
||||
|
|
@ -55,6 +56,12 @@ data SpecialDate = SJulianDay
|
|||
| SEaster
|
||||
deriving (Show)
|
||||
|
||||
daily :: DateExpr
|
||||
daily = BValue True
|
||||
|
||||
weekly :: DateExpr
|
||||
weekly = BEq (IDate SDayOfWeek) (IValue 7)
|
||||
|
||||
{-
|
||||
- Evaluating expressions
|
||||
-}
|
||||
|
|
@ -136,7 +143,6 @@ yearday day = let (y,m,d) = toGregorian day
|
|||
- Parsing Expressions
|
||||
-}
|
||||
|
||||
-- error ↓ ↓ input
|
||||
type Parser = Parsec Void String
|
||||
|
||||
parseDateExpr :: Parser DateExpr
|
||||
|
|
@ -144,7 +150,7 @@ parseDateExpr = boolExpr
|
|||
|
||||
-- Lexeme parser functions
|
||||
sc :: Parser ()
|
||||
sc = L.space space1 empty empty
|
||||
sc = L.space space1 (L.skipLineComment "//") (L.skipBlockCommentNested "/*" "*/")
|
||||
|
||||
symbol :: String -> Parser String
|
||||
symbol = L.symbol sc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue