1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

🔥 the Child term.

This commit is contained in:
Rob Rix 2017-04-05 21:15:32 -04:00
parent 37525402de
commit c265eeb4c9

View File

@ -29,7 +29,6 @@ data AssignmentF symbol a where
Rule :: symbol -> a -> AssignmentF symbol a
Content :: AssignmentF symbol ByteString
Children :: Assignment symbol a -> AssignmentF symbol [a]
Child :: AssignmentF symbol a
rule :: symbol -> Assignment symbol a -> Assignment symbol a
rule symbol = wrap . Rule symbol
@ -40,9 +39,6 @@ content = Content `Then` return
children :: Assignment symbol a -> Assignment symbol [a]
children forEach = Children forEach `Then` return
child :: Assignment symbol a
child = Child `Then` return
-- | A program in some syntax functor, over which we can perform analyses.
type Program = Freer
@ -61,7 +57,10 @@ comment :: Assignment Grammar (Program Syntax a)
comment = wrapU . Comment.Comment <$> (rule Comment content)
if' :: Assignment Grammar (Program Syntax a)
if' = rule If (wrapU <$> (Statement.If <$> child <*> child <*> child))
if' = rule If (wrapU <$> (Statement.If <$> expr <*> expr <*> expr))
expr :: Assignment Grammar (Program Syntax a)
expr = if'
-- | A rose tree.