1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00
semantic/app/Split.hs

27 lines
705 B
Haskell
Raw Normal View History

2015-12-01 22:18:13 +03:00
module Split where
2015-12-01 19:33:16 +03:00
import Diff
2015-12-01 22:18:13 +03:00
import Patch
import Syntax
import Term
import Unified
import qualified Data.Set as Set
2015-12-01 19:33:16 +03:00
import Rainbow
2015-12-01 22:18:13 +03:00
data Node = Node String (Set.Set Category)
2015-12-01 19:33:16 +03:00
split :: Diff a Info -> String -> String -> IO ByteString
2015-12-01 22:18:13 +03:00
split _ _ _ = return mempty
splitDiff :: Diff a Info -> String -> String -> [(String, String)]
splitDiff _ _ _ = []
splitPatch :: Patch (Term a Info) -> String -> String -> [(String, String)]
splitPatch _ _ _ = []
splitTerm :: String -> Term a Info -> [Term a Node]
splitTerm source term = splitUp $ fmap toNode term where
toNode (Info range categories) = Node (substring range source) categories
splitUp :: Term a Node -> [Term a Node]
splitUp term = [term]