X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FLexer.x;h=dca51e47267d1d64272bd7eefcdded2adb5945f5;hp=09b58dd5b1184a4840b24717ef8ef85f7c033bf6;hb=2fe38b5fb0957f9428864afd69ad3ccd82fae3d0;hpb=a6a4959cd94716d1e2e6624f370eb9c1bdd96ecc diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 09b58dd..dca51e4 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -702,6 +702,14 @@ reservedSymsFM = listToUFM $ ,("→", ITrarrow, unicodeSyntaxEnabled) ,("←", ITlarrow, unicodeSyntaxEnabled) ,("⋯", ITdotdot, unicodeSyntaxEnabled) + + ,("⤙", ITlarrowtail, \i -> unicodeSyntaxEnabled i && arrowsEnabled i) + ,("⤚", ITrarrowtail, \i -> unicodeSyntaxEnabled i && arrowsEnabled i) + ,("⤛", ITLarrowtail, \i -> unicodeSyntaxEnabled i && arrowsEnabled i) + ,("⤜", ITRarrowtail, \i -> unicodeSyntaxEnabled i && arrowsEnabled i) + + ,("★", ITstar, unicodeSyntaxEnabled) + -- ToDo: ideally, → and ∷ should be "specials", so that they cannot -- form part of a large operator. This would let us have a better -- syntax for kinds: ɑ∷*→* would be a legal kind signature. (maybe). @@ -1127,7 +1135,7 @@ do_layout_left span _buf _len = do setLine :: Int -> Action setLine code span buf len = do let line = parseUnsignedInteger buf len 10 octDecDigit - setSrcLoc (mkSrcLoc (srcSpanFile span) (fromIntegral line - 1) 0) + setSrcLoc (mkSrcLoc (srcSpanFile span) (fromIntegral line - 1) 1) -- subtract one: the line number refers to the *following* line _ <- popLexState pushLexState code @@ -1983,7 +1991,9 @@ alternativeLayoutRuleToken t setNextToken t lexTokenAlr (_, ALRLayout _ col : ls, Just expectingOCurly) - | thisCol > col -> + | (thisCol > col) || + (thisCol == col && + isNonDecreasingIntentation expectingOCurly) -> do setAlrExpectingOCurly Nothing setALRContext (ALRLayout expectingOCurly thisCol : context) setNextToken t @@ -2081,6 +2091,10 @@ isALRclose ITccurly = True isALRclose ITcubxparen = True isALRclose _ = False +isNonDecreasingIntentation :: ALRLayout -> Bool +isNonDecreasingIntentation ALRLayoutDo = True +isNonDecreasingIntentation _ = False + containsCommas :: Token -> Bool containsCommas IToparen = True containsCommas ITobrack = True