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


Java GrammarUtil.isDatatypeRuleCall方法代码示例

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


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

示例1: getNodeSequence

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private List<String> getNodeSequence(EObject model) {
	List<String> result = Lists.newArrayList();
	GrammarElementTitleSwitch titleSwitch = new GrammarElementTitleSwitch().showAssignments();
	org.eclipse.xtext.serializer.sequencer.EmitterNodeIterator ni = 
			new org.eclipse.xtext.serializer.sequencer.EmitterNodeIterator(NodeModelUtils.findActualNodeFor(model));
	while (ni.hasNext()) {
		INode next = ni.next();
		EObject ele = next.getGrammarElement() instanceof CrossReference ? ((CrossReference) next
				.getGrammarElement()).getTerminal() : next.getGrammarElement();
		if (next instanceof ILeafNode || GrammarUtil.isDatatypeRuleCall(ele))
			result.add(titleSwitch.doSwitch(ele) + " -> " + next.getText().trim());
		else if (next instanceof ICompositeNode)
			result.add(titleSwitch.doSwitch(ele));
	}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:SyntacticSequencerTest.java

示例2: include

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected boolean include(INode node) {
	if (node instanceof ILeafNode) {
		ILeafNode leaf = (ILeafNode) node;
		if (!allowHidden && leaf.isHidden())
			return false;
		return true;
	} else if (node instanceof ICompositeNode) {
		return GrammarUtil.isDatatypeRuleCall(node.getGrammarElement())
				|| node.getGrammarElement() instanceof CrossReference;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:EmitterNodeIterator.java

示例3: isEmitter

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
private static boolean isEmitter(INode node, EObject grammarElement) {
	if (node instanceof ILeafNode) {
		ILeafNode leaf = (ILeafNode) node;
		if (leaf.isHidden())
			return false;
		return true;
	} else if (node instanceof ICompositeNode) {
		return GrammarUtil.isDatatypeRuleCall(grammarElement) || grammarElement instanceof CrossReference;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:12,代码来源:EmitterNodeUtil.java

示例4: include

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
protected boolean include(INode node) {
	if (node instanceof ILeafNode) {
		return true;
	} else if (node instanceof ICompositeNode) {
		EObject element = node.getGrammarElement();
		return GrammarUtil.isDatatypeRuleCall(element) || element instanceof CrossReference
				|| GrammarUtil.isEnumRuleCall(element);
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:NodeModelBasedRegionAccessBuilder.java

示例5: apply

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Override
public boolean apply(ISynState input) {
	AbstractElement ge = input.getGrammarElement();
	return ge instanceof Keyword || GrammarUtil.isDatatypeRuleCall(ge) || GrammarUtil.isEnumRuleCall(ge)
			|| GrammarUtil.isTerminalRuleCall(ge);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:7,代码来源:SyntacticSequencerPDAProvider.java

示例6: getHiddenTokensBetween

import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
/**
 * Collects all the hidden tokens between two given nodes of the node model.
 *
 * @param from
 *          node that serves as a start point, must not be {@code null}
 * @param to
 *          search end point, must not be {@code null}
 * @param deletedSemanticElements
 *          set of the deleted semantic elements, must not be {@code null}
 * @return list of hidden tokens, never {@code null}, but can be empty
 */
private List<INode> getHiddenTokensBetween(final INode from, final INode to, final Set<EObject> deletedSemanticElements) {
  EObject fromElement = NodeModelUtils.findActualSemanticObjectFor(from);
  if (from.equals(NodeModelUtils.getNode(fromElement))) {
    // If the starting node represents some container, emit the comments that belong to it
    // This is needed to correctly handle some edge cases like ImportList in AvqScript
    // Logic for distinguishing between container's comments and the ones of first element is expected to be implemented in 'isLeadingCommentFor'
    emitContainerComments(from);
  }
  List<INode> result = Lists.newArrayList();
  boolean handleReordering = from.getTotalOffset() > to.getTotalOffset();
  if (!handleReordering) {
    // Elements are not reordered
    // Just going through the interval and collecting comments, unless they have already been emitted
    NodeIterator nodes = new NodeIterator(from);
    while (nodes.hasNext()) {
      INode next = nodes.next();
      if (tokenUtil.isWhitespaceOrCommentNode(next)) {
        if (!emittedComments.contains(next)) {
          result.add(next);
        }
      } else if (next.equals(to)) {
        // We have hit the 'to' node
        // If it is a composite one, we have to iterate through its children
        // and collect whitespaces/comments until we encounter first token (keyword, identifier...)
        if (next instanceof ICompositeNode && (GrammarUtil.isDatatypeRuleCall(next.getGrammarElement())
            || GrammarUtil.isEnumRuleCall(next.getGrammarElement()) || next.getGrammarElement() instanceof CrossReference)) {
          while (nodes.hasNext()) {
            INode lastNodeChild = nodes.next();
            if (tokenUtil.isWhitespaceOrCommentNode(lastNodeChild)) {
              if (!emittedComments.contains(lastNodeChild)) {
                result.add(lastNodeChild);
              }
            } else if (lastNodeChild instanceof ILeafNode) {
              break;
            }
          }
          break;
        } else {
          // 'to' node is not a composite one, nothing to do here, just exit the loop
          break;
        }
      } else if (belongsToDeletedElement(next)) {
        handleDeletedElement(result, deletedSemanticElements, next);
        nodes.prune();
      } else if (tokenUtil.isToken(next)) {
        // We have encountered some token, but not the one we expected
        // Will be handled by invoking 'getLeadingCommentsIncludingWhitespace' method later
        handleReordering = true;
        break;
      }
    }
  }
  if (handleReordering) {
    return getLeadingCommentsIncludingWhitespace(to);
  }
  return result;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:69,代码来源:ReorderingHiddenTokenSequencer.java


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