public class TemplateDataElementType extends IFileElementType implements ITemplateDataElementType
Modifier and Type | Class and Description |
---|---|
protected static class |
TemplateDataElementType.RangeCollector
This collector is used for storing ranges of outer elements and ranges of artificial elements, that should be stripped from the resulting tree
At the time of creating source code for the data language we need to memorize positions with template language elements.
|
protected static class |
TemplateDataElementType.TemplateFileType |
IElementType.Predicate
Modifier and Type | Field and Description |
---|---|
static LanguageExtension<TreePatcher> |
TREE_PATCHER |
LANGUAGE_KEY
ARRAY_FACTORY, EMPTY_ARRAY, FIRST_TOKEN_INDEX, TRUE
Constructor and Description |
---|
TemplateDataElementType(java.lang.String debugName,
Language language,
IElementType templateElementType,
IElementType outerElementType) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendCurrentTemplateToken(java.lang.StringBuilder result,
java.lang.CharSequence buf,
Lexer lexer,
TemplateDataElementType.RangeCollector collector) |
protected Lexer |
createBaseLexer(TemplateLanguageFileViewProvider viewProvider) |
protected OuterLanguageElementImpl |
createOuterLanguageElement(java.lang.CharSequence internedTokenText,
IElementType outerElementType) |
protected PsiFile |
createPsiFileFromSource(Language language,
java.lang.CharSequence sourceCode,
PsiManager manager) |
protected LanguageFileType |
createTemplateFakeFileType(Language language) |
protected PsiFile |
createTemplateFile(PsiFile psiFile,
Language templateLanguage,
java.lang.CharSequence sourceCode,
TemplateLanguageFileViewProvider viewProvider,
TemplateDataElementType.RangeCollector rangeCollector)
Creates psi tree without template tokens.
|
protected java.lang.CharSequence |
createTemplateText(java.lang.CharSequence sourceCode,
Lexer baseLexer,
TemplateDataElementType.RangeCollector rangeCollector)
Creates source code without template tokens.
|
protected Language |
getTemplateFileLanguage(TemplateLanguageFileViewProvider viewProvider) |
ASTNode |
parseContents(ASTNode chameleon)
Parses the contents of the specified chameleon node and returns the AST tree
representing the parsed contents.
|
protected void |
prepareParsedTemplateFile(FileElement root) |
createNode, doParseContents, getLanguageForParser, parseLight, reuseCollapsedTokens
enumerate, find, getIndex, getLanguage, hashCode, isLeftBound, toString, unregisterElementTypes, unregisterElementTypes
public static final LanguageExtension<TreePatcher> TREE_PATCHER
public TemplateDataElementType(java.lang.String debugName, Language language, IElementType templateElementType, IElementType outerElementType)
protected Lexer createBaseLexer(TemplateLanguageFileViewProvider viewProvider)
protected LanguageFileType createTemplateFakeFileType(Language language)
public ASTNode parseContents(ASTNode chameleon)
ILazyParseableElementType
parseContents
in interface ILazyParseableElementTypeBase
parseContents
in class IFileElementType
chameleon
- the node to parse.protected void prepareParsedTemplateFile(FileElement root)
protected Language getTemplateFileLanguage(TemplateLanguageFileViewProvider viewProvider)
protected PsiFile createTemplateFile(PsiFile psiFile, Language templateLanguage, java.lang.CharSequence sourceCode, TemplateLanguageFileViewProvider viewProvider, TemplateDataElementType.RangeCollector rangeCollector)
psiFile
- chameleon's psi filetemplateLanguage
- template language to parsesourceCode
- source code: base language with template languagerangeCollector
- collector for ranges with non-template/additional elementsprotected java.lang.CharSequence createTemplateText(java.lang.CharSequence sourceCode, Lexer baseLexer, TemplateDataElementType.RangeCollector rangeCollector)
TemplateDataElementType.RangeCollector.addRangeToRemove(TextRange)
for later removal from the resulting treesourceCode
- source code with base and template languagesbaseLexer
- base language lexerrangeCollector
- collector for ranges with non-template/additional symbolsprotected void appendCurrentTemplateToken(java.lang.StringBuilder result, java.lang.CharSequence buf, Lexer lexer, TemplateDataElementType.RangeCollector collector)
protected OuterLanguageElementImpl createOuterLanguageElement(java.lang.CharSequence internedTokenText, IElementType outerElementType)
protected PsiFile createPsiFileFromSource(Language language, java.lang.CharSequence sourceCode, PsiManager manager)