@@ -57,8 +57,7 @@ import Data.Ord
57import qualified Data.Text as T
57import qualified Data.Text as T
58import qualified System.Directory as Dir (makeAbsolute)
58import qualified System.Directory as Dir (makeAbsolute)
59import System.FilePath
59import System.FilePath
60−import Text.PrettyPrint.ANSI.Leijen (Doc, plain)
61−import qualified Text.PrettyPrint.ANSI.Leijen as ANSI
60+import qualified Text.PrettyPrint.ANSI.Leijen as PP
62import Text.Trifecta ((<?>))
61import Text.Trifecta ((<?>))
63import qualified Text.Trifecta as P
62import qualified Text.Trifecta as P
64import qualified Text.Trifecta.Delta as P
63import qualified Text.Trifecta.Delta as P
@@ -1478,19 +1477,19 @@ runElabDecl syn =
1479{- * Loading and parsing -}
1478{- * Loading and parsing -}
1480{-| Parses an expression from input -}
1479{-| Parses an expression from input -}
1481−parseExpr :: IState -> String -> Either P.ErrInfo PTerm
1480+parseExpr :: IState -> String -> Either ParseError PTerm
1482parseExpr st = runparser (fullExpr defaultSyntax) st "(input)"
1481parseExpr st = runparser (fullExpr defaultSyntax) st "(input)"
1484{-| Parses a constant form input -}
1483{-| Parses a constant form input -}
1485−parseConst :: IState -> String -> Either P.ErrInfo Const
1484+parseConst :: IState -> String -> Either ParseError Const
1486parseConst st = runparser (fmap fst constant) st "(input)"
1485parseConst st = runparser (fmap fst constant) st "(input)"
1488{-| Parses a tactic from input -}
1487{-| Parses a tactic from input -}
1489−parseTactic :: IState -> String -> Either P.ErrInfo PTactic
1488+parseTactic :: IState -> String -> Either ParseError PTactic
1490parseTactic st = runparser (fullTactic defaultSyntax) st "(input)"
1489parseTactic st = runparser (fullTactic defaultSyntax) st "(input)"
1492{-| Parses a do-step from input (used in the elab shell) -}
1491{-| Parses a do-step from input (used in the elab shell) -}
1493−parseElabShellStep :: IState -> String -> Either P.ErrInfo (Either ElabShellCmd PDo)
1492+parseElabShellStep :: IState -> String -> Either ParseError (Either ElabShellCmd PDo)
1494parseElabShellStep ist = runparser (Right <$> do_ defaultSyntax <|> Left <$> elabShellCmd) ist "(input)"
1493parseElabShellStep ist = runparser (Right <$> do_ defaultSyntax <|> Left <$> elabShellCmd) ist "(input)"
1495 where elabShellCmd = char ':' >>
1494 where elabShellCmd = char ':' >>
1496 (reserved "qed" >> pure EQED ) <|>
1495 (reserved "qed" >> pure EQED ) <|>
@@ -1553,8 +1552,8 @@ parseImports fname input
1553 shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
1552 shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
1555-- | There should be a better way of doing this...
1554-- | There should be a better way of doing this...
1556−findFC :: Doc -> (FC, String)
1555+findFC :: PP.Doc -> (FC, String)
1557−findFC x = let s = show (plain x) in findFC' s
1556+findFC x = let s = show (PP.plain x) in findFC' s
1558 where findFC' s = case span (/= ':') s of
1557 where findFC' s = case span (/= ':') s of
1559 -- Horrid kludge to prevent crashes on Windows
1558 -- Horrid kludge to prevent crashes on Windows
1560 (prefix, ':':'\\':rest) ->
1559 (prefix, ':':'\\':rest) ->
@@ -1568,8 +1567,8 @@ findFC x = let s = show (plain x) in findFC' s
1568 (FC failname pos pos, msg)
1567 (FC failname pos pos, msg)
1570-- | Check if the coloring matches the options and corrects if necessary
1569-- | Check if the coloring matches the options and corrects if necessary
1571−fixColour :: Bool -> ANSI.Doc -> ANSI.Doc
1570+fixColour :: Bool -> PP.Doc -> PP.Doc
1572−fixColour False doc = ANSI.plain doc
1571+fixColour False doc = PP.plain doc
1573fixColour True doc = doc
1572fixColour True doc = doc
1575-- | A program is a list of declarations, possibly with associated
1574-- | A program is a list of declarations, possibly with associated
@@ -1579,17 +1578,17 @@ parseProg :: SyntaxInfo -> FilePath -> String -> Maybe P.Delta ->
1579parseProg syn fname input mrk
1578parseProg syn fname input mrk
1580 = do i <- getIState
1579 = do i <- getIState
1581 case runparser mainProg i fname input of
1580 case runparser mainProg i fname input of
1582− Left (P.ErrInfo doc _) -> do -- FIXME: Get error location from trifecta
1581+ Left doc -> do -- FIXME: Get error location from trifecta
1583− -- this can't be the solution!
1582+ -- this can't be the solution!
1584− -- Issue #1575 on the issue tracker.
1583+ -- Issue #1575 on the issue tracker.
1585− -- https://github.com/idris-lang/Idris-dev/issues/1575
1584+ -- https://github.com/idris-lang/Idris-dev/issues/1575
1586− let (fc, msg) = findFC doc
1585+ let (fc, msg) = findFC doc
1587− i <- getIState
1586+ i <- getIState
1588− case idris_outputmode i of
1587+ case idris_outputmode i of
1589− RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1588+ RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1590− IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1589+ IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1591− putIState (i { errSpan = Just fc })
1590+ putIState (i { errSpan = Just fc })
1592− return []
1591+ return []
1593 Right (x, i) -> do putIState i
1592 Right (x, i) -> do putIState i
1594 reportParserWarnings
1593 reportParserWarnings
1595 return $ collect x
1594 return $ collect x