Package org.intellij.grammar.psi

Examples of org.intellij.grammar.psi.BnfChoice


  }
 
  @Nullable
  private Pair<PsiElement, PsiElement> getArguments(PsiFile file, int offset) {
    PsiElement element = file.getViewProvider().findElementAt(offset);
    final BnfChoice choice = PsiTreeUtil.getParentOfType(element, BnfChoice.class);
    if (choice == null) return null;
    for (PsiElement cur = choice.getFirstChild(), prev = null; cur != null; cur = cur.getNextSibling()) {
      if (!(cur instanceof BnfExpression) ) continue;
      int start = prev == null? choice.getTextRange().getStartOffset() : prev.getTextRange().getEndOffset();
      int end = cur.getTextRange().getStartOffset();
      if (start <= offset && offset <= end) return Pair.create(cur, prev);
      prev = cur;
    }
    return null;
View Full Code Here


    final THashSet<BnfExpression> set = new THashSet<BnfExpression>();
    file.accept(new PsiRecursiveElementWalkingVisitor() {
      @Override
      public void visitElement(PsiElement element) {
        if (element instanceof BnfChoice) {
          BnfChoice choice = (BnfChoice)element;
          checkChoice(choice, set);
          for (BnfExpression e : set) {
            BnfUnreachableChoiceBranchInspection.registerProblem(choice, e, "Duplicate choice branch", problemsHolder, new BnfRemoveExpressionFix());
          }
          set.clear();
View Full Code Here

TOP

Related Classes of org.intellij.grammar.psi.BnfChoice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.