X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fparser%2FLexer.x;h=71657098b5ee41039a5cb7ee4ddb54edf09ac516;hb=31cf07bc6d4aa5babc48498c6c4198b642f50390;hp=a6f7224c97d3fcf72226a717d065d3a0aa99ce53;hpb=911ab82c2a7c1aaf8feb78731f0bae588d244e14;p=ghc-hetmet.git diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index a6f7224..7165709 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -334,19 +334,12 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") } } <0,option_prags> { - @qual @varid { check_qvarid } + @qual @varid { idtoken qvarid } @qual @conid { idtoken qconid } @varid { varid } @conid { idtoken conid } } --- after an illegal qvarid, such as 'M.let', --- we back up and try again in the bad_qvarid state: - { - @conid { pop_and (idtoken conid) } - @qual @conid { pop_and (idtoken qconid) } -} - <0> { @qual @varid "#"+ / { ifExtension magicHashEnabled } { idtoken qvarid } @qual @conid "#"+ / { ifExtension magicHashEnabled } { idtoken qconid } @@ -871,30 +864,6 @@ close_brace span _str _len = do popContext return (L span ITccurly) --- We have to be careful not to count M. as a qualified name --- when is a keyword. We hack around this by catching --- the offending tokens afterward, and re-lexing in a different state. -check_qvarid span buf len = do - case lookupUFM reservedWordsFM var of - Just (keyword,exts) - | not (isSpecial keyword) -> - if exts == 0 - then try_again - else do - b <- extension (\i -> exts .&. i /= 0) - if b then try_again - else return token - _other -> return token - where - (mod,var) = splitQualName buf len - token = L span (ITqvarid (mod,var)) - - try_again = do - (AI _ offs _) <- getInput - setInput (AI (srcSpanStart span) (offs-len) buf) - pushLexState bad_qvarid - lexToken - qvarid buf len = ITqvarid $! splitQualName buf len qconid buf len = ITqconid $! splitQualName buf len