Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » change unordered Stategy in Xtext 2.10
change unordered Stategy in Xtext 2.10 [message #1735877] Thu, 23 June 2016 12:24 Go to next message
Aleksandar Toshovski is currently offline Aleksandar ToshovskiFriend
Messages: 78
Registered: December 2011
Member
Hello,

I was using in the 2.9.0 the following code, but there are some changes in the structure of ContextPDAProvider. How can I set the Strategy now?



	@Override
	protected Pda<ISerState, RuleCall> createPDA(ParserRule rule) {
		SerializerParserRuleCfg cfg = new SerializerParserRuleCfg(rule);
		SerializerParserRuleFollowerFunction ff = new SerializerParserRuleFollowerFunction(cfg, rule);

		// treat unordered groups as regular groups
		ff.setUnorderedStrategy(FollowerFunctionImpl.UnorderedStrategy.SEQUENCE);

		Pda<ISerState, RuleCall> pda = pdaUtil.create(cfg, ff, new SerializerPDAElementFactory());
		return pdaUtil.filterOrphans(pda, new SerializerPDACloneFactory());
	}
Re: change unordered Stategy in Xtext 2.10 [message #1735893 is a reply to message #1735877] Thu, 23 June 2016 12:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13723
Registered: July 2009
Senior Member
without looking at the details, try having a look at org.eclipse.xtext.serializer.analysis.GrammarPDAProvider.createPDA(Grammar, ParserRule)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: change unordered Stategy in Xtext 2.10 [message #1735907 is a reply to message #1735893] Thu, 23 June 2016 13:35 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13723
Registered: July 2009
Senior Member
e.g. sth like


@SuppressWarnings("restriction")
public class MyDslPDAUtil extends PdaUtil {
	
	@Override
	public <S, P, E, T, D extends Pda<S, P>> D create(Cfg<E, T> cfg, FollowerFunction<E> ff,
			PdaFactory<D, S, P, ? super E> fact) {
		((FollowerFunctionImpl<E, T>)ff).setUnorderedStrategy(UnorderedStrategy.SEQUENCE);
		return super.create(cfg, ff, fact);
	}

}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext keyword problem
Next Topic:Xtend cannot see methods in Xtext's generated classes
Goto Forum:
  


Current Time: Mon Jan 25 09:05:25 GMT 2021

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

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

Back to the top