X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FLexer.x;h=45da0d0ca23e8c26b2de0c18608579e7a1e14a45;hp=aed9cfb9655d68ce3a42cc291ee97af6b3693566;hb=9da4639011348fb6c318e3cba4b08622f811d9c4;hpb=72264dbcb05c7045dff28aa88b55634fa6c1ddf0 diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index aed9cfb..45da0d0 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -250,7 +250,6 @@ $white_no_nl+ ; <0,glaexts> { \? @varid / { ifExtension ipEnabled } { skip_one_varid ITdupipvarid } - \% @varid / { ifExtension ipEnabled } { skip_one_varid ITsplitipvarid } } { @@ -377,6 +376,7 @@ data Token | ITdotnet | ITmdo | ITiso + | ITfamily -- Pragmas | ITinline_prag Bool -- True <=> INLINE, False <=> NOINLINE @@ -441,7 +441,6 @@ data Token | ITqconsym (FastString,FastString) | ITdupipvarid FastString -- GHC extension: implicit param: ?x - | ITsplitipvarid FastString -- GHC extension: implicit param: %x | ITpragma StringBuffer @@ -501,6 +500,7 @@ isSpecial ITccallconv = True isSpecial ITstdcallconv = True isSpecial ITmdo = True isSpecial ITiso = True +isSpecial ITfamily = True isSpecial _ = False -- the bitmap provided as the third component indicates whether the @@ -541,7 +541,7 @@ reservedWordsFM = listToUFM $ ( "forall", ITforall, bit tvBit), ( "mdo", ITmdo, bit glaExtsBit), - ( "iso", ITiso, bit glaExtsBit), + ( "family", ITfamily, bit idxTysBit), ( "foreign", ITforeign, bit ffiBit), ( "export", ITexport, bit ffiBit), @@ -575,8 +575,9 @@ reservedSymsFM = listToUFM $ ,("-", ITminus, 0) ,("!", ITbang, 0) - ,("*", ITstar, bit glaExtsBit) -- For data T (a::*) = MkT - ,(".", ITdot, bit tvBit) -- For 'forall a . t' + ,("*", ITstar, bit glaExtsBit .|. + bit idxTysBit) -- For data T (a::*) = MkT + ,(".", ITdot, bit tvBit) -- For 'forall a . t' ,("-<", ITlarrowtail, bit arrowsBit) ,(">-", ITrarrowtail, bit arrowsBit) @@ -1311,6 +1312,7 @@ ipBit = 6 tvBit = 7 -- Scoped type variables enables 'forall' keyword bangPatBit = 8 -- Tells the parser to understand bang-patterns -- (doesn't affect the lexer) +idxTysBit = 9 -- indexed type families: 'family' keyword and kind sigs glaExtsEnabled, ffiEnabled, parrEnabled :: Int -> Bool glaExtsEnabled flags = testBit flags glaExtsBit @@ -1321,6 +1323,7 @@ thEnabled flags = testBit flags thBit ipEnabled flags = testBit flags ipBit tvEnabled flags = testBit flags tvBit bangPatEnabled flags = testBit flags bangPatBit +idxTysEnabled flags = testBit flags idxTysBit -- PState for parsing options pragmas -- @@ -1362,6 +1365,7 @@ mkPState buf loc flags = .|. ipBit `setBitIf` dopt Opt_ImplicitParams flags .|. tvBit `setBitIf` dopt Opt_ScopedTypeVariables flags .|. bangPatBit `setBitIf` dopt Opt_BangPatterns flags + .|. idxTysBit `setBitIf` dopt Opt_IndexedTypes flags -- setBitIf :: Int -> Bool -> Int b `setBitIf` cond | cond = bit b