mirror of
https://github.com/github/semantic.git
synced 2025-01-02 20:41:38 +03:00
Docs and formatting
This commit is contained in:
parent
16a55d68a0
commit
5c6535608e
@ -17,44 +17,45 @@ module Parsing.Parser
|
|||||||
, phpParser
|
, phpParser
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prologue
|
import Assigning.Assignment
|
||||||
import Assigning.Assignment
|
|
||||||
import qualified CMarkGFM
|
import qualified CMarkGFM
|
||||||
import Data.AST
|
import Data.AST
|
||||||
import Data.Kind
|
import Data.Kind
|
||||||
import Data.Language
|
import Data.Language
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import Foreign.Ptr
|
import Foreign.Ptr
|
||||||
|
import qualified GHC.TypeLits as TypeLevel
|
||||||
import qualified Language.Go.Assignment as Go
|
import qualified Language.Go.Assignment as Go
|
||||||
import qualified Language.JSON.Assignment as JSON
|
import qualified Language.JSON.Assignment as JSON
|
||||||
import qualified Language.Markdown.Assignment as Markdown
|
import qualified Language.Markdown.Assignment as Markdown
|
||||||
|
import qualified Language.PHP.Assignment as PHP
|
||||||
|
import Language.Preluded
|
||||||
import qualified Language.Python.Assignment as Python
|
import qualified Language.Python.Assignment as Python
|
||||||
import qualified Language.Ruby.Assignment as Ruby
|
import qualified Language.Ruby.Assignment as Ruby
|
||||||
import qualified Language.TypeScript.Assignment as TypeScript
|
import qualified Language.TypeScript.Assignment as TypeScript
|
||||||
import qualified Language.PHP.Assignment as PHP
|
import Prologue
|
||||||
|
import TreeSitter.Go
|
||||||
|
import TreeSitter.JSON
|
||||||
import qualified TreeSitter.Language as TS (Language, Symbol)
|
import qualified TreeSitter.Language as TS (Language, Symbol)
|
||||||
import TreeSitter.Go
|
import TreeSitter.PHP
|
||||||
import TreeSitter.JSON
|
import TreeSitter.Python
|
||||||
import TreeSitter.PHP
|
import TreeSitter.Ruby
|
||||||
import TreeSitter.Python
|
import TreeSitter.TypeScript
|
||||||
import TreeSitter.Ruby
|
|
||||||
import TreeSitter.TypeScript
|
|
||||||
import qualified GHC.TypeLits as TypeLevel
|
|
||||||
import Language.Preluded
|
|
||||||
|
|
||||||
|
|
||||||
type family ApplyAll' (typeclasses :: [(* -> *) -> Constraint]) (fs :: [* -> *]) :: Constraint where
|
type family ApplyAll' (typeclasses :: [(* -> *) -> Constraint]) (fs :: [* -> *]) :: Constraint where
|
||||||
ApplyAll' (typeclass ': typeclasses) fs = (Apply typeclass fs, ApplyAll' typeclasses fs)
|
ApplyAll' (typeclass ': typeclasses) fs = (Apply typeclass fs, ApplyAll' typeclasses fs)
|
||||||
ApplyAll' '[] fs = ()
|
ApplyAll' '[] fs = ()
|
||||||
|
|
||||||
|
-- | A parser, suitable for program analysis, for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints.
|
||||||
data SomeAnalysisParser typeclasses ann where
|
data SomeAnalysisParser typeclasses ann where
|
||||||
SomeAnalysisParser :: ( Member Syntax.Identifier fs
|
SomeAnalysisParser :: ( Member Syntax.Identifier fs
|
||||||
, ApplyAll' typeclasses fs)
|
, ApplyAll' typeclasses fs)
|
||||||
=> Parser (Term (Union fs) ann)
|
=> Parser (Term (Union fs) ann) -- ^ A parser.
|
||||||
-> [String]
|
-> [String] -- ^ List of valid file extensions to be used for module resolution.
|
||||||
-> Maybe String
|
-> Maybe String -- ^ Maybe path to prelude.
|
||||||
-> SomeAnalysisParser typeclasses ann
|
-> SomeAnalysisParser typeclasses ann
|
||||||
|
|
||||||
-- | A parser for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints.
|
-- | A parser for some specific language, producing 'Term's whose syntax satisfies a list of typeclass constraints.
|
||||||
|
@ -66,7 +66,7 @@ data TermRenderer output where
|
|||||||
deriving instance Eq (TermRenderer output)
|
deriving instance Eq (TermRenderer output)
|
||||||
deriving instance Show (TermRenderer output)
|
deriving instance Show (TermRenderer output)
|
||||||
|
|
||||||
|
-- | Specification of renderers for graph analysis, producing output in the parameter type.
|
||||||
data GraphRenderer output where
|
data GraphRenderer output where
|
||||||
JSONGraphRenderer :: GraphRenderer ByteString
|
JSONGraphRenderer :: GraphRenderer ByteString
|
||||||
DOTGraphRenderer :: GraphRenderer ByteString
|
DOTGraphRenderer :: GraphRenderer ByteString
|
||||||
@ -76,7 +76,7 @@ deriving instance Show (GraphRenderer output)
|
|||||||
|
|
||||||
-- | Abstraction of some renderer to some 'Monoid'al output which can be serialized to a 'ByteString'.
|
-- | Abstraction of some renderer to some 'Monoid'al output which can be serialized to a 'ByteString'.
|
||||||
--
|
--
|
||||||
-- This type abstracts the type indices of 'DiffRenderer' and 'TermRenderer' s.t. multiple renderers can be present in a single list, alternation, etc., while retaining the ability to render and serialize. (Without 'SomeRenderer', the different output types of individual term/diff renderers prevent them from being used in a homogeneously typed setting.)
|
-- This type abstracts the type indices of 'DiffRenderer', 'TermRenderer', and 'GraphRenderer' s.t. multiple renderers can be present in a single list, alternation, etc., while retaining the ability to render and serialize. (Without 'SomeRenderer', the different output types of individual term/diff renderers prevent them from being used in a homogeneously typed setting.)
|
||||||
data SomeRenderer f where
|
data SomeRenderer f where
|
||||||
SomeRenderer :: (Output output, Show (f output)) => f output -> SomeRenderer f
|
SomeRenderer :: (Output output, Show (f output)) => f output -> SomeRenderer f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user