|Re: Formatting for Python-like languages [message #821548 is a reply to message #821376]
||Thu, 15 March 2012 13:56
| Henrik Lindberg
Registered: July 2009
With the current formatter it is only possible to use rules based on the |
grammar. You need to write your own formatter.
I am however working on a semantic formatter with the intent of donating
it to Xtext. It is not quite finished yet, but for the brave, and those
that want to make sure their formatting needs are supported, it is
possible to experiment with it right now.
My plan was to invite others to try it and provide feedback in a week or
two - but if someone really wants to I am happy to help with information
how to use it.
It is in cloudsmith/geppetto @ github if you want to go on a hunt on
On 2012-15-03 10:22, jean-Luc Meunier wrote:
> Hi all,
> Sorry if my question is too simple, but I'm struggling with how to
> format a language that has no bracket/keyword to mark the start and end
> of blocks (like in Python for instance).
> Consider for instance a language like:
> 'type' name=ID (cases+=Case)+
> 'case' name=ID STRING+
> I'd like to format it like:
> type toto
> case un "foo"
> "second foo"
> case deux "foo"
> type tutu
> case trois "foo"
> ...and I'm unable to format it, because if I indent
> (setIndentationIncrement) after the 'type' keyword, I do not know where
> to dedent (setIndentationDecrement)
> Must be a trivial question, but I'm stuck.
Powered by FUDForum
. Page generated in 0.01571 seconds