use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testTree_06.
@Test
public void testTree_06() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\"a\"");
_builder.newLine();
_builder.append("\"b\"");
_builder.newLine();
final Tree tree = this.parseAndValidate(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("a");
_builder_1.newLine();
_builder_1.append("b");
_builder_1.newLine();
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testEmptyTree.
@Test
public void testEmptyTree() {
final Tree tree = this.parse("");
Assert.assertNotNull(tree);
Assert.assertTrue(tree.getNodes().isEmpty());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwarePartialParsingErrorTest method testResourceUpdate.
@Test
public void testResourceUpdate() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("a");
_builder.newLine();
_builder.append("\t");
_builder.append("b // single tab");
_builder.newLine();
_builder.append(" ");
_builder.append("// 8 spaces eq 1 tab");
_builder.newLine();
_builder.append("d");
_builder.newLine();
final String model = _builder.toString();
final Tree tree = this.parseHelper.parse(model);
Resource _eResource = tree.eResource();
final XtextResource resource = ((XtextResource) _eResource);
final int idx = model.indexOf(" // 8");
resource.update(idx, 0, "c");
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
final Tree reparsed = ((Tree) _head);
Assert.assertNotSame(tree, reparsed);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class NodeModelTest method getRootNode.
private ICompositeNode getRootNode(final CharSequence seq) {
try {
final Tree model = this.parseHelper.parse(seq.toString().replaceAll("\r\n", "\n"));
final ICompositeNode result = NodeModelUtils.getNode(model).getRootNode();
this.invariantChecker.checkInvariant(result);
return result;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations