hidden whitespaces and formatting [message #915517] |
Mon, 17 September 2012 12:55 |
Christoph Caks Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Hi,
i'm trying to add formatting to my grammer and stumbled upon the following issue:
when a rule does not hide whitespaces "Fuu hidden():" the formatter autmatically duplicates the whitespaces within the rule.
here is a simple example:
the grammer
grammar example.WSFun with org.eclipse.xtext.common.Terminals
generate wSFun "<url stripped, because the forum won't allow links>"
Model:
lines+=(WSLine|NoWSLine)+
;
WSLine returns Line:
{WSLine} 'ws' 'A' 'B' ';'
;
NoWSLine returns Line hidden():
{NoWSLine} 'nows' WS+ 'A' WS+ 'B' WS* ';'
;
the formatter:
protected void configureFormatting(FormattingConfig c) {
for (Keyword k : getGrammarAccess().findKeywords(";")) {
c.setLinewrap().after(k);
c.setNoSpace().before(k);
}
}
formatting the WSLine works perfectly fine, but formatting the NoWSLine leads to the issue.
before calling format:
after the first call to format:
after the second call to format:
i used
Xtext SDK 2.3.0.v201206120633 org.eclipse.xtext.sdk.feature.group Eclipse Modeling Project
is there a way to work around this?
I need the whitespaces in my language, so using hidden(WS) is no solution for me :/
greetings Christoph
[Updated on: Mon, 17 September 2012 12:57] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02984 seconds