Search in sources :

Example 1 with CharTableImpl

use of com.intellij.psi.impl.source.CharTableImpl in project intellij by bazelbuild.

the class BuildParserTest method createAST.

private ASTNode createAST(String text) {
    ParserDefinition definition = new BuildParserDefinition();
    PsiParser parser = definition.createParser(getProject());
    Lexer lexer = definition.createLexer(getProject());
    PsiBuilderImpl psiBuilder = new PsiBuilderImpl(getProject(), null, definition, lexer, new CharTableImpl(), text, null, null);
    PsiBuilderAdapter adapter = new PsiBuilderAdapter(psiBuilder) {

        @Override
        public void error(String messageText) {
            super.error(messageText);
            errors.add(messageText);
        }
    };
    return parser.parse(definition.getFileNodeType(), adapter);
}
Also used : CharTableImpl(com.intellij.psi.impl.source.CharTableImpl) Lexer(com.intellij.lexer.Lexer) ParserDefinition(com.intellij.lang.ParserDefinition) PsiBuilderAdapter(com.intellij.lang.impl.PsiBuilderAdapter) PsiBuilderImpl(com.intellij.lang.impl.PsiBuilderImpl) PsiParser(com.intellij.lang.PsiParser)

Aggregations

ParserDefinition (com.intellij.lang.ParserDefinition)1 PsiParser (com.intellij.lang.PsiParser)1 PsiBuilderAdapter (com.intellij.lang.impl.PsiBuilderAdapter)1 PsiBuilderImpl (com.intellij.lang.impl.PsiBuilderImpl)1 Lexer (com.intellij.lexer.Lexer)1 CharTableImpl (com.intellij.psi.impl.source.CharTableImpl)1