some expression nodes
This commit is contained in:
@@ -60,16 +60,19 @@ public interface JetNodeTypes {
|
|||||||
JetNodeType BLOCK = new JetNodeType("BLOCK");
|
JetNodeType BLOCK = new JetNodeType("BLOCK");
|
||||||
JetNodeType TYPE_CONSTRAINT_LIST = new JetNodeType("TYPE_CONSTRAINT_LIST");
|
JetNodeType TYPE_CONSTRAINT_LIST = new JetNodeType("TYPE_CONSTRAINT_LIST");
|
||||||
JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT");
|
JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT");
|
||||||
JetNodeType NULL = new JetNodeType("NULL");
|
|
||||||
JetNodeType BOOLEAN_CONSTANT = new JetNodeType("BOOLEAN_CONSTANT");
|
// TODO: Not sure if we need separate NT for each kind of constants
|
||||||
JetNodeType FLOAT_CONSTANT = new JetNodeType("FLOAT_CONSTANT");
|
JetNodeType NULL = new JetNodeType("NULL", JetConstantExpression.class);
|
||||||
JetNodeType CHARACTER_CONSTANT = new JetNodeType("CHARACTER_CONSTANT");
|
JetNodeType BOOLEAN_CONSTANT = new JetNodeType("BOOLEAN_CONSTANT", JetConstantExpression.class);
|
||||||
JetNodeType STRING_CONSTANT = new JetNodeType("STRING_CONSTANT");
|
JetNodeType FLOAT_CONSTANT = new JetNodeType("FLOAT_CONSTANT", JetConstantExpression.class);
|
||||||
JetNodeType INTEGER_CONSTANT = new JetNodeType("INTEGER_CONSTANT");
|
JetNodeType CHARACTER_CONSTANT = new JetNodeType("CHARACTER_CONSTANT", JetConstantExpression.class);
|
||||||
JetNodeType SUPERTYE_QUALIFIER = new JetNodeType("SUPERTYE_QUALIFIER");
|
JetNodeType STRING_CONSTANT = new JetNodeType("STRING_CONSTANT", JetConstantExpression.class);
|
||||||
JetNodeType LONG_CONSTANT = new JetNodeType("LONG_CONSTANT");
|
JetNodeType INTEGER_CONSTANT = new JetNodeType("INTEGER_CONSTANT", JetConstantExpression.class);
|
||||||
JetNodeType TUPLE = new JetNodeType("TUPLE");
|
JetNodeType SUPERTYE_QUALIFIER = new JetNodeType("SUPERTYE_QUALIFIER", JetConstantExpression.class);
|
||||||
JetNodeType TYPEOF = new JetNodeType("TYPEOF");
|
JetNodeType LONG_CONSTANT = new JetNodeType("LONG_CONSTANT", JetConstantExpression.class);
|
||||||
|
|
||||||
|
JetNodeType TUPLE = new JetNodeType("TUPLE", JetTupleExpression.class);
|
||||||
|
JetNodeType TYPEOF = new JetNodeType("TYPEOF", JetTypeofExpression.class);
|
||||||
JetNodeType NEW = new JetNodeType("NEW");
|
JetNodeType NEW = new JetNodeType("NEW");
|
||||||
JetNodeType RETURN = new JetNodeType("RETURN");
|
JetNodeType RETURN = new JetNodeType("RETURN");
|
||||||
JetNodeType THROW = new JetNodeType("THROW");
|
JetNodeType THROW = new JetNodeType("THROW");
|
||||||
@@ -91,10 +94,10 @@ public interface JetNodeTypes {
|
|||||||
JetNodeType RECEIVER_TYPE = new JetNodeType("RECEIVER_TYPE");
|
JetNodeType RECEIVER_TYPE = new JetNodeType("RECEIVER_TYPE");
|
||||||
JetNodeType FUNCTION_LITERAL = new JetNodeType("FUNCTION_LITERAL");
|
JetNodeType FUNCTION_LITERAL = new JetNodeType("FUNCTION_LITERAL");
|
||||||
JetNodeType ANNOTATED_EXPRESSION = new JetNodeType("ANNOTATED_EXPRESSION");
|
JetNodeType ANNOTATED_EXPRESSION = new JetNodeType("ANNOTATED_EXPRESSION");
|
||||||
JetNodeType REFERENCE_EXPRESSION = new JetNodeType("REFERENCE_EXPRESSION");
|
JetNodeType REFERENCE_EXPRESSION = new JetNodeType("REFERENCE_EXPRESSION", JetReferenceExpression.class);
|
||||||
JetNodeType BINARY_EXPRESSION = new JetNodeType("BINARY_EXPRESSION");
|
JetNodeType BINARY_EXPRESSION = new JetNodeType("BINARY_EXPRESSION");
|
||||||
JetNodeType PREFIX_EXPRESSION = new JetNodeType("PREFIX_EXPRESSION");
|
JetNodeType PREFIX_EXPRESSION = new JetNodeType("PREFIX_EXPRESSION", JetPrefixExpression.class);
|
||||||
JetNodeType POSTFIX_EXPRESSION = new JetNodeType("POSTFIX_EXPRESSION");
|
JetNodeType POSTFIX_EXPRESSION = new JetNodeType("POSTFIX_EXPRESSION", JetPostfixExpression.class);
|
||||||
JetNodeType CALL_EXPRESSION = new JetNodeType("CALL_EXPRESSION");
|
JetNodeType CALL_EXPRESSION = new JetNodeType("CALL_EXPRESSION");
|
||||||
JetNodeType ARRAY_ACCESS_EXPRESSION = new JetNodeType("ARRAY_ACCESS_EXPRESSION");
|
JetNodeType ARRAY_ACCESS_EXPRESSION = new JetNodeType("ARRAY_ACCESS_EXPRESSION");
|
||||||
JetNodeType INDICES = new JetNodeType("INDICES");
|
JetNodeType INDICES = new JetNodeType("INDICES");
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetConstantExpression extends JetExpression {
|
||||||
|
public JetConstantExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitConstantExpression(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetExpression extends JetElement {
|
||||||
|
public JetExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitExpression(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetPostfixExpression extends JetExpression {
|
||||||
|
public JetPostfixExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitPostfixExpression(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetExpression getBaseExpression() {
|
||||||
|
return findChildByClass(JetExpression.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetPrefixExpression extends JetExpression {
|
||||||
|
public JetPrefixExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitPrefixExpression(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetExpression getBaseExpression() {
|
||||||
|
return findChildByClass(JetExpression.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetReferenceExpression extends JetExpression {
|
||||||
|
public JetReferenceExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitReferenceExpression(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetTupleExpression extends JetExpression {
|
||||||
|
public JetTupleExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitTupleExpression(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JetExpression> getComponents() {
|
||||||
|
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetExpression.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.jetbrains.jet.lang.psi;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
public class JetTypeofExpression extends JetExpression {
|
||||||
|
public JetTypeofExpression(@NotNull ASTNode node) {
|
||||||
|
super(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(JetVisitor visitor) {
|
||||||
|
visitor.visitTypeofExpression(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetExpression getBaseExpression() {
|
||||||
|
return findChildByClass(JetExpression.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,4 +129,32 @@ public class JetVisitor extends PsiElementVisitor {
|
|||||||
public void visitArgument(JetArgument argument) {
|
public void visitArgument(JetArgument argument) {
|
||||||
visitJetElement(argument);
|
visitJetElement(argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void visitExpression(JetExpression expression) {
|
||||||
|
visitJetElement(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitConstantExpression(JetConstantExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitTupleExpression(JetTupleExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitPostfixExpression(JetPostfixExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visitTypeofExpression(JetTypeofExpression expression) {
|
||||||
|
visitExpression(expression);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user