mirror of
https://github.com/github/semantic.git
synced 2025-01-03 13:02:37 +03:00
First time making ana work in semantic-code! 🎩 to @joshvera for the 🍐
This commit is contained in:
parent
849da23323
commit
92337cd70b
12
src/Parse.hs
12
src/Parse.hs
@ -38,6 +38,18 @@ run Arguments{..} = do
|
||||
putStrLn $ encodePretty terms
|
||||
|
||||
pure ()
|
||||
where
|
||||
folder parser sourceBlob = do
|
||||
term <- parser sourceBlob
|
||||
pure $ (ana coalgebra :: (HasField fields Range, HasField fields Category, HasField fields SourceText) => Cofree (Syntax f) (Record fields) -> Cofree (ParseJSON f) (Record fields)) term
|
||||
where
|
||||
coalgebra term =
|
||||
case runCofree term of
|
||||
(annotation :< syntax) -> annotation :< ParseJSON category' range' syntax sourceText'
|
||||
where
|
||||
category' = toS $ Info.category annotation
|
||||
range' = characterRange annotation
|
||||
sourceText' = Info.sourceText annotation
|
||||
|
||||
-- | Return a parser that decorates with the cost of a term and its children.
|
||||
parserWithCost :: FilePath -> Parser (Syntax Text) (Record '[Cost, Range, Category, SourceSpan])
|
||||
|
Loading…
Reference in New Issue
Block a user