当前位置: 首页>>代码示例>>Java>>正文


Java GrammarUtil.isBooleanAssignment方法代码示例

本文整理汇总了Java中org.eclipse.xtext.GrammarUtil.isBooleanAssignment方法的典型用法代码示例。如果您正苦于以下问题:Java GrammarUtil.isBooleanAssignment方法的具体用法?Java GrammarUtil.isBooleanAssignment怎么用?Java GrammarUtil.isBooleanAssignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.GrammarUtil的用法示例。


在下文中一共展示了GrammarUtil.isBooleanAssignment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFeature

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
public void addFeature(Assignment assignment) throws TransformationException {
	final String featureName = assignment.getFeature();
	boolean isMultivalue = GrammarUtil.isMultipleAssignment(assignment);
	boolean isContainment = true;
	EClassifierInfo featureTypeInfo;

	if (GrammarUtil.isBooleanAssignment(assignment)) {
		checkNoFragmentRuleCall(assignment.getTerminal());
		EDataType eBoolean = GrammarUtil.findEBoolean(GrammarUtil.getGrammar(assignment));
		featureTypeInfo = getEClassifierInfoOrThrowException(eBoolean, assignment);
		isMultivalue = false;
	}
	else {
		AbstractElement terminal = assignment.getTerminal();
		if (terminal == null) {
			throw new TransformationException(TransformationErrorCode.NoSuchTypeAvailable, "Cannot derive type from incomplete assignment.", assignment);
		}
		checkNoFragmentRuleCall(terminal);
		EClassifier type = getTerminalType(terminal);
		isContainment = isContainmentAssignment(assignment);
		featureTypeInfo = getEClassifierInfoOrThrowException(type, assignment);
	}
	addFeature(featureName, featureTypeInfo, isMultivalue, isContainment, assignment);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:Xtext2EcoreInterpretationContext.java

示例2: accept

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
public void accept(Keyword keyword) {
	Assignment ass = getAssignment(keyword);
	Object value = GrammarUtil.isBooleanAssignment(ass) ? Boolean.TRUE : keyword.getValue();
	EStructuralFeature feature = getFeature(ass.getFeature());
	ILeafNode node = getLeafNode(feature, value);
	String token = getToken(keyword, value, node);
	assertIndex(feature);
	acceptKeyword(ass, keyword, value, token, ISemanticSequenceAcceptor.NO_INDEX, node);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:SequenceFeeder.java

示例3: getToken

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected String getToken(RuleCall rc, Object value, INode node) {
	CrossReference crossRef = GrammarUtil.containingCrossReference(rc);
	Assignment assignment = GrammarUtil.containingAssignment(rc);
	if (crossRef != null)
		return provider.crossRefSerializer.serializeCrossRef(semanticObject, crossRef, (EObject) value, node,
				errorAcceptor);
	else if (GrammarUtil.isEObjectRuleCall(rc) || GrammarUtil.isBooleanAssignment(assignment))
		return null;
	else if (GrammarUtil.isEnumRuleCall(rc))
		return provider.enumLiteralSerializer.serializeAssignedEnumLiteral(semanticObject, rc, value, node,
				errorAcceptor);
	else
		return provider.valueSerializer.serializeAssignedValue(semanticObject, rc, value, node, errorAcceptor);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:SequenceFeeder.java

示例4: findValidBooleanAssignments

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected Set<AbstractElement> findValidBooleanAssignments(EObject semanticObj,
		Iterable<AbstractElement> assignedElements, Object value) {
	Set<AbstractElement> result = Sets.newLinkedHashSet();
	for (AbstractElement ele : assignedElements)
		if (GrammarUtil.isBooleanAssignment(GrammarUtil.containingAssignment(ele))) {
			if (Boolean.TRUE.equals(value))
				result.add(ele);
		} else {
			if (ele instanceof RuleCall && valueSerializer.isValid(semanticObj, (RuleCall) ele, value, null))
				result.add(ele);
		}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:AssignmentFinder.java

示例5: isBooleanAssignment

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
public boolean isBooleanAssignment() {
	if (booleanAssignment == null) {
		Assignment assignment = GrammarUtil.containingAssignment(assignedGrammarElement);
		booleanAssignment = assignment != null && GrammarUtil.isBooleanAssignment(assignment);
	}
	return booleanAssignment;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:SemanticSequencerNfaProvider.java

示例6: isUnassignedRuleCall

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
private boolean isUnassignedRuleCall(final RuleCall c) {
  boolean _isEObjectRuleCall = GrammarUtil.isEObjectRuleCall(c);
  if (_isEObjectRuleCall) {
    return false;
  }
  final Assignment ass = GrammarUtil.containingAssignment(c);
  return ((ass == null) || GrammarUtil.isBooleanAssignment(ass));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:SerializerFragment2.java

示例7: getUnassignedRuleCallToken

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected String getUnassignedRuleCallToken(RuleCall ruleCall, INode node) {
	Assignment ass = GrammarUtil.containingAssignment(ruleCall);
	if (ass != null && !GrammarUtil.isBooleanAssignment(ass))
		throw new IllegalStateException("RuleCall is invalid; Can not determine token.");
	return getUnassignedRuleCallToken(contexts.peek().semanticObject, ruleCall, node);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:AbstractSyntacticSequencer.java

示例8: _assignmentEbnf

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
protected String _assignmentEbnf(final AbstractElement it, final Assignment assignment, final AntlrOptions options, final boolean supportActions) {
  String _xifexpression = null;
  if (supportActions) {
    StringConcatenation _builder = new StringConcatenation();
    String _localVar = this._grammarAccessExtensions.localVar(assignment, it);
    _builder.append(_localVar);
    _builder.append("=");
    String __assignmentEbnf = super._assignmentEbnf(it, assignment, options, supportActions);
    _builder.append(__assignmentEbnf);
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if ($current==null) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("$current = ");
    CharSequence _createModelElement = this.createModelElement(assignment);
    _builder.append(_createModelElement, "\t\t");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    String _setOrAdd = this._grammarAccessExtensions.setOrAdd(assignment);
    _builder.append(_setOrAdd, "\t");
    _builder.append("WithLastConsumed($current, \"");
    String _feature = assignment.getFeature();
    _builder.append(_feature, "\t");
    _builder.append("\", ");
    {
      boolean _isBooleanAssignment = GrammarUtil.isBooleanAssignment(assignment);
      if (_isBooleanAssignment) {
        _builder.append("true");
      } else {
        String _localVar_1 = this._grammarAccessExtensions.localVar(assignment, it);
        _builder.append(_localVar_1, "\t");
      }
    }
    _builder.append(", ");
    CharSequence _stringLiteral = this._grammarAccessExtensions.toStringLiteral(assignment.getTerminal());
    _builder.append(_stringLiteral, "\t");
    _builder.append(");");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    _xifexpression = _builder.toString();
  } else {
    _xifexpression = super._assignmentEbnf(it, assignment, options, supportActions);
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:55,代码来源:AntlrGrammarGenerator.java


注:本文中的org.eclipse.xtext.GrammarUtil.isBooleanAssignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。