blob: f87266e02f9c18a18f9020f590003f7fce770211 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2016 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.python.parser.ast.expressions;
import org.eclipse.dltk.ast.ASTVisitor;
import org.eclipse.dltk.ast.DLTKToken;
import org.eclipse.dltk.ast.expressions.Expression;
import org.eclipse.dltk.python.parser.ast.PythonConstants;
import org.eclipse.dltk.utils.CorePrinter;
public class PythonImportExpression extends Expression
{
private DLTKToken fName;
public PythonImportExpression( DLTKToken t ) {
super( t );
fName = t;
}
@Override
public int getKind( ) {
return PythonConstants.E_IMPORT;
}
@Override
public void traverse( ASTVisitor pVisitor ) throws Exception {
if( pVisitor.visit( this ) ) {
pVisitor.endvisit( this );
}
}
public String getName( ) {
if( this.fName != null ) {
return this.fName.getText( );
}
else {
return null;
}
}
@Override
public void printNode( CorePrinter output ) {
if( this.fName != null ) {
output.formatPrintLn( this.fName.getText( ) );
}
}
@Override
public String toString( ) {
String text = "Python Import Expression:";
if( this.fName != null ) {
text += this.fName;
}
return text;
}
}