public interface ParserDefinition
LanguageExtension.forLanguage(Language)
Modifier and Type | Interface and Description |
---|---|
static class |
ParserDefinition.SpaceRequirements
Requirements for spacing between tokens.
|
Modifier and Type | Method and Description |
---|---|
PsiElement |
createElement(ASTNode node)
Creates a PSI element for the specified AST node.
|
PsiFile |
createFile(FileViewProvider viewProvider)
Creates a PSI element for the specified virtual file.
|
Lexer |
createLexer(Project project)
Returns the lexer for lexing files in the specified project.
|
PsiParser |
createParser(Project project)
Returns the parser for parsing files in the specified project.
|
TokenSet |
getCommentTokens()
Returns the set of token types which are treated as comments by the PSI builder.
|
IFileElementType |
getFileNodeType()
Returns the element type of the node describing a file in the specified language.
|
TokenSet |
getStringLiteralElements()
Returns the set of element types which are treated as string literals.
|
default TokenSet |
getWhitespaceTokens()
Returns the set of token types which are treated as whitespace by the PSI builder.
|
default ParserDefinition.SpaceRequirements |
spaceExistanceTypeBetweenTokens(ASTNode left,
ASTNode right)
Deprecated.
Override
spaceExistenceTypeBetweenTokens(ASTNode, ASTNode) instead |
default ParserDefinition.SpaceRequirements |
spaceExistenceTypeBetweenTokens(ASTNode left,
ASTNode right)
Checks if the specified two token types need to be separated by a space according to the language grammar.
|
Lexer createLexer(Project project)
project
- the project to which the lexer is connected.PsiParser createParser(Project project)
project
- the project to which the parser is connected.IFileElementType getFileNodeType()
default TokenSet getWhitespaceTokens()
It is strongly advised you return TokenSet that only contains TokenType.WHITE_SPACE
,
which is suitable for all the languages unless you really need to use special whitespace token
TokenSet getCommentTokens()
JavaDocElementType.DOC_COMMENT
).TokenSet getStringLiteralElements()
PsiElement createElement(ASTNode node)
if (node.getElementType == MY_ELEMENT_TYPE) {
return new MyPsiElement(node);
}
node
- the node for which the PSI element should be returned.PsiFile createFile(FileViewProvider viewProvider)
viewProvider
- virtual file.default ParserDefinition.SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right)
left
- the first token to check.right
- the second token to check.@Deprecated default ParserDefinition.SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right)
spaceExistenceTypeBetweenTokens(ASTNode, ASTNode)
instead