On 18/10/2010 05:53, Vivian McPhail wrote:


On 18 October 2010 15:37, Vivian McPhail
<[email protected]
<mailto:[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.

Right, so you need to lex up to the end of the line, but without letting the lexer see the EOF token, presumably?

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to