On 18 October 2010 15:37, Vivian McPhail
<[email protected]>wrote:
> Hi,
>
> In attempting to use the lexer to see whether we are within an alternative
> layout context:
>
> [..]
>
> I have a function which tells us if there is layout going on:
>
> activeContext :: P Bool
> activeContext = do
> ctxt <- getALRContext
> expc <- getAlrExpectingOCurly
> impt <- implicitTokenPending
> case (ctxt,expc) of
> ([],Nothing) -> return impt
> _other -> return True
>
>
Okay, this function is doing the right thing. I also tried counting curly
brackets, which also doesn't work for the same reason:
In "AlternativeLayoutMode," when an EOF is encountered and there is an
outstanding context, the context is removed and a closing curly is inserted
(ITeof, ALRLayout _ _ : ls, _) ->
do setALRContext ls
setNextToken t
return (L thisLoc ITccurly)
So as it stands, if we simply lex the ghci command line, we will never be
inside a layout context once we see the EOF token.
Vivian
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs