mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Map terms into elements.
This commit is contained in:
parent
68ce3a200e
commit
9048d3101f
10
app/Split.hs
10
app/Split.hs
@ -5,11 +5,9 @@ import Patch
|
||||
import Syntax
|
||||
import Term
|
||||
import Unified
|
||||
import qualified Data.Set as Set
|
||||
import Control.Comonad.Cofree
|
||||
import Rainbow
|
||||
|
||||
data Node = Node String (Set.Set Category)
|
||||
type ClassName = String
|
||||
type Element a = Cofree (Syntax a) (Maybe ClassName, String)
|
||||
|
||||
@ -22,8 +20,6 @@ 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]
|
||||
splitTerm :: String -> Term a Info -> Element a
|
||||
splitTerm source term = toElement term where
|
||||
toElement ((Info range categories) :< syntax) = (foldr (const . Just) Nothing categories, substring range source) :< fmap toElement syntax
|
||||
|
Loading…
Reference in New Issue
Block a user