X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FLexer.x;h=1be9aa3443047a383be041bbfddd8527112a72d2;hb=55fe426859d8e9922e46821e52cff150d5628253;hp=96f1ad2eba942a372d508dd421cda1b4daf88ded;hpb=01ecefa4b97106fec5c139c5514e5d56e59ecbaf;p=ghc-hetmet.git diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 96f1ad2..1be9aa3 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -28,7 +28,8 @@ module Lexer ( getMessages, popContext, pushCurrentContext, setLastToken, setSrcLoc, getLexState, popLexState, pushLexState, - extension, standaloneDerivingEnabled, bangPatEnabled + extension, standaloneDerivingEnabled, bangPatEnabled, + addWarning ) where #include "HsVersions.h" @@ -405,7 +406,6 @@ data Token | ITdata | ITdefault | ITderiving - | ITderive | ITdo | ITelse | IThiding @@ -559,7 +559,6 @@ isSpecial :: Token -> Bool -- not as a keyword. isSpecial ITas = True isSpecial IThiding = True -isSpecial ITderive = True isSpecial ITqualified = True isSpecial ITforall = True isSpecial ITexport = True @@ -590,7 +589,6 @@ reservedWordsFM = listToUFM $ ( "data", ITdata, 0 ), ( "default", ITdefault, 0 ), ( "deriving", ITderiving, 0 ), - ( "derive", ITderive, 0 ), ( "do", ITdo, 0 ), ( "else", ITelse, 0 ), ( "hiding", IThiding, 0 ), @@ -1301,8 +1299,8 @@ getCharOrFail = do -- Warnings warn :: DynFlag -> SDoc -> Action -warn option warning span _buf _len = do - addWarning option (mkWarnMsg span alwaysQualify warning) +warn option warning srcspan _buf _len = do + addWarning option srcspan warning lexToken -- ----------------------------------------------------------------------------- @@ -1584,10 +1582,11 @@ mkPState buf loc flags = b `setBitIf` cond | cond = bit b | otherwise = 0 -addWarning :: DynFlag -> WarnMsg -> P () -addWarning option w +addWarning :: DynFlag -> SrcSpan -> SDoc -> P () +addWarning option srcspan warning = P $ \s@PState{messages=(ws,es), dflags=d} -> - let ws' = if dopt option d then ws `snocBag` w else ws + let warning' = mkWarnMsg srcspan alwaysQualify warning + ws' = if dopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () getMessages :: PState -> Messages