本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation.toString方法的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation.toString方法的具体用法?Java StringConcatenation.toString怎么用?Java StringConcatenation.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtend2.lib.StringConcatenation
的用法示例。
在下文中一共展示了StringConcatenation.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFragment_01
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testFragment_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("First : name=ID Named;");
_builder.newLine();
_builder.append("fragment Named: name=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Named");
final ParserRule fragment = ((ParserRule) _findRuleForName_1);
this.validateRule(fragment);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
}
示例2: testGetElementsByName_07
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testGetElementsByName_07() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
final SuperCallScope scope = new SuperCallScope(grammar);
Iterable<IEObjectDescription> _elements = scope.getElements(QualifiedName.create("test", "Lang", "ID"));
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "test.Lang.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("test.Lang.ID", _findRuleForName);
this.assertElements(_elements, _mappedTo);
}
示例3: testBug296496_01
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBug296496_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("import \"classpath:/org/eclipse/xtext/enumrules/enums.ecore\"");
_builder.newLine();
_builder.append("ExistingType:");
_builder.newLine();
_builder.append(" ");
_builder.append("enumFeature=ExistingEnum stringFeature=ExistingEnum;");
_builder.newLine();
_builder.append("enum ExistingEnum:");
_builder.newLine();
_builder.append(" ");
_builder.append("SameName | OverriddenLiteral = \"overridden\" | DifferentName;");
_builder.newLine();
final String grammar = _builder.toString();
final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1);
Assert.assertEquals(resource.getErrors().toString(), 1,
resource.getErrors().size());
}
示例4: testBug_285140_04
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBug_285140_04() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.sublang with org.eclipse.xtext.xtext.ecoreInference.Bug285140TestLanguage");
_builder.newLine();
_builder.newLine();
_builder.append("import \"http://www.eclipse.org/2008/tmf/xtext/ActionLang\" as actionLang");
_builder.newLine();
_builder.newLine();
_builder.append("Child returns actionLang::Child:");
_builder.newLine();
_builder.append("\t");
_builder.append("Child unknown=ID;");
_builder.newLine();
final String grammar = _builder.toString();
final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1);
Assert.assertEquals(resource.getErrors().toString(), 1, resource.getErrors().size());
}
示例5: testContainmentVsReference_06
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testContainmentVsReference_06() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("import \'http://www.eclipse.org/emf/2002/Ecore\'");
_builder.newLine();
_builder.append("EReference: name=ID eContainingClass=EClass;");
_builder.newLine();
_builder.append("EClass: name=ID;");
_builder.newLine();
final String grammar = _builder.toString();
final XtextResource resource = this.getResourceFromStringAndExpect(grammar, 1);
Assert.assertEquals(resource.getErrors().toString(), 1,
resource.getErrors().size());
}
示例6: handleInvalidGeneratedGrammarFile
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public void handleInvalidGeneratedGrammarFile(final AntlrGrammarComparator.ErrorContext context) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Noticed an unexpectect character sequence in reference grammar after token ");
String _previousToken = context.getTestedGrammar().getPreviousToken();
_builder.append(_previousToken);
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("and before token ");
String _currentToken = context.getTestedGrammar().getCurrentToken();
_builder.append(_currentToken, "\t");
_builder.append(" in line ");
int _lineNumber = context.getTestedGrammar().getLineNumber();
_builder.append(_lineNumber, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("in file ");
String _absoluteFileName = context.getTestedGrammar().getAbsoluteFileName();
_builder.append(_absoluteFileName, "\t");
_builder.append(".");
throw new RuntimeException(_builder.toString());
}
示例7: testGetElementsByName_06
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testGetElementsByName_06() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
final SuperCallScope scope = new SuperCallScope(grammar);
Iterable<IEObjectDescription> _elements = scope.getElements(QualifiedName.create("Lang", "ID"));
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "test.Lang.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("Lang.ID", _findRuleForName);
this.assertElements(_elements, _mappedTo);
}
示例8: testGetElementsByName_05
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testGetElementsByName_05() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
final SuperCallScope scope = new SuperCallScope(grammar);
Iterable<IEObjectDescription> _elements = scope.getElements(QualifiedName.create("super", "ID"));
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("super.ID", _findRuleForName);
this.assertElements(_elements, _mappedTo);
}
示例9: multi
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void multi() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Rule: val=ID+; ");
_builder.newLine();
final String actual = this.toFeatureInfo(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Rule_Rule{");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("val[1,*]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final String expected = _builder_1.toString();
this.assertEquals(expected, actual);
}
示例10: testFragmentWithAction
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
@Ignore
public void testFragmentWithAction() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("R: f1=ID F; fragment F returns R: {A.prev=current} f2=ID;");
_builder.newLine();
final String actual = this.toPda(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("R:");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("start -> f1=ID");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("<<F -> stop");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append(">>F -> {A.prev=}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("f1=ID -> >>F");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("f2=ID -> <<F");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("{A.prev=} -> f2=ID");
_builder_1.newLine();
final String expected = _builder_1.toString();
Assert.assertEquals(expected, actual);
}
示例11: toString
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public String toString() {
StringConcatenation _builder = new StringConcatenation();
_builder.append(this.name);
_builder.append(" (");
URI _path = this.getPath();
_builder.append(_path);
_builder.append(")");
return _builder.toString();
}
示例12: toString
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public String toString() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("\"");
String _text = this.separator.getText();
_builder.append(_text);
_builder.append("\" at offset=");
int _offset = this.separator.getOffset();
_builder.append(_offset);
_builder.append(" lenght=");
int _length = this.separator.getLength();
_builder.append(_length);
return _builder.toString();
}
示例13: testParserRuleFragment_04
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testParserRuleFragment_04() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("MyRule: Documentable IntFeatureHolder;");
_builder.newLine();
_builder.append("fragment IntFeatureHolder: Documentable myFeature=INT NameFeatureHolder;");
_builder.newLine();
_builder.append("fragment NameFeatureHolder: Documentable name=STRING;");
_builder.newLine();
_builder.append("fragment Documentable*: doc=STRING;");
_builder.newLine();
final String grammar = _builder.toString();
EPackage ePackage = this.getEPackageFromGrammar(grammar);
final EList<EClassifier> classifiers = ePackage.getEClassifiers();
Assert.assertEquals(3, classifiers.size());
final EClassifier myRuleType = IterableExtensions.<EClassifier>head(classifiers);
Assert.assertEquals("MyRule", myRuleType.getName());
Assert.assertTrue(this.features(myRuleType).isEmpty());
final EClassifier intFeatureHolder = classifiers.get(1);
Assert.assertEquals("EInt", this.<EStructuralFeature>feature(intFeatureHolder, "myFeature").getEType().getName());
Assert.assertEquals(1, this.features(intFeatureHolder).size());
final EClassifier nameFeatureHolder = IterableExtensions.<EClassifier>last(classifiers);
Assert.assertEquals("EString", this.<EStructuralFeature>feature(nameFeatureHolder, "name").getEType().getName());
Assert.assertEquals(2, this.features(nameFeatureHolder).size());
}
示例14: getImportedNames
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Override
public Iterable<QualifiedName> getImportedNames() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("getImportedNames ");
_builder.append(this.URI);
IllegalStateException exception = new IllegalStateException(_builder.toString());
Indexer.ResolvedResourceDescription.LOG.error(exception, exception);
return CollectionLiterals.<QualifiedName>emptyList();
}
示例15: testOverrideDatatypeRule_01
import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testOverrideDatatypeRule_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test with org.eclipse.xtext.parser.datatyperules.DatatypeRulesTestLanguage");
_builder.newLine();
_builder.append("terminal fragment ModelId: \'a\'..\'z\'+;");
_builder.newLine();
final String grammarAsString = _builder.toString();
this.getResourceFromStringAndExpect(grammarAsString, 1);
}