org.eclipse.xtext.parser.IAstFactory Java Examples

The following examples show how to use org.eclipse.xtext.parser.IAstFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WhitespacePreservingCallbackTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testFail2() throws Exception {
	IAstFactory f = getASTFactory();
	EObject add = f.create(ComplexrewritetestPackage.Literals.ADD);

	// one operand INVALID
	EObject atom1 = f.create(ComplexrewritetestPackage.Literals.ATOM);
	f.set(atom1, "name", "x", null, null);
	f.add(add, "addOperands", atom1, null, null);
	failsWith(add);

	// two operands VALID
	EObject atom2 = f.create(ComplexrewritetestPackage.Literals.ATOM);
	f.set(atom2, "name", "x", null, null);
	f.add(add, "addOperands", atom2, null, null);
	assertNotNull(serialize(add));

	// three operands INVALID
	EObject atom3 = f.create(ComplexrewritetestPackage.Literals.ATOM);
	f.set(atom3, "name", "x", null, null);
	f.add(add, "addOperands", atom3, null, null);
	failsWith(add);
}
 
Example #2
Source File: AbstractXtextTests.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected IAstFactory getASTFactory() {
	return getInjector().getInstance(IAstFactory.class);
}
 
Example #3
Source File: AbstractXtextTests.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected IAstFactory getASTFactory() {
	return getInjector().getInstance(IAstFactory.class);
}
 
Example #4
Source File: ParseResultFactory.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void setFactory(IAstFactory factory) {
	this.factory = factory;
}
 
Example #5
Source File: ParseResultFactory.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public IAstFactory getFactory() {
	return factory;
}
 
Example #6
Source File: AbstractAntlrParser.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public IAstFactory getElementFactory() {
	return elementFactory;
}
 
Example #7
Source File: AbstractAntlrParser.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void setElementFactory(IAstFactory elementFactory) {
	this.elementFactory = elementFactory;
}
 
Example #8
Source File: AbstractInternalAntlrParser.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void setSemanticModelBuilder(IAstFactory semanticModelBuilder) {
	this.semanticModelBuilder = semanticModelBuilder;
}
 
Example #9
Source File: AbstractInternalAntlrParser.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public IAstFactory getSemanticModelBuilder() {
	return semanticModelBuilder;
}
 
Example #10
Source File: WhitespacePreservingCallbackTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testFail1() throws Exception {
	IAstFactory f = getASTFactory();
	failsWith(f.create(ComplexrewritetestPackage.Literals.ADD));
}
 
Example #11
Source File: AbstractXtextTests.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected IAstFactory getASTFactory() {
	return getInjector().getInstance(IAstFactory.class);
}
 
Example #12
Source File: N4JSRuntimeModule.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * customized AST element factory, that sets the PropertyAssignment kind depending if the element is a
 * name-value-pair, a getter or setter and the feature is a name.
 *
 * @return Class<{@link PropertyNameAwareElementFactory}>
 */
@Override
public Class<? extends IAstFactory> bindIAstFactory() {
	return PropertyNameAwareElementFactory.class;
}