use of org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider in project xtext-core by eclipse.
the class GrammarConstraintProviderAssignedActionTest method getParserRule.
private String getParserRule(String body) throws Exception {
Grammar grammar = (Grammar) getModel(HEADER + body);
IGrammarConstraintProvider gcp = get(IGrammarConstraintProvider.class);
// try {
// new ActionFilter2Dot().draw(grammar, getName() + ".pdf", "-T pdf");
// } catch (IOException e) {
// if (log.isDebugEnabled())
// log.debug(e.getMessage(), e);
// }
SerializationContextMap<IConstraint> constraints = gcp.getConstraints(grammar);
List<String> result = Lists.newArrayList();
for (SerializationContextMap.Entry<IConstraint> r : constraints.sortedCopy().values()) {
result.add(Joiner.on(", ").join(r.getContexts()) + ":");
result.add(" " + r.getValue());
}
return Joiner.on("\n").join(result);
}
use of org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider in project xtext-core by eclipse.
the class GrammarConstraintProviderAssignedActionTest method testXtext.
@Test
public void testXtext() {
IGrammarConstraintProvider gcp = get(IGrammarConstraintProvider.class);
Grammar grammar = getGrammarAccess().getGrammar();
// try {
// new ActionFilter2Dot().draw(getGrammarAccess().getGrammar(),
// getName() + ".pdf", "-T pdf");
// } catch (IOException e) {
// if (log.isDebugEnabled())
// log.debug(e.getMessage(), e);
// }
// SerializationContextMap<IConstraint> constraints =
gcp.getConstraints(grammar);
// List<String> result = Lists.newArrayList();
// Set<IConstraint> visited = Sets.newHashSet();
// for (Entry<ISerializationContext, IConstraint> r :
// constraints.entrySet()) {
// ISerializationContext context = r.getKey();
// IConstraint constraint = r.getValue();
// result.add(context.toString());
// if (visited.add(constraint))
// result.add(" " + constraint.toString());
// }
// System.out.println(Joiner.on("\n").join(result));
}
use of org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider in project xtext-core by eclipse.
the class GrammarConstraintProviderTest method getParserRule.
private String getParserRule(String body) throws Exception {
Grammar grammar = (Grammar) getModel(HEADER + body);
IGrammarConstraintProvider gcp = get(IGrammarConstraintProvider.class);
SerializationContextMap<IConstraint> constraints = gcp.getConstraints(grammar);
List<String> result = Lists.newArrayList();
for (Entry<IConstraint> r : constraints.sortedCopy().values()) {
result.add(Joiner.on(", ").join(r.getContexts()) + ":");
result.add(" " + r.getValue());
}
return Joiner.on("\n").join(result);
}
Aggregations