on master help sign in
Merge pull request #731 from hannesm/report-column-on-warning

on error, report the column, as well as the line number in the ideslave ...

commit2aab37f52ffd8fd377224dd936476ed3ecb880f4 authorEdwin Brady <edwin.brady@gmail.com> dateWed 18 Dec 2013, 02:56 (13 years ago) parenta4801dacbe9965
3 files changed+6−2
src/Idris/AbsSyntax.hs+1−1 src/Idris/IdeSlave.hs+3 src/Idris/Parser.hs+2−1
src/Idris/AbsSyntax.hs+1−1
@@ -390,7 +390,7 @@ ihWarn :: Handle -> FC -> String -> Idris ()
390390ihWarn h fc err = do i <- getIState
391391 case idris_outputmode i of
392392 RawOutput -> runIO $ hPutStrLn h (show fc ++ ":" ++ err)
393− IdeSlave n -> runIO $ hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_line fc, err) n
393+ IdeSlave n -> runIO $ hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_line fc, fc_column fc, err) n
394394
395395setLogLevel :: Int -> Idris ()
396396setLogLevel l = do i <- getIState
src/Idris/IdeSlave.hs+3
@@ -66,6 +66,9 @@ instance (SExpable a, SExpable b) => SExpable (a, b) where
6666instance (SExpable a, SExpable b, SExpable c) => SExpable (a, b, c) where
6767 toSExp (l, m, n) = SexpList [toSExp l, toSExp m, toSExp n]
6868
69+instance (SExpable a, SExpable b, SExpable c, SExpable d) => SExpable (a, b, c, d) where
70+ toSExp (l, m, n, o) = SexpList [toSExp l, toSExp m, toSExp n, toSExp o]
71+
6972escape :: String -> String
7073escape = concatMap escapeChar
7174 where
src/Idris/Parser.hs+2−1
@@ -945,7 +945,8 @@ findFC :: Doc -> (FC, String)
945945findFC x = let s = show (plain x) in
946946 case span (/= ':') s of
947947 (failname, ':':rest) -> case span isDigit rest of
948− (line, ':':rest') -> (FC failname (read line) 0, drop 2 (dropWhile (/= ':') rest'))
948+ (line, ':':rest') -> case span isDigit rest' of
949+ (col, ':':msg) -> (FC failname (read line) (read col), msg)
949950
950951-- | A program is a list of declarations, possibly with associated
951952-- documentation strings.