use of com.intellij.lang.PsiParser in project Perl5-IDEA by Camelcade.
the class TemplateToolkitPerlCodeElementType method doParseContents.
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi) {
Project project = psi.getProject();
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new PerlMergingLexerAdapter(project), PerlLanguage.INSTANCE, chameleon.getText());
PsiParser parser = PerlParserImpl.INSTANCE;
return parser.parse(this, builder).getFirstChildNode();
}
use of com.intellij.lang.PsiParser 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);
}
Aggregations