on master help sign in
Fixed parserWarning function
commitfb81dc34237b95c582e9551e573fcf4a2d72dd93 authorAhmad Salim Al-Sibahi <asal@itu.dk> dateThu 28 Jan 2016, 21:03 (11 years ago) parent060caf4
1 file changed+9−8
src/Idris/ParseHelpers.hs+9−8
src/Idris/ParseHelpers.hs+9−8
@@ -7,7 +7,7 @@ module Idris.ParseHelpers where
77import Prelude hiding (pi)
88
99import Text.Trifecta.Delta
10−import Text.Trifecta hiding (span, stringLiteral, charLiteral, natural, symbol, char, string, whiteSpace)
10+import Text.Trifecta hiding (span, stringLiteral, charLiteral, natural, symbol, char, string, whiteSpace, Err)
1111import Text.Parser.LookAhead
1212import Text.Parser.Expression
1313import qualified Text.Parser.Token as Tok
@@ -105,6 +105,14 @@ reportParserWarnings = do ist <- getIState
105105 parserWarnings ist)
106106 clearParserWarnings
107107
108+
109+parserWarning :: FC -> Maybe Opt -> Err -> IdrisParser ()
110+parserWarning fc warnOpt warnErr = do
111+ ist <- get
112+ let cmdline = opt_cmdline (idris_options ist)
113+ unless (maybe False (`elem` cmdline) warnOpt) $
114+ put ist { parserWarnings = (fc, warnErr) : parserWarnings ist }
115+
108116{- * Space, comments and literals (token/lexing like parsers) -}
109117
110118-- | Consumes any simple whitespace (any character which satisfies Char.isSpace)
@@ -666,10 +674,3 @@ collect (PInstance doc argDocs f s cs n nfc ps t en ds : ds')
666674 = PInstance doc argDocs f s cs n nfc ps t en (collect ds) : collect ds'
667675collect (d : ds) = d : collect ds
668676collect [] = []
669−
670−parserWarning :: FC -> Maybe Opt -> Err -> IdrisParser ()
671−parserWarning fc warnOpt warnErr = do
672− is <- get
673− let cmdline = opt_cmdline (idris_options ist)
674− unless (maybe False (`elem` cmdline) warnOpt) $
675− put ist { parserWarnings = (fc, warnErr) : parserWarnings ist }