public class PlainTextParserDefinition extends java.lang.Object implements ParserDefinition
ParserDefinition.SpaceRequirements
Constructor and Description |
---|
PlainTextParserDefinition() |
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.
|
TokenSet |
getWhitespaceTokens()
Returns the set of token types which are treated as whitespace by the PSI builder.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
spaceExistanceTypeBetweenTokens
public Lexer createLexer(Project project)
ParserDefinition
createLexer
in interface ParserDefinition
project
- the project to which the lexer is connected.public PsiParser createParser(Project project)
ParserDefinition
createParser
in interface ParserDefinition
project
- the project to which the parser is connected.public IFileElementType getFileNodeType()
ParserDefinition
getFileNodeType
in interface ParserDefinition
public TokenSet getWhitespaceTokens()
ParserDefinition
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
getWhitespaceTokens
in interface ParserDefinition
public TokenSet getCommentTokens()
ParserDefinition
JavaDocElementType.DOC_COMMENT
).getCommentTokens
in interface ParserDefinition
public TokenSet getStringLiteralElements()
ParserDefinition
getStringLiteralElements
in interface ParserDefinition
public PsiElement createElement(ASTNode node)
ParserDefinition
if (node.getElementType == MY_ELEMENT_TYPE) {
return new MyPsiElement(node);
}
createElement
in interface ParserDefinition
node
- the node for which the PSI element should be returned.public PsiFile createFile(FileViewProvider viewProvider)
ParserDefinition
createFile
in interface ParserDefinition
viewProvider
- virtual file.public ParserDefinition.SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right)
ParserDefinition
spaceExistenceTypeBetweenTokens
in interface ParserDefinition
left
- the first token to check.right
- the second token to check.