Merge pull request #14 from bennofs/assert-and-with

Add assert and with to parser
This commit is contained in:
John Wiegley 2014-08-16 12:18:31 -05:00
commit 147624425d
1 changed files with 12 additions and 0 deletions

View File

@ -69,6 +69,8 @@ nixTerm = choice
, nixList
, nixLet
, nixIf
, nixAssert
, nixWith
, nixBool
, nixNull
, nixPath -- can be expensive due to back-tracking
@ -117,6 +119,16 @@ nixIf = fmap Fix $ NIf
<*> (whiteSpace *> reserved "then" *> nixApp)
<*> (whiteSpace *> reserved "else" *> nixApp)
nixAssert :: Parser NExpr
nixAssert = fmap Fix $ NAssert
<$> (reserved "assert" *> nixApp)
<*> (semi *> nixApp)
nixWith :: Parser NExpr
nixWith = fmap Fix $ NWith
<$> (reserved "with" *> nixApp)
<*> (semi *> nixApp)
nixLambda :: Parser NExpr
nixLambda = Fix <$> (NAbs <$> (try argExpr <?> "arguments") <*> nixApp)