Search in sources :

Example 11 with PerlFileImpl

use of com.perl5.lang.perl.psi.impl.PerlFileImpl in project Perl5-IDEA by Camelcade.

the class PerlElementFactory method createString.

public static PerlString createString(Project project, String code) {
    PerlFileImpl file = createFile(project, code + ";");
    PerlString string = PsiTreeUtil.findChildOfType(file, PerlString.class);
    assert string != null : "While creating bare string from: " + code;
    return string;
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl)

Example 12 with PerlFileImpl

use of com.perl5.lang.perl.psi.impl.PerlFileImpl in project Perl5-IDEA by Camelcade.

the class PerlElementFactory method createMethodCall.

public static PsiPerlDerefExpr createMethodCall(Project project, String packageName, String subName) {
    assert packageName != null;
    assert subName != null;
    PerlFileImpl file = createFile(project, String.format("%s->%s;", packageName, subName));
    PsiPerlDerefExpr def = PsiTreeUtil.findChildOfType(file, PsiPerlDerefExpr.class);
    assert def != null;
    return def;
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl)

Example 13 with PerlFileImpl

use of com.perl5.lang.perl.psi.impl.PerlFileImpl in project Perl5-IDEA by Camelcade.

the class PerlElementFactory method createDereference.

public static PsiElement createDereference(Project project) {
    PerlFileImpl file = createFile(project, "$a->{bla};");
    PerlVariable variable = PsiTreeUtil.findChildOfType(file, PerlVariable.class);
    assert variable != null : "While creating dereference";
    return variable.getNextSibling();
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl)

Example 14 with PerlFileImpl

use of com.perl5.lang.perl.psi.impl.PerlFileImpl in project Perl5-IDEA by Camelcade.

the class PerlElementFactory method createStringContent.

public static PerlStringContentElementImpl createStringContent(Project project, String name) {
    PerlFileImpl file = createFile(project, "'" + name + "';");
    PsiPerlStringSq string = PsiTreeUtil.findChildOfType(file, PsiPerlStringSq.class);
    assert string != null;
    return (PerlStringContentElementImpl) string.getFirstChild().getNextSibling();
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl) PerlStringContentElementImpl(com.perl5.lang.perl.psi.impl.PerlStringContentElementImpl)

Example 15 with PerlFileImpl

use of com.perl5.lang.perl.psi.impl.PerlFileImpl in project Perl5-IDEA by Camelcade.

the class PerlElementFactory method createParenthesisedExpression.

public static PsiPerlParenthesisedExpr createParenthesisedExpression(Project project) {
    PerlFileImpl file = createFile(project, "();");
    PsiPerlParenthesisedExpr result = PsiTreeUtil.findChildOfType(file, PsiPerlParenthesisedExpr.class);
    assert result != null : "While creating PsiPerlParenthesisedExpr";
    return result;
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl)

Aggregations

PerlFileImpl (com.perl5.lang.perl.psi.impl.PerlFileImpl)21 PsiElement (com.intellij.psi.PsiElement)8 PsiFile (com.intellij.psi.PsiFile)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 ArrayList (java.util.ArrayList)3 Project (com.intellij.openapi.project.Project)2 TextRange (com.intellij.openapi.util.TextRange)2 PerlNamespaceDefinitionElement (com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement)2 PerlVariableDeclarationElement (com.perl5.lang.perl.psi.PerlVariableDeclarationElement)2 PsiPerlStatement (com.perl5.lang.perl.psi.PsiPerlStatement)2 PsiPerlStatementImpl (com.perl5.lang.perl.psi.impl.PsiPerlStatementImpl)2 LocalQuickFixOnPsiElement (com.intellij.codeInspection.LocalQuickFixOnPsiElement)1 Document (com.intellij.openapi.editor.Document)1 PsiReference (com.intellij.psi.PsiReference)1 ResolveResult (com.intellij.psi.ResolveResult)1 ResolveState (com.intellij.psi.ResolveState)1 LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)1 IElementType (com.intellij.psi.tree.IElementType)1 XSourcePosition (com.intellij.xdebugger.XSourcePosition)1 PerlCastExpression (com.perl5.lang.perl.psi.PerlCastExpression)1