1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Generalize the parser helper over the parser.

This commit is contained in:
Rob Rix 2018-03-08 12:50:00 -05:00
parent 0bbbe11b77
commit 5887ba194f

View File

@ -54,13 +54,13 @@ type PythonTracer = TracingAnalysis [] (Evaluating Python.Term PythonValue (Dead
evaluateDeadTracePythonFile path = run @(DeadCodeAnalysis PythonTracer) . evaluateModule <$> (file path >>= runTask . parse pythonParser)
evaluatePythonFile path = evaluate @PythonValue . snd <$> parsePythonFile path
evaluatePythonFile path = evaluate @PythonValue . snd <$> parseFile pythonParser path
evaluatePythonFiles paths = do
pair:pairs <- traverse parsePythonFile paths
pair:pairs <- traverse (parseFile pythonParser) paths
pure $ evaluates @PythonValue pairs pair
parsePythonFile path = runTask (file path >>= fmap . (,) <*> parse pythonParser)
parseFile parser path = runTask (file path >>= fmap . (,) <*> parse parser)
-- Diff helpers