|Re: Semantic modification via IUnitOfWork brakes grammar [message #1052251 is a reply to message #1052193]
||Mon, 29 April 2013 21:24
| Henrik Lindberg
Registered: July 2009
Since NL is optional (NL*) the serializer is not forced to output|
anything and hence you do not get a NL.
When doing semantic changes, there is typically no existing nodes
containing the NL, so the formatter when formatting the added model
elements has no clue a NL is needed. (If there is a node model, then an
existing NL should be preserved if the formatting rules allow this).
I can think of a couple of ways to fix this:
- Make the serializer output a NL by default if there is no node model
- Make the serializer pick up information in an adapter and output what
is in the adapter (a more general solution).
- Assign the NL to a boolean - i.e. (endsWithNL ?= NL+)? (sets boolean
to true if there is a NL). Simply set it if you want one, and the
serializer should understand the need to output a NL when the endsWithNL
feature is true.
Hope that helps
On 2013-29-04 21:22, Pawel Pogorzelski wrote:
> I have a grammar that defines hidden tokens as SPACE, TAB and
> SL_COMMENT. That means neither CR nor LF are hidden:
> grammar acl.Acl hidden(WS, SL_COMMENT)
> terminal WS:
> (' ' | '\t')+;
> terminal NL:
> ('\r'? '\n');
> Then I have RuleSection:
> (group=GroupReference | user=User) ASSIGNMENT value=WORD? NL*;
> As you can see they are each in new line. Then, if I use IUnitOfWork
> these rules are not respected (inserted rule is before next section's
> header, in the same line). How do I perform semantic modification is
> cases like this?
Powered by FUDForum
. Page generated in 0.03241 seconds