summaryrefslogtreecommitdiff
path: root/python/psi-api/src/com/jetbrains/python
diff options
context:
space:
mode:
Diffstat (limited to 'python/psi-api/src/com/jetbrains/python')
-rw-r--r--python/psi-api/src/com/jetbrains/python/psi/PyElementGenerator.java31
-rw-r--r--python/psi-api/src/com/jetbrains/python/psi/PyElsePart.java7
-rw-r--r--python/psi-api/src/com/jetbrains/python/psi/PyStatementPart.java6
-rw-r--r--python/psi-api/src/com/jetbrains/python/psi/PyWithStatement.java2
-rw-r--r--python/psi-api/src/com/jetbrains/python/psi/StructuredDocString.java9
5 files changed, 35 insertions, 20 deletions
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyElementGenerator.java b/python/psi-api/src/com/jetbrains/python/psi/PyElementGenerator.java
index 9f6e7c9ff021..daa8b3063014 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyElementGenerator.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyElementGenerator.java
@@ -37,15 +37,17 @@ public abstract class PyElementGenerator {
public abstract PyStringLiteralExpression createStringLiteralAlreadyEscaped(String str);
-
-
/**
* Creates a string literal, adding appropriate quotes, properly escaping characters inside.
+ *
* @param destination where the literal is destined to; used to determine the encoding.
* @param unescaped the string
- * @return a newly created literal
+ * @param preferUTF8 try to use UTF8 (would use ascii if false)
+ * @return a newly created literal
*/
- public abstract PyStringLiteralExpression createStringLiteralFromString(@Nullable PsiFile destination, String unescaped);
+ public abstract PyStringLiteralExpression createStringLiteralFromString(@Nullable PsiFile destination, String unescaped,
+ boolean preferUTF8);
+
public abstract PyStringLiteralExpression createStringLiteralFromString(@NotNull String unescaped);
public abstract PyStringLiteralExpression createStringLiteral(@NotNull PyStringLiteralExpression oldElement, @NotNull String unescaped);
@@ -59,11 +61,11 @@ public abstract class PyElementGenerator {
public abstract PyBinaryExpression createBinaryExpression(String s, PyExpression expr, PyExpression listLiteral);
/**
- * @deprecated use the overload with language level specified
* @param text the text to create an expression from
* @return the expression
+ * @deprecated use the overload with language level specified
*/
- public abstract PyExpression createExpressionFromText(String text);
+ public abstract PyExpression createExpressionFromText(String text);
public abstract PyExpression createExpressionFromText(final LanguageLevel languageLevel, String text);
@@ -71,9 +73,9 @@ public abstract class PyElementGenerator {
* Adds elements to list inserting required commas.
* Method is like {@link #insertItemIntoList(PyElement, PyExpression, PyExpression)} but does not add unneeded commas.
*
- * @param list where to add
+ * @param list where to add
* @param afterThis after which element it should be added (null for add to the head)
- * @param toInsert what to insert
+ * @param toInsert what to insert
* @return newly inserted element
*/
@NotNull
@@ -92,7 +94,10 @@ public abstract class PyElementGenerator {
public abstract PyImportElement createImportElement(final LanguageLevel languageLevel, String name);
- public abstract PyFunction createProperty(final LanguageLevel languageLevel, String propertyName, String fieldName, AccessDirection accessDirection);
+ public abstract PyFunction createProperty(final LanguageLevel languageLevel,
+ String propertyName,
+ String fieldName,
+ AccessDirection accessDirection);
@NotNull
public abstract <T> T createFromText(LanguageLevel langLevel, Class<T> aClass, final String text);
@@ -103,6 +108,7 @@ public abstract class PyElementGenerator {
/**
* Creates an arbitrary PSI element from text, by creating a bigger construction and then cutting the proper subelement.
* Will produce all kinds of exceptions if the path or class would not match the PSI tree.
+ *
* @param langLevel the language level to use for parsing the text
* @param aClass class of the PSI element; may be an interface not descending from PsiElement, as long as target node can be cast to it
* @param text text to parse
@@ -122,8 +128,15 @@ public abstract class PyElementGenerator {
public abstract PsiFile createDummyFile(LanguageLevel langLevel, String contents);
public abstract PyExpressionStatement createDocstring(String content);
+
public abstract PyPassStatement createPassStatement();
@NotNull
public abstract PyDecoratorList createDecoratorList(@NotNull final String... decoratorTexts);
+
+ /**
+ * Creates new line whitespace
+ */
+ @NotNull
+ public abstract PsiElement createNewLine();
}
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyElsePart.java b/python/psi-api/src/com/jetbrains/python/psi/PyElsePart.java
index c32916242154..41b715f99aa8 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyElsePart.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyElsePart.java
@@ -15,17 +15,10 @@
*/
package com.jetbrains.python.psi;
-import org.jetbrains.annotations.Nullable;
-
/**
* The 'else:' part of various compound statements.
* User: dcheryasov
* Date: Mar 15, 2009 9:34:51 PM
*/
public interface PyElsePart extends PyStatementPart {
- /**
- * @return the body of the 'else' part.
- */
- @Nullable
- PyStatementList getStatementList();
}
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyStatementPart.java b/python/psi-api/src/com/jetbrains/python/psi/PyStatementPart.java
index f491a6a83688..a14a91ef9f9c 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyStatementPart.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyStatementPart.java
@@ -15,19 +15,19 @@
*/
package com.jetbrains.python.psi;
-import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.NotNull;
/**
* Abstract part of a multipart statement.
* User: dcheryasov
* Date: Mar 16, 2009 4:34:59 AM
*/
-public interface PyStatementPart extends PyElement {
+public interface PyStatementPart extends PyElement, PyStatementListContainer {
PyStatementPart[] EMPTY_ARRAY = new PyStatementPart[0];
/**
* @return the body of the part.
*/
- @Nullable
+ @NotNull
PyStatementList getStatementList();
}
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyWithStatement.java b/python/psi-api/src/com/jetbrains/python/psi/PyWithStatement.java
index 201ae3046785..b23ca63b6c95 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyWithStatement.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyWithStatement.java
@@ -18,6 +18,6 @@ package com.jetbrains.python.psi;
/**
* @author yole
*/
-public interface PyWithStatement extends PyStatement, NameDefiner {
+public interface PyWithStatement extends PyStatement, NameDefiner, PyStatementListContainer {
PyWithItem[] getWithItems();
}
diff --git a/python/psi-api/src/com/jetbrains/python/psi/StructuredDocString.java b/python/psi-api/src/com/jetbrains/python/psi/StructuredDocString.java
index fa8881062ac3..808ec477e89a 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/StructuredDocString.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/StructuredDocString.java
@@ -25,6 +25,15 @@ import java.util.List;
* @author vlan
*/
public interface StructuredDocString {
+ /**
+ * Creates parameter type documentation specific for certain doct type
+ * @param name param name
+ * @param type param type
+ * @return text to add to docsting
+ */
+ @NotNull
+ String createParameterType(@NotNull String name, @NotNull String type);
+
String getDescription();
String getSummary();