mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
use qualified imports to clean stuff up
This commit is contained in:
parent
45abf90917
commit
4c0de190ec
@ -3,7 +3,7 @@ module Main (main) where
|
||||
|
||||
import System.Environment
|
||||
import TreeSitter.Unmarshal
|
||||
import TreeSitter.Python.AST
|
||||
import qualified TreeSitter.Python.AST as AST
|
||||
import TreeSitter.Python
|
||||
import Source.Range
|
||||
import Source.Span
|
||||
@ -18,7 +18,7 @@ import Data.Foldable (for_)
|
||||
data SemanticAST = SemanticAST
|
||||
{ format :: Format
|
||||
, color :: Bool
|
||||
, source :: Either [FilePath] Prelude.String
|
||||
, source :: Either [FilePath] String
|
||||
}
|
||||
|
||||
-- Usage: semantic-ast --format ARG [--no-color] [--sourceString STRING] [FILEPATHS…]
|
||||
@ -50,14 +50,13 @@ generateAST (SemanticAST format color source) = do
|
||||
Right source -> do
|
||||
pure [Data.ByteString.Char8.pack source]
|
||||
for_ bytestrings $ \bytestring -> do
|
||||
ast <- parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
|
||||
ast <- parseByteString @AST.Module @(Range, Span) tree_sitter_python bytestring
|
||||
case format of
|
||||
Show -> print ast
|
||||
Pretty -> pPrint ast
|
||||
case color of
|
||||
Prelude.True -> pPrintNoColor ast
|
||||
Prelude.False -> pPrint ast
|
||||
|
||||
True -> pPrintNoColor ast
|
||||
False -> pPrint ast
|
||||
|
||||
opts :: ParserInfo SemanticAST
|
||||
opts = info (parseAST <**> helper)
|
||||
|
Loading…
Reference in New Issue
Block a user