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


Java RuleCall.getRule方法代码示例

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


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

示例1: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getNOT_WORD_BOUNDARYRule())
		return getNOT_WORD_BOUNDARYToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getWORD_BOUNDARYRule())
		return getWORD_BOUNDARYToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:RegularExpressionSyntacticSequencer.java

示例2: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getNO_LINE_TERMINATORRule())
		return getNO_LINE_TERMINATORToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getSemiRule())
		return getSemiToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getTemplateExpressionEndRule())
		return getTemplateExpressionEndToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:N4JSSyntacticSequencer.java

示例3: installProxies

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
/**
 * Installs proxies for all non containment references and only if the node representing the EObject that contains
 * the cross reference has got leaf nodes (as a leaf node represents the cross reference).
 *
 * @param resource
 *            the N4JSResource
 * @param obj
 *            the EObject containing the cross reference
 * @param producer
 *            the error/warning producer
 * @param parentNode
 *            the node representing obj inside the node model
 */
private void installProxies(N4JSResource resource, EObject obj, IDiagnosticProducer producer,
		ICompositeNode parentNode, boolean dontCheckParent) {
	final EClass eClass = obj.eClass();
	if (eClass.getEAllReferences().size() - eClass.getEAllContainments().size() == 0)
		return;

	for (INode node = parentNode.getFirstChild(); node != null; node = node.getNextSibling()) {
		EObject grammarElement = node.getGrammarElement();
		if (grammarElement instanceof CrossReference && hasLeafNodes(node)) {
			producer.setNode(node);
			CrossReference crossReference = (CrossReference) grammarElement;
			final EReference eRef = GrammarUtil.getReference(crossReference, eClass);
			if (eRef == null) {
				ParserRule parserRule = GrammarUtil.containingParserRule(crossReference);
				final String feature = GrammarUtil.containingAssignment(crossReference).getFeature();
				throw new IllegalStateException("Couldn't find EReference for crossreference '" + eClass.getName()
						+ "::" + feature + "' in parser rule '" + parserRule.getName() + "'.");
			}
			createAndSetProxy(resource, obj, node, eRef, crossReference, producer);
			afterCreateAndSetProxy(obj, node, eRef, crossReference, producer);
		} else if (grammarElement instanceof RuleCall && node instanceof ICompositeNode) {
			RuleCall ruleCall = (RuleCall) grammarElement;
			AbstractRule calledRule = ruleCall.getRule();
			if (calledRule instanceof ParserRule && ((ParserRule) calledRule).isFragment()) {
				installProxies(resource, obj, producer, (ICompositeNode) node, true);
			}
		}
	}
	if (!dontCheckParent && shouldCheckParentNode(parentNode)) {
		installProxies(resource, obj, producer, parentNode.getParent(), dontCheckParent);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:46,代码来源:N4JSLinker.java

示例4: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getArrayBracketsRule())
		return getArrayBracketsToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getCommentRule())
		return getCommentToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getNEWLINERule())
		return getNEWLINEToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getOpSingleAssignRule())
		return getOpSingleAssignToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getWSRule())
		return getWSToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:DSLPoliciesSyntacticSequencer.java

示例5: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getBLOCK_BEGINRule())
		return getBLOCK_BEGINToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getBLOCK_ENDRule())
		return getBLOCK_ENDToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getBRACKET_CLOSERule())
		return getBRACKET_CLOSEToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getBRACKET_OPENRule())
		return getBRACKET_OPENToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getEQRule())
		return getEQToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:15,代码来源:LcDslSyntacticSequencer.java

示例6: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if(ruleCall.getRule() == grammarAccess.getASRule())
		return getASToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getDEFRule())
		return getDEFToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getEXPORTRule())
		return getEXPORTToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getGENERATERule())
		return getGENERATEToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getIMPORTRule())
		return getIMPORTToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getINCLUDERule())
		return getINCLUDEToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getKRONUS_ASSIGNRule())
		return getKRONUS_ASSIGNToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getPACKAGERule())
		return getPACKAGEToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getRETURNRule())
		return getRETURNToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getTYPERule())
		return getTYPEToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getVALRule())
		return getVALToken(semanticObject, ruleCall, node);
	else if(ruleCall.getRule() == grammarAccess.getWITHRule())
		return getWITHToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:Morgan-Stanley,项目名称:Saturn,代码行数:29,代码来源:KronusSyntacticSequencer.java

