1
1
mirror of https://github.com/github/semantic.git synced 2025-01-08 08:30:27 +03:00

Slightly different ForEach structure

This commit is contained in:
Timothy Clem 2017-07-07 15:13:32 -07:00
parent 61e0d8b83e
commit 4a553ff4fa
2 changed files with 3 additions and 2 deletions
src
Data/Syntax
Language/Ruby

View File

@ -102,7 +102,7 @@ data For a = For { forBefore :: !a, forCondition :: !a, forStep :: !a, forBody :
instance Eq1 For where liftEq = genericLiftEq
instance Show1 For where liftShowsPrec = genericLiftShowsPrec
data ForEach a = ForEach { forEachBinding :: ![a], forEachSubject :: !a, forEachBody :: !a }
data ForEach a = ForEach { forEachBinding :: !a, forEachSubject :: !a, forEachBody :: !a }
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 ForEach where liftEq = genericLiftEq

View File

@ -255,7 +255,8 @@ until' =
<|> makeTerm <$> symbol UntilModifier <*> children (flip Statement.While <$> statement <*> invert statement)
for :: Assignment
for = makeTerm <$> symbol For <*> children (Statement.ForEach <$> some identifier <*> statement <*> statements)
for = makeTerm <$> symbol For <*> children (Statement.ForEach <$> vars <*> statement <*> statements)
where vars = makeTerm <$> location <*> some identifier
case' :: Assignment
case' = makeTerm <$> symbol Case <*> children (Statement.Match <$> statement <*> when)