1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Add a precise JSON parser.

This commit is contained in:
Rob Rix 2019-10-07 10:40:52 -04:00
parent 56956198fa
commit f4212d2c6e
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -57,6 +57,7 @@ import Data.Term
import Foreign.Ptr
import qualified Language.Go.Assignment as Go
import qualified Language.Java as PreciseJava
import qualified Language.JSON as PreciseJSON
import qualified Language.JSON.Assignment as JSON
import qualified Language.Markdown.Assignment as Markdown
import qualified Language.PHP.Assignment as PHP
@ -171,6 +172,9 @@ markdownParser = AssignmentParser MarkdownParser Markdown.assignment
javaParserPrecise :: Parser (PreciseJava.Term Loc)
javaParserPrecise = UnmarshalParser tree_sitter_java
jsonParserPrecise :: Parser (PreciseJSON.Term Loc)
jsonParserPrecise = UnmarshalParser tree_sitter_json
pythonParserPrecise :: Parser (PrecisePython.Term Loc)
pythonParserPrecise = UnmarshalParser tree_sitter_python
@ -244,6 +248,9 @@ javascriptParser' = (JavaScript, SomeParser tsxParser)
jsonParser' :: c (Term (Sum JSON.Syntax)) => (Language, SomeParser c Loc)
jsonParser' = (JSON, SomeParser jsonParser)
jsonParserPrecise' :: c PreciseJSON.Term => (Language, SomeParser c Loc)
jsonParserPrecise' = (JSON, SomeParser jsonParserPrecise)
jsxParser' :: c (Term (Sum TSX.Syntax)) => (Language, SomeParser c Loc)
jsxParser' = (JSX, SomeParser tsxParser)
@ -302,11 +309,13 @@ aLaCarteParsers = Map.fromList
-- | The canonical set of parsers producing precise terms.
preciseParsers
:: ( c PreciseJava.Term
, c PreciseJSON.Term
, c PrecisePython.Term
)
=> Map Language (SomeParser c Loc)
preciseParsers = Map.fromList
[ javaParser'
, jsonParserPrecise'
, pythonParserPrecise'
]