Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Declarative Code Formatter ignores configurations related with parser rules
Declarative Code Formatter ignores configurations related with parser rules [message #774580] Wed, 04 January 2012 08:09 Go to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

I made some language and everything was good at first.


And, I tried to remove statement separator ';'.
So I've face a lot of ambiguous problems and left-recursion problems.

After some dig,
I could eliminate problems by left-factoring and using Syntactic Predicates.

After that, (I can't sure)
Declarative Code Formatter began to work incorrectly.
It seems to ignore every format configuration related with Parser-rules.

for Instance, My root rule is:
Calc:
	elements+=CalcElement*;

CalcElement:
	(Add | Define);
...


and My format configuration code begins with:
CalcGrammarAccess ga = (CalcGrammarAccess) getGrammarAccess();
c.setLinewrap(1, 1, 2).after(ga.getCalcElementRule());
...


But formatting did not make line wraps after each CalcElement.
I tried several other rules and alternative rules, nothing worked.

Only configuration related with keyword rules worked likes how I expected.


What do I missing some picture?

[Updated on: Wed, 04 January 2012 08:10]

Report message to a moderator

Re: Declarative Code Formatter ignores configurations related with parser rules [message #774602 is a reply to message #774580] Wed, 04 January 2012 09:16 Go to previous message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

I think only leaf parser-rules work correctly,
for instance:
A: B | C;

c.setLinewrap(1, 1, 2).after(ga.getARule()); // NOT WORK

c.setLinewrap(1, 1, 2).after(ga.getBRule()); // WORK
c.setLinewrap(1, 1, 2).after(ga.getCRule()); // WORK


Do I digging right place? If so, I consider it as a bug and I will make a manual formatter. I think it's easy because of I have still very powerful xtext parser.

PS.
Injection and lazy creation make debuging declarative formatter so crazy.
I tried make it real time debug-able but I couldn't. Any Idea?

And I think defining format configuration with Java Code makes no sense since it's called Declarative thing.
Previous Topic:overriding XbaseJavaValidator
Next Topic:Infer static block
Goto Forum:
  


Current Time: Fri Apr 26 23:26:35 GMT 2024

Powered by FUDForum. Page generated in 0.02118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top