org.eclipse.xtext.Keyword类的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.eclipse.xtext.Keyword类的一些代码示例,展示了Keyword类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyword类的具体详情如下:
包路径:org.eclipse.xtext.Keyword
类名称:Keyword

Keyword介绍

[英]A representation of the model object 'Keyword'.

The following features are supported:

  • org.eclipse.xtext.Keyword#getValue
    [中]模型对象“关键字”的表示形式。
    支持以下功能:
    *组织。日食xtext。关键字#getValue

代码示例

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

@Override
  public String apply(Keyword from) {
    return from.getValue();
  }
});

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

/**
 * return true if the keyword is optional
 * 
 * @param keyword
 * @return
 */
public static boolean isKeywordOptional(Keyword keyword) {
  return GrammarUtil.isOptionalCardinality(keyword) || ((keyword.eContainer() instanceof AbstractElement)
      && GrammarUtil.isOptionalCardinality((AbstractElement) keyword.eContainer()));
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

@Override
public String caseKeyword(Keyword object) {
  result.append("'");
  String value = toLexerString(object.getValue());
  result.append(value).append("'");
  result.append(Strings.emptyIfNull(object.getCardinality()));
  return "";
}

代码示例来源:origin: stackoverflow.com

public class Keyword {
  private String value;
  private double points;

  ...
}

private Keyword[] keywords = new Keyword[] {
  new Keyword("BLUE", 1.6),
  new Keyword("BLACK", 10.1),
  ...
}

for (String subject : subjectArray) {
  for (Keyword keyword : keywords) {
    if (subject.toUpperCase().contains(keyword.getValue())) {
      System.out.println(keyword.getPoints() + " " + keyword.getValue());
      arrlist.add(keyword.getPoints());
    }
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

protected boolean _mustBeParenthesized(final Keyword it) {
 return ((this._grammarAccessExtensions.predicated(it) || it.isFirstSetPredicated()) || (it.getCardinality() != null));
}

代码示例来源:origin: org.eclipse.xtext/ui

protected boolean isExpectedGrammarElement(EObject object) {
  if (object == grammarElement)
    return true;
  if (grammarElement == null && expectedText != null) {
    if (object instanceof Keyword) {
      if (expectedText.equals(((Keyword) object).getValue()))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ide

protected boolean isExpectedGrammarElement(EObject object) {
  if (object == grammarElement)
    return true;
  if (grammarElement == null && expectedText != null) {
    if (object instanceof Keyword) {
      if (expectedText.equals(((Keyword) object).getValue()))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

@Override
  public boolean apply(AbstractElement input) {
    return input instanceof Keyword && ",".equals(((Keyword) input).getValue()); //$NON-NLS-1$
  }
};

代码示例来源:origin: org.eclipse/xtext

public boolean isValid(EObject context, Keyword keyword, Object value, IErrorAcceptor errorAcceptor) {
  if (value instanceof String)
    return keyword.getValue().equalsIgnoreCase((String)value);
  return false;
}

代码示例来源:origin: org.eclipse/xtext

@Override
protected boolean useKeyword(Keyword keyword, EObject context) {
  String value = keyword.getValue();
  return value.matches("\\w+");
}

代码示例来源:origin: org.eclipse.xtext.ui.codetemplates/ui

@Override
public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext,
    ICompletionProposalAcceptor acceptor) {
  if ((mode & NORMAL) != 0) {
    if ("$".equals(keyword.getValue()) || "${".equals(keyword.getValue()))
      return;
    super.completeKeyword(keyword, contentAssistContext, acceptor);
  }
}

代码示例来源:origin: org.eclipse/xtext

public String serializeAssignedKeyword(EObject context, Keyword keyword, Object value, INode node) {
  if (node != null && node.getGrammarElement() == keyword)
    return ITokenSerializer.KEEP_VALUE_FROM_NODE_MODEL;
  return keyword.getValue();
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public List<String> caseKeyword(Keyword object) {
  if (GrammarUtil.isMultipleCardinality(object)) {
    return Collections.emptyList();
  }
  if (GrammarUtil.isOptionalCardinality(object)) {
    return Lists.newArrayList("", object.getValue());
  }
  return Lists.newArrayList(object.getValue());
}
@Override

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xtext.generator

protected String _ebnf2(final Keyword it, final AntlrOptions options, final boolean supportActions) {
 String _xifexpression = null;
 boolean _isCombinedGrammar = this.isCombinedGrammar();
 if (_isCombinedGrammar) {
  String _antlrString = AntlrGrammarGenUtil.toAntlrString(it.getValue());
  String _plus = ("\'" + _antlrString);
  _xifexpression = (_plus + "\'");
 } else {
  _xifexpression = this.keywordHelper.getRuleName(it.getValue());
 }
 return _xifexpression;
}

代码示例来源:origin: org.eclipse/xtext

protected boolean isWildcardLiteral(EObject grammarElement) {
  if(grammarElement instanceof Keyword) {
    String keyword = ((Keyword) grammarElement).getValue();
    return getWildcardLiteral().equals(keyword) ||
      getFullWildcardLiteral().equals(keyword);
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/ui

public String getId(AbstractElement element) {
  if (!(element instanceof Keyword))
    throw new IllegalArgumentException("Unsupported context element: " + element);
  return GrammarUtil.getGrammar(element).getName()+".kw_"+((Keyword) element).getValue();
}

代码示例来源:origin: org.eclipse.xtext/ui

protected boolean isLikelyToBeValidProposal(INode lastCompleteNode, Iterable<ContentAssistContext> contexts) {
  for(ContentAssistContext context: contexts) {
    for (AbstractElement element: context.getFirstSetGrammarElements()) {
      if (element instanceof Keyword) {
        String keywordValue = ((Keyword) element).getValue();
        String lastText = ((ILeafNode) lastCompleteNode).getText();
        if (keywordValue.equals(lastText)) 
          return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ide

protected boolean isLikelyToBeValidProposal(INode lastCompleteNode, Iterable<ContentAssistContext> contexts) {
  for(ContentAssistContext context: contexts) {
    for (AbstractElement element: context.getFirstSetGrammarElements()) {
      if (element instanceof Keyword) {
        String keywordValue = ((Keyword) element).getValue();
        String lastText = ((ILeafNode) lastCompleteNode).getText();
        if (keywordValue.equals(lastText)) 
          return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse/xtext

public String serializeAssignedEnumLiteral(EObject context, RuleCall ruleCall, Object value, INode node) {
    Keyword nodeLit = getLiteral(node);
    Keyword modelLit = getLiteral(context, ruleCall, value);
    if (nodeLit != null && nodeLit.equals(modelLit))
      return ITokenSerializer.KEEP_VALUE_FROM_NODE_MODEL;
    return modelLit.getValue();
  }
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

/**
 * @param input
 * @param grammarAccess
 */
public RepreZenInternalDslParser(TokenStream input, XtextDslGrammarAccess grammarAccess) {
  super(input, grammarAccess);
  includedPropertiesKeywords = Sets.newHashSet( //
      grammarAccess.getIncludedPropertiesAccess().getPropertiesKeyword_2_1_2().getValue());
}

相关文章

Keyword类方法