use of org.eclipse.xtext.nodemodel.impl.NodeModelBuilder in project xtext-xtend by eclipse.
the class CustomXtendParser method parse.
@Override
public IParseResult parse(RuleCall ruleCall, Reader reader, int initialLookAhead) {
NodeModelBuilder builder = createNodeModelBuilder();
builder.setForcedFirstGrammarElement(ruleCall);
IParseResult parseResult = doParse(ruleCall.getRule().getName(), new ReaderCharStream(reader), builder, initialLookAhead);
return parseResult;
}
use of org.eclipse.xtext.nodemodel.impl.NodeModelBuilder in project xtext-core by eclipse.
the class AbstractAntlrParser method parse.
@Override
public IParseResult parse(RuleCall ruleCall, Reader reader, int initialLookAhead) {
try {
NodeModelBuilder builder = nodeModelBuilder.get();
builder.setForcedFirstGrammarElement(ruleCall);
IParseResult parseResult = doParse(ruleCall.getRule().getName(), new ANTLRReaderStream(reader), builder, initialLookAhead);
return parseResult;
} catch (IOException e) {
throw new WrappedException(e);
}
}
use of org.eclipse.xtext.nodemodel.impl.NodeModelBuilder in project xtext-core by eclipse.
the class LazyLinkerTest method newSimpleNodeAdapter.
private ICompositeNode newSimpleNodeAdapter(final INode... nodes) {
NodeModelBuilder builder = new NodeModelBuilder();
ICompositeNode result = new CompositeNodeWithSemanticElement();
for (INode node : nodes) {
builder.addChild(result, (AbstractNode) node);
}
return result;
}
use of org.eclipse.xtext.nodemodel.impl.NodeModelBuilder in project xtext-core by eclipse.
the class LazyURIEncoderTest method testNodePath.
@Test
public void testNodePath() throws Exception {
NodeModelBuilder builder = new NodeModelBuilder();
ICompositeNode n = new CompositeNode();
ICompositeNode n1 = new CompositeNode();
builder.addChild(n, (AbstractNode) n1);
ICompositeNode n2 = new CompositeNode();
builder.addChild(n, (AbstractNode) n2);
ILeafNode l1 = new LeafNode();
builder.addChild(n2, (AbstractNode) l1);
ILeafNode l2 = new LeafNode();
builder.addChild(n2, (AbstractNode) l2);
assertEquals(n, find(n, n));
assertEquals(n1, find(n, n1));
assertEquals(n2, find(n, n2));
assertEquals(l1, find(n, l1));
assertEquals(l2, find(n, l2));
}
use of org.eclipse.xtext.nodemodel.impl.NodeModelBuilder in project xtext-core by eclipse.
the class HiddenAndTokenNodeIteratorTest method setUp.
@Before
public void setUp() throws Exception {
nodes = new INode[NUM_NODES];
NodeModelBuilder builder = new NodeModelBuilder();
nodes[0] = new CompositeNode();
nodes[1] = new CompositeNode();
nodes[2] = new HiddenLeafNode();
nodes[3] = new LeafNode();
nodes[4] = new HiddenLeafNode();
nodes[5] = new CompositeNode();
nodes[6] = new LeafNode();
nodes[7] = new CompositeNode();
nodes[8] = new HiddenLeafNode();
nodes[9] = new LeafNode();
builder.addChild((ICompositeNode) nodes[0], (AbstractNode) nodes[1]);
builder.addChild((ICompositeNode) nodes[0], (AbstractNode) nodes[5]);
builder.addChild((ICompositeNode) nodes[0], (AbstractNode) nodes[7]);
builder.addChild((ICompositeNode) nodes[0], (AbstractNode) nodes[9]);
builder.addChild((ICompositeNode) nodes[1], (AbstractNode) nodes[2]);
builder.addChild((ICompositeNode) nodes[1], (AbstractNode) nodes[3]);
builder.addChild((ICompositeNode) nodes[1], (AbstractNode) nodes[4]);
builder.addChild((ICompositeNode) nodes[5], (AbstractNode) nodes[6]);
builder.addChild((ICompositeNode) nodes[7], (AbstractNode) nodes[8]);
}
Aggregations