-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't include declarations in usages (fixes #629).
Signed-off-by: Ilya Rodionov <[email protected]>
- Loading branch information
Showing
5 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
src/main/java/org/antlr/intellij/plugin/psi/LexerRuleRefNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
package org.antlr.intellij.plugin.psi; | ||
|
||
import com.intellij.psi.PsiReference; | ||
import com.intellij.psi.tree.IElementType; | ||
import com.intellij.psi.util.PsiTreeUtil; | ||
|
||
public class LexerRuleRefNode extends GrammarElementRefNode { | ||
public LexerRuleRefNode(IElementType type, CharSequence text) { | ||
super(type, text); | ||
} | ||
|
||
@Override | ||
public PsiReference getReference() { | ||
return new GrammarElementRef(this, getText()); | ||
protected boolean isDeclaration() { | ||
return getParent() instanceof LexerRuleSpecNode | ||
|| PsiTreeUtil.getParentOfType(this, TokensSpecNode.class) != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/org/antlr/intellij/plugin/psi/TokensSpecNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.antlr.intellij.plugin.psi; | ||
|
||
import com.intellij.extapi.psi.ASTWrapperPsiElement; | ||
import com.intellij.lang.ASTNode; | ||
import com.intellij.psi.PsiElement; | ||
import org.antlr.intellij.adaptor.parser.PsiElementFactory; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class TokensSpecNode extends ASTWrapperPsiElement { | ||
public TokensSpecNode(@NotNull ASTNode node) { | ||
super(node); | ||
} | ||
|
||
public static class Factory implements PsiElementFactory { | ||
public static TokensSpecNode.Factory INSTANCE = new TokensSpecNode.Factory(); | ||
|
||
@Override | ||
public PsiElement createElement(ASTNode node) { | ||
return new TokensSpecNode(node); | ||
} | ||
} | ||
} |