示例7: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getSEPARATORRule())
		return getSEPARATORToken(semanticObject, ruleCall, node);
	else if (ruleCall.getRule() == grammarAccess.getSPACERule())
		return getSPACEToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:9,代码来源:DslSyntacticSequencer.java

示例8: getRequiredRuleNames

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public String[][] getRequiredRuleNames(Param param) {
	if (isFiltered(param)) {
		return EMPTY_ARRAY;
	}
	AbstractElement elementToParse = param.elementToParse;
	String ruleName = param.ruleName;
	if (ruleName == null) {
		if (elementToParse instanceof RuleCall) {
			RuleCall call = (RuleCall) elementToParse;
			if (call.getRule() instanceof ParserRule) {
				String antlrRuleName = getRuleNames().getAntlrRuleName(call.getRule());
				if (!call.getArguments().isEmpty()) {
					Set<Parameter> context = param.getAssignedParametes();
					Set<Parameter> arguments = getAssignedArguments(call, context);
					int config = getParameterConfig(arguments);
					antlrRuleName = getRuleNames().getAntlrRuleName(call.getRule(), config);
				}
				return new String[][] { { antlrRuleName } };
			}
		}
		return EMPTY_ARRAY;
	}
	String adjustedRuleName = adjustRuleName(ruleName, param);
	if (!(GrammarUtil.isOptionalCardinality(elementToParse)
			|| GrammarUtil.isOneOrMoreCardinality(elementToParse))) {
		return new String[][] { { adjustedRuleName } };
	}
	if ((elementToParse.eContainer() instanceof Group)) {
		List<AbstractElement> tokens = getFilteredElements(((Group) elementToParse.eContainer()).getElements(),
				param);
		int idx = tokens.indexOf(elementToParse) + 1;
		if (idx != tokens.size()) {
			String secondRule = param.getBaseRuleName((AbstractElement) elementToParse.eContainer());
			secondRule = secondRule.substring(0, secondRule.lastIndexOf('_') + 1) + idx;
			String adjustedSecondRule = adjustRuleName(secondRule, param);
			if (GrammarUtil.isMultipleCardinality(elementToParse))
				return new String[][] { { adjustedRuleName }, { adjustedRuleName, adjustedSecondRule } };
			return new String[][] { { adjustedRuleName, adjustedSecondRule } };
		}
	}
	// Fix is here. Original method returns the original ruleName instead of the adjusted rule name.
	return new String[][] { { adjustedRuleName } };
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:46,代码来源:PatchedRequiredRuleNameComputer.java

示例9: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getNavigationOperatorRule())
		return getNavigationOperatorToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:7,代码来源:AbstractGExpressionsSyntacticSequencer.java

示例10: getUnassignedRuleCallToken

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
	if (ruleCall.getRule() == grammarAccess.getIDRule())
		return getIDToken(semanticObject, ruleCall, node);
	return "";
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:7,代码来源:OCCISyntacticSequencer.java

示例11: setRule

import org.eclipse.xtext.RuleCall; //导入方法依赖的package包/类
/**
 * The method being overridden expects a rule of a certain form (body does not contain an alternative of keywords
 * and a single rule) but the rules arriving here don't have this format.
 * <p>
 * Therefore pass to that method the first one of the two nested rules Some-Identifier that are expected in any of
 * the rules arriving here.
 *
 * For more details see grammar rules
 * <ul>
 * <li><code>N4JSPropertyComputedName</code></li>
 * <li><code>JsPropertyComputedName</code></li>
 * <li><code>TypesComputedPropertyName</code></li>
 * </ul>
 */
@Override
public void setRule(AbstractRule rule) {
	// TODO make this safer / throw exceptions more informative exceptions
	// rule: '[' (SymbolLiteralComputedName | StringLiteralComputedName) ']'
	Group g = (Group) rule.getAlternatives();
	Alternatives elem = (Alternatives) g.getElements().get(1);
	// SymbolLiteralComputedName: N4JSIdentifier '.' N4JSIdentifier
	AbstractRule symLitCompName = ((RuleCall) elem.getElements().get(0)).getRule();
	Group g2 = (Group) symLitCompName.getAlternatives();
	RuleCall identCall = (RuleCall) g2.getElements().get(0);
	AbstractRule ident = identCall.getRule();
	super.setRule(ident);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:ComputedPropertyNameValueConverter.java


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