state in parsers

Kristof Bastiaensen <[email protected]> Mon, 02 Nov 2015 13:13:07 +0100
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
Hi,

I'd like to add support for haskell to semantic.  Haskell syntax is 
sensitive
to indentation, and I'd like to know if it is possible to use bovine or 
wisent for
it.

The layout rule is explained here:
https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-210002.7

What it does, is after certain keywords, whenever a '{' character is 
ommited, it
enters a layout context.  In the layout context it will remember the 
indentation
of the next token.  When a line has the same indentation as this token, 
a ';' token is
inserted before the expression.  Whenever the indentation is less than 
this, a '}' token
is inserted, and the layout context is ended.  The layout context is 
also ended when a parser error would occur.

So I would set a state variable to all the layout context indentations, 
and then change the behaviour of the lexer or parser based on this 
state.  Is that possible?  Would it interfere with incremental parsing?

Regards,
Kristof Bastiaensen

------------------------------------------------------------------------------