本文整理汇总了Java中org.eclipse.xtext.GrammarUtil.isAssigned方法的典型用法代码示例。如果您正苦于以下问题:Java GrammarUtil.isAssigned方法的具体用法?Java GrammarUtil.isAssigned怎么用?Java GrammarUtil.isAssigned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.GrammarUtil
的用法示例。
在下文中一共展示了GrammarUtil.isAssigned方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkRuleCallInUnorderedGroup
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Check
public void checkRuleCallInUnorderedGroup(final RuleCall call) {
if (call.getRule() == null || call.getRule().eIsProxy() || !(call.getRule() instanceof ParserRule))
return;
if (GrammarUtil.isDatatypeRule((ParserRule) call.getRule()))
return;
if (GrammarUtil.isAssigned(call))
return;
if (EcoreUtil2.getContainerOfType(call, UnorderedGroup.class) != null)
error(
"Unassigned rule calls may not be used in unordered groups.",
call,
null,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
null);
}
示例2: findNext
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected Triple<INode, AbstractElement, EObject> findNext(INode node, boolean prune) {
INode current = next(node, prune);
while (current != null) {
if (current instanceof ILeafNode && ((ILeafNode) current).isHidden()) {
current = next(current, true);
continue;
}
EObject ge = current.getGrammarElement();
if (ge instanceof AbstractElement && isEObjectNode(current))
return Tuples.create(current, (AbstractElement) ge, getEObjectNodeEObject(current));
else if (GrammarUtil.isAssigned(ge) && !GrammarUtil.isEObjectRuleCall(ge)) {
if (ge instanceof CrossReference)
return Tuples.create(current, ((CrossReference) ge).getTerminal(), null);
else
return Tuples.create(current, (AbstractElement) ge, null);
} else
current = next(current, false);
}
return null;
}
示例3: isEObjectNode
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected boolean isEObjectNode(INode node) {
if (node.getGrammarElement() instanceof AbstractRule)
return true;
if (node.getGrammarElement() instanceof Action)
return true;
if (GrammarUtil.isAssignedEObjectRuleCall(node.getGrammarElement())) {
if (node.hasDirectSemanticElement())
return true;
AbstractRule rule = ((RuleCall) node.getGrammarElement()).getRule();
node = node.getParent();
while (node != null) {
if (GrammarUtil.isAssigned(node.getGrammarElement()))
return true;
if (node.getGrammarElement() instanceof Action
&& GrammarUtil.containingRule(node.getGrammarElement()) == rule)
return false;
node = node.getParent();
}
return true;
}
return false;
}
示例4: getInstantiatedType
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected EClass getInstantiatedType(AbstractElement element) {
TypeRef type = null;
if (GrammarUtil.isAssigned(element) || GrammarUtil.isEObjectFragmentRuleCall(element)) {
type = GrammarUtil.containingRule(element).getType();
} else if (element instanceof Action) {
type = ((Action) element).getType();
}
if (type != null) {
EClassifier classifier = type.getClassifier();
if (classifier instanceof EClass && !classifier.eIsProxy()) {
return (EClass) classifier;
}
}
return null;
}
示例5: isMandatoryAbsorber
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected boolean isMandatoryAbsorber(AbstractElement ele) {
if (ele == null)
return true;
if (GrammarUtil.isAssigned(ele))
return true;
if (GrammarUtil.isAssignedAction(ele))
return true;
// if (GrammarUtil.isDatatypeRuleCall(ele))
// return true;
return false;
}
示例6: getCall
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
public AbstractElement getCall(AbstractElement ele) {
if (GrammarUtil.isEObjectRuleCall(ele) && !GrammarUtil.isAssigned(ele)) {
return ((RuleCall) ele).getRule().getAlternatives();
}
return null;
}
示例7: isAbsorber
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected boolean isAbsorber(INode node) {
return node.getGrammarElement() != null && GrammarUtil.isAssigned(node.getGrammarElement());
}
示例8: isAbsorber
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
private static boolean isAbsorber(EObject grammarElement) {
return grammarElement != null && GrammarUtil.isAssigned(grammarElement);
}
示例9: _ebnf2
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
protected String _ebnf2(final Keyword it, final AntlrOptions options, final boolean supportActions) {
String _xifexpression = null;
if ((!supportActions)) {
_xifexpression = super._ebnf2(it, options, supportActions);
} else {
String _xifexpression_1 = null;
boolean _isAssigned = GrammarUtil.isAssigned(it);
if (_isAssigned) {
StringConcatenation _builder = new StringConcatenation();
String __ebnf2 = super._ebnf2(it, options, supportActions);
_builder.append(__ebnf2);
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
CharSequence _newLeafNode = this.newLeafNode(it, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it));
_builder.append(_newLeafNode, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_xifexpression_1 = _builder.toString();
} else {
StringConcatenation _builder_1 = new StringConcatenation();
String _localVar = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar);
_builder_1.append("=");
String __ebnf2_1 = super._ebnf2(it, options, supportActions);
_builder_1.append(__ebnf2_1);
_builder_1.newLineIfNotEmpty();
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
CharSequence _newLeafNode_1 = this.newLeafNode(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_newLeafNode_1, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
_builder_1.newLine();
_xifexpression_1 = _builder_1.toString();
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}
示例10: _ebnf2
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
protected String _ebnf2(final Keyword it, final AntlrOptions options, final boolean supportActions) {
String _xifexpression = null;
if ((!supportActions)) {
return super._ebnf2(it, options, supportActions);
} else {
String _xifexpression_1 = null;
boolean _isAssigned = GrammarUtil.isAssigned(it);
if (_isAssigned) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
CharSequence _markLeaf = this.markLeaf(it);
_builder.append(_markLeaf, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
String _localVar = this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it);
_builder.append(_localVar);
_builder.append("=");
String __ebnf2 = super._ebnf2(it, options, supportActions);
_builder.append(__ebnf2);
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
CharSequence _doneLeaf = this.doneLeaf(it, this._grammarAccessExtensions.localVar(GrammarUtil.containingAssignment(it), it));
_builder.append(_doneLeaf, "\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_xifexpression_1 = _builder.toString();
} else {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
CharSequence _markLeaf_1 = this.markLeaf(it);
_builder_1.append(_markLeaf_1, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
_builder_1.newLine();
String _localVar_1 = this._grammarAccessExtensions.localVar(it);
_builder_1.append(_localVar_1);
_builder_1.append("=");
String __ebnf2_1 = super._ebnf2(it, options, supportActions);
_builder_1.append(__ebnf2_1);
_builder_1.newLineIfNotEmpty();
_builder_1.append("{");
_builder_1.newLine();
_builder_1.append("\t");
CharSequence _doneLeaf_1 = this.doneLeaf(it, this._grammarAccessExtensions.localVar(it));
_builder_1.append(_doneLeaf_1, "\t");
_builder_1.newLineIfNotEmpty();
_builder_1.append("}");
_builder_1.newLine();
_xifexpression_1 = _builder_1.toString();
}
_xifexpression = _xifexpression_1;
}
return _xifexpression;
}