Package org.intellij.grammar.parser

Examples of org.intellij.grammar.parser.BnfLexer


                                    @NotNull final CompletionResultSet result) {
        final int offset = parameters.getOffset();
        PsiElement position = parameters.getPosition();
        PsiElement parent = PsiTreeUtil.getParentOfType(position, BnfExpression.class, BnfAttr.class, BnfRule.class, GeneratedParserUtilBase.DummyBlock.class);
        if (parent != null && !(parent instanceof BnfStringLiteralExpression && !(parent.getParent() instanceof BnfAttr))) {
          final BnfLexer lexer = new BnfLexer();
          PsiReference referenceAt = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
          final Set<String> existing;
          if (referenceAt instanceof BnfReferenceImpl) {
            existing = new THashSet<String>();
            for (Object o : referenceAt.getVariants()) {
              existing.add(((LookupElement)o).getLookupString());
            }
          }
          else existing = null;
          parameters.getOriginalFile().acceptChildren(new PsiRecursiveElementWalkingVisitor() {
            @Override
            public void visitElement(PsiElement element) {
              if (element instanceof BnfReferenceOrToken || element instanceof BnfStringLiteralExpression) {
                PsiReference reference = element.getTextRange().containsOffset(offset) ? null : element.getReference();
                if (reference != null) {
                  String text = StringUtil.unquoteString(element.getText());
                  if (existing != null && existing.contains(text)) return;
                  lexer.start(text);
                  if (lexer.getTokenType() == BnfTypes.BNF_ID && lexer.getTokenEnd() == text.length()) {
                    result.addElement(LookupElementBuilder.create(text));
                  }
                }
              }
              else {
View Full Code Here


  public static final TokenSet LITERALS = TokenSet.create(BnfTypes.BNF_STRING);

  @NotNull
  @Override
  public Lexer createLexer(Project project) {
    return new BnfLexer();
  }
View Full Code Here

    "BNF_PIN", new TextAttributes(null, null, DefaultLanguageHighlighterColors.LINE_COMMENT.getDefaultAttributes().getForegroundColor(), EffectType.BOLD_DOTTED_LINE, 0));

  @NotNull
  @Override
  public Lexer getHighlightingLexer() {
    return new BnfLexer();
  }
View Full Code Here

TOP

Related Classes of org.intellij.grammar.parser.BnfLexer

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.