mirror of
https://github.com/github/semantic.git
synced 2024-12-27 17:05:33 +03:00
Update Main in semantic-ast to reference AST.Unmarshal
This commit is contained in:
parent
24bcd26b75
commit
2cd3dd10b1
@ -2,7 +2,7 @@
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import TreeSitter.Unmarshal
|
||||
import AST.Unmarshal as Unmarshal
|
||||
import qualified Language.Python.AST as AST
|
||||
import qualified TreeSitter.Python as Python
|
||||
import Source.Range
|
||||
@ -54,7 +54,7 @@ generateAST (SemanticAST format noColor source) =
|
||||
Left filePaths -> traverse Data.ByteString.readFile filePaths
|
||||
Right source -> pure [Data.ByteString.Char8.pack source]
|
||||
go = ast >=> display
|
||||
ast = parseByteString @AST.Module @(Range, Span) Python.tree_sitter_python -- TODO: generalize for all languages
|
||||
ast = Unmarshal.parseByteString @AST.Module @(Range, Span) Python.tree_sitter_python -- TODO: generalize for all languages
|
||||
display = case format of
|
||||
Json -> Data.ByteString.Lazy.Char8.putStrLn . encodePretty . either toJSON (marshal . fmap (const ())) -- TODO: replacing range and span annotations with () for which there is a ToJSON instance for now, deal with this later
|
||||
Show -> print
|
||||
|
Loading…
Reference in New Issue
Block a user