mirror of
https://github.com/github/semantic.git
synced 2025-01-06 06:46:07 +03:00
Define all of the constraints over the term types.
This commit is contained in:
parent
5b2745a67f
commit
d1b15cdb4f
@ -140,57 +140,57 @@ pythonParserPrecise = UnmarshalParser PrecisePython.tree_sitter_python
|
|||||||
data SomeParser c a where
|
data SomeParser c a where
|
||||||
SomeParser :: c t => Parser (t a) -> SomeParser c a
|
SomeParser :: c t => Parser (t a) -> SomeParser c a
|
||||||
|
|
||||||
goParser' :: c (Term (Sum Go.Syntax)) => (Language, SomeParser c Loc)
|
goParser' :: c Go.Term => (Language, SomeParser c Loc)
|
||||||
goParser' = (Go, SomeParser goParser)
|
goParser' = (Go, SomeParser goParser)
|
||||||
|
|
||||||
javaParser' :: c PreciseJava.Term => (Language, SomeParser c Loc)
|
javaParser' :: c PreciseJava.Term => (Language, SomeParser c Loc)
|
||||||
javaParser' = (Java, SomeParser javaParserPrecise)
|
javaParser' = (Java, SomeParser javaParserPrecise)
|
||||||
|
|
||||||
javascriptParser' :: c (Term (Sum TSX.Syntax)) => (Language, SomeParser c Loc)
|
javascriptParser' :: c TSX.Term => (Language, SomeParser c Loc)
|
||||||
javascriptParser' = (JavaScript, SomeParser tsxParser)
|
javascriptParser' = (JavaScript, SomeParser tsxParser)
|
||||||
|
|
||||||
jsonParserPrecise' :: c PreciseJSON.Term => (Language, SomeParser c Loc)
|
jsonParserPrecise' :: c PreciseJSON.Term => (Language, SomeParser c Loc)
|
||||||
jsonParserPrecise' = (JSON, SomeParser jsonParserPrecise)
|
jsonParserPrecise' = (JSON, SomeParser jsonParserPrecise)
|
||||||
|
|
||||||
jsxParser' :: c (Term (Sum TSX.Syntax)) => (Language, SomeParser c Loc)
|
jsxParser' :: c TSX.Term => (Language, SomeParser c Loc)
|
||||||
jsxParser' = (JSX, SomeParser tsxParser)
|
jsxParser' = (JSX, SomeParser tsxParser)
|
||||||
|
|
||||||
markdownParser' :: c (Term (Sum Markdown.Syntax)) => (Language, SomeParser c Loc)
|
markdownParser' :: c Markdown.Term => (Language, SomeParser c Loc)
|
||||||
markdownParser' = (Markdown, SomeParser markdownParser)
|
markdownParser' = (Markdown, SomeParser markdownParser)
|
||||||
|
|
||||||
phpParser' :: c (Term (Sum PHP.Syntax)) => (Language, SomeParser c Loc)
|
phpParser' :: c PHP.Term => (Language, SomeParser c Loc)
|
||||||
phpParser' = (PHP, SomeParser phpParser)
|
phpParser' = (PHP, SomeParser phpParser)
|
||||||
|
|
||||||
pythonParserALaCarte' :: c (Term (Sum Python.Syntax)) => (Language, SomeParser c Loc)
|
pythonParserALaCarte' :: c Python.Term => (Language, SomeParser c Loc)
|
||||||
pythonParserALaCarte' = (Python, SomeParser pythonParser)
|
pythonParserALaCarte' = (Python, SomeParser pythonParser)
|
||||||
|
|
||||||
pythonParserPrecise' :: c PrecisePython.Term => (Language, SomeParser c Loc)
|
pythonParserPrecise' :: c PrecisePython.Term => (Language, SomeParser c Loc)
|
||||||
pythonParserPrecise' = (Python, SomeParser pythonParserPrecise)
|
pythonParserPrecise' = (Python, SomeParser pythonParserPrecise)
|
||||||
|
|
||||||
pythonParser' :: (c (Term (Sum Python.Syntax)), c PrecisePython.Term) => PerLanguageModes -> (Language, SomeParser c Loc)
|
pythonParser' :: (c Python.Term, c PrecisePython.Term) => PerLanguageModes -> (Language, SomeParser c Loc)
|
||||||
pythonParser' modes = case pythonMode modes of
|
pythonParser' modes = case pythonMode modes of
|
||||||
ALaCarte -> (Python, SomeParser pythonParser)
|
ALaCarte -> (Python, SomeParser pythonParser)
|
||||||
Precise -> (Python, SomeParser pythonParserPrecise)
|
Precise -> (Python, SomeParser pythonParserPrecise)
|
||||||
|
|
||||||
rubyParser' :: c (Term (Sum Ruby.Syntax)) => (Language, SomeParser c Loc)
|
rubyParser' :: c Ruby.Term => (Language, SomeParser c Loc)
|
||||||
rubyParser' = (Ruby, SomeParser rubyParser)
|
rubyParser' = (Ruby, SomeParser rubyParser)
|
||||||
|
|
||||||
tsxParser' :: c (Term (Sum TSX.Syntax)) => (Language, SomeParser c Loc)
|
tsxParser' :: c TSX.Term => (Language, SomeParser c Loc)
|
||||||
tsxParser' = (TSX, SomeParser tsxParser)
|
tsxParser' = (TSX, SomeParser tsxParser)
|
||||||
|
|
||||||
typescriptParser' :: c (Term (Sum TypeScript.Syntax)) => (Language, SomeParser c Loc)
|
typescriptParser' :: c TypeScript.Term => (Language, SomeParser c Loc)
|
||||||
typescriptParser' = (TypeScript, SomeParser typescriptParser)
|
typescriptParser' = (TypeScript, SomeParser typescriptParser)
|
||||||
|
|
||||||
|
|
||||||
-- | The canonical set of parsers producing à la carte terms.
|
-- | The canonical set of parsers producing à la carte terms.
|
||||||
aLaCarteParsers
|
aLaCarteParsers
|
||||||
:: ( c (Term (Sum Go.Syntax))
|
:: ( c Go.Term
|
||||||
, c (Term (Sum Markdown.Syntax))
|
, c Markdown.Term
|
||||||
, c (Term (Sum PHP.Syntax))
|
, c PHP.Term
|
||||||
, c (Term (Sum Python.Syntax))
|
, c Python.Term
|
||||||
, c (Term (Sum Ruby.Syntax))
|
, c Ruby.Term
|
||||||
, c (Term (Sum TSX.Syntax))
|
, c TSX.Term
|
||||||
, c (Term (Sum TypeScript.Syntax))
|
, c TypeScript.Term
|
||||||
)
|
)
|
||||||
=> Map Language (SomeParser c Loc)
|
=> Map Language (SomeParser c Loc)
|
||||||
aLaCarteParsers = Map.fromList
|
aLaCarteParsers = Map.fromList
|
||||||
@ -220,16 +220,16 @@ preciseParsers = Map.fromList
|
|||||||
|
|
||||||
-- | The canonical set of all parsers for the passed per-language modes.
|
-- | The canonical set of all parsers for the passed per-language modes.
|
||||||
allParsers
|
allParsers
|
||||||
:: ( c (Term (Sum Go.Syntax))
|
:: ( c Go.Term
|
||||||
, c PreciseJava.Term
|
, c PreciseJava.Term
|
||||||
, c PreciseJSON.Term
|
, c PreciseJSON.Term
|
||||||
, c (Term (Sum Markdown.Syntax))
|
, c Markdown.Term
|
||||||
, c (Term (Sum PHP.Syntax))
|
, c PHP.Term
|
||||||
, c (Term (Sum Python.Syntax))
|
, c Python.Term
|
||||||
, c PrecisePython.Term
|
, c PrecisePython.Term
|
||||||
, c (Term (Sum Ruby.Syntax))
|
, c Ruby.Term
|
||||||
, c (Term (Sum TSX.Syntax))
|
, c TSX.Term
|
||||||
, c (Term (Sum TypeScript.Syntax))
|
, c TypeScript.Term
|
||||||
)
|
)
|
||||||
=> PerLanguageModes
|
=> PerLanguageModes
|
||||||
-> Map Language (SomeParser c Loc)
|
-> Map Language (SomeParser c Loc)
|
||||||
|
Loading…
Reference in New Issue
Block a user