Using declarative formatter with Assignment objects [message #783746] |
Thu, 26 January 2012 11:19 |
John J. Camilleri Messages: 33 Registered: November 2011 Location: Göteborg |
Member |
|
|
In my grammar I have a rule like so:
I want to implement my formatter to achieve the following:
aaa ->
bbb
ccc ->
ddd
eee ->
fff
Since there is no keyword after the second ID, in my formatter I tried something like the following:
c.setLinewrap().before(f.getExpRule());
Assignment k = f.getExpAccess().getVAssignment_0_2();
c.setLinewrap().before(k);
c.setIndentationIncrement().before(k);
c.setLinewrap().after(k);
c.setIndentationDecrement().after(k);
While the "before" rules seem to work fine, the "after" rules do not seem to work on Assignment objects. Thus my indentation is never decremented and I end up with the following:
aaa ->
bbb
ccc ->
ddd
eee ->
fff
How can I achieve this when there is no keyword and the end of the Exp rule for me to apply after() to?
[Updated on: Thu, 26 January 2012 12:28] Report message to a moderator
|
|
|
|
|
Re: Using declarative formatter with Assignment objects [message #783788 is a reply to message #783780] |
Thu, 26 January 2012 13:11 |
John J. Camilleri Messages: 33 Registered: November 2011 Location: Göteborg |
Member |
|
|
Thanks for your reply, but I'm not sure exactly what you mean.
If you are suggesting something like the following:
c.setIndentationDecrement().after( f.getIDRule() );
then this is not suitable, because the decreasing of the indentation only applies when ID appears after the -> in the example rule above.
In other words, I don't want to define the formatting for all ID rule calls.
Does anyone have any suggestions for how to handle this?
[Updated on: Mon, 30 January 2012 08:40] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02992 seconds