X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fparser%2FLexer.x;h=54045aa6ab170adcfad5e78cf352837c7e093bcb;hb=e5b79a6988880d8757634683eefe2f03e45cdfc6;hp=e6de1e8ece6f1b2f17b6fbc70b448c05ce33b3ca;hpb=8f8ac4f9eb1dd5cc51c70e9c6ee1bcd824fbfcb2;p=ghc-hetmet.git diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index e6de1e8..54045aa 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -46,6 +46,7 @@ module Lexer ( Token(..), lexer, pragState, mkPState, PState(..), P(..), ParseResult(..), getSrcLoc, + getPState, failLocMsgP, failSpanMsgP, srcParseFail, getMessages, popContext, pushCurrentContext, setLastToken, setSrcLoc, @@ -57,7 +58,6 @@ module Lexer ( import Bag import ErrUtils -import Maybe import Outputable import StringBuffer import FastString @@ -71,6 +71,7 @@ import Control.Monad import Data.Bits import Data.Char import Data.List +import Data.Maybe import Data.Map (Map) import qualified Data.Map as Map import Data.Ratio @@ -1515,6 +1516,9 @@ failLocMsgP loc1 loc2 str = P $ \_ -> PFailed (mkSrcSpan loc1 loc2) (text str) failSpanMsgP :: SrcSpan -> SDoc -> P a failSpanMsgP span msg = P $ \_ -> PFailed span msg +getPState :: P PState +getPState = P $ \s -> POk s s + extension :: (Int -> Bool) -> P Bool extension p = P $ \s -> POk s (p $! extsBitmap s)