Search in sources :

Example 1 with PerlMergingLexerAdapter

use of com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter in project Perl5-IDEA by Camelcade.

the class PerlLexerPerformanceTest method testLexing.

private long testLexing(String testData) {
    PerlMergingLexerAdapter perlLexer = new PerlMergingLexerAdapter(getProject(), false, true);
    perlLexer.start(testData, 0, testData.length(), 0);
    long start = System.currentTimeMillis();
    int tokens = 0;
    while (perlLexer.getTokenType() != null) {
        perlLexer.advance();
        tokens++;
    }
    return System.currentTimeMillis() - start;
}
Also used : PerlMergingLexerAdapter(com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter)

Example 2 with PerlMergingLexerAdapter

use of com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter 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();
}
Also used : Project(com.intellij.openapi.project.Project) PerlMergingLexerAdapter(com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter) PsiBuilder(com.intellij.lang.PsiBuilder) PsiParser(com.intellij.lang.PsiParser)

Aggregations

PerlMergingLexerAdapter (com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter)2 PsiBuilder (com.intellij.lang.PsiBuilder)1 PsiParser (com.intellij.lang.PsiParser)1 Project (com.intellij.openapi.project.Project)1