1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

Parse block nodes (incorrectly).

This commit is contained in:
Rob Rix 2022-02-01 13:12:23 -05:00
parent b7f1d1f928
commit 52f6d2b07c
No known key found for this signature in database
GPG Key ID: 2BE643E01DC032AE

View File

@ -137,6 +137,7 @@ parseNode o = do
"false" -> pure (const (bool False))
"throw" -> fmap throw <$> edge (head edges)
"if" -> liftA3 iff <$> findEdge (edgeNamed "condition") <*> findEdge (edgeNamed "consequence") <*> findEdge (edgeNamed "alternative") <|> pure (const noop)
"block" -> pure (const (bool True))
t -> A.parseFail ("unrecognized type: " <> t)
edge = A.withObject "edge" (fmap (flip (IntMap.!)) . (A..: pack "sink"))
edgeNamed name sink attrs = attrs A..: pack "type" >>= guard . (== name) >> pure (IntMap.! sink)