Skip to content

Commit

Permalink
ignore preprocessor tokens from parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Tseng committed Jan 4, 2021
1 parent f25d810 commit 6544f04
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/org/p4/p4plugin/psi/P4ParserDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,19 @@ public IFileElementType getFileNodeType() {

@Override
public @NotNull TokenSet getCommentTokens() {
IElementType commentType = P4LangTokenType.getTokenElementType(P4Lexer.COMMENT);
IElementType lineCommentType = P4LangTokenType.getTokenElementType(P4Lexer.LINE_COMMENT);
IElementType preprocessorType = P4LangTokenType.getTokenElementType(P4Lexer.PREPROCESSSOR);
return TokenSet.create(commentType, lineCommentType, preprocessorType);
return TokenSet.create(P4LangTokenType.getTokenElementType(P4Lexer.COMMENT),
P4LangTokenType.getTokenElementType(P4Lexer.LINE_COMMENT),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_INCLUDE_LOCAL),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_INCLUDE_SYS),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_DEFINE),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_UNDEF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_IFDEF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_IFNDEF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_LINE),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_IF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_ELSEIF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_ENDIF),
P4LangTokenType.getTokenElementType(P4Lexer.PREPROC_ELSE));
}

@Override
Expand Down

0 comments on commit 6544f04

Please sign in to comment